-
Notifications
You must be signed in to change notification settings - Fork 13
/
run_comparison.m
67 lines (54 loc) · 1.47 KB
/
run_comparison.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function run_comparison()
%RUN_COMPARISON Summary of this function goes here
% Detailed explanation goes here
SC = normal_DynamicProgramming_with_pulse_modulation_identical_ts;
close all
sim('SPHERES_lyapnov_model_pulse_modulation')
plot_compare(SC, states_out,thr_hist)
end
function plot_compare(SC, states_out,thr_hist)
t_lyapunov = states_out.Time;
t_DP = SC.history.T_ode45;
style_lyapunov = 'b-';
style_DP = 'r--';
style_refmodel = 'k-';
%% plot states
x_lyapunov = states_out.Data(:,1);
y_lyapunov = states_out.Data(:,2);
z_lyapunov = states_out.Data(:,3);
x_refmodel = refmodel_out.Data(:,1);
y_refmodel = refmodel_out.Data(:,2);
z_refmodel = refmodel_out.Data(:,3);
x_DP = SC.history.X_ode45(:,1);
y_DP = SC.history.X_ode45(:,2);
z_DP = SC.history.X_ode45(:,3);
figure('Name','states','Position',[7.4000 61.8000 538.4000 712.8000],...
'color', 'white')
subplot(3,2,1)
plot(t_DP, x_DP, style_DP)
hold on
grid on
plot(t_lyapunov, x_lyapunov, style_lyapunov)
plot(t_lyapunov, x_refmodel, style_refmodel)
xlabel('time (sec)')
ylabel('X_{rel} (m)')
axis fill
subplot(3,2,3)
plot(t_DP, y_DP, style_DP)
hold on
grid on
plot(t_lyapunov, y_lyapunov, style_lyapunov)
xlabel('time (sec)')
ylabel('Y_{rel} (m)')
axis fill
subplot(3,2,5)
plot(t_DP, z_DP, style_DP)
hold on
grid on
plot(t_lyapunov, z_lyapunov, style_lyapunov)
xlabel('time (sec)')
ylabel('Z_{rel} (m)')
axis fill
figure('Name','Thruster Firings','Position',[27.4000 61.8000 508.4000 712.8000],...
'color', 'white')
end