-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathplot_xi_ref_vs_contr.m
106 lines (100 loc) · 3.46 KB
/
plot_xi_ref_vs_contr.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
% Plots reference state vs controlled reference state
% x ref
plot_tikz = true;
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
h = plot(timeseries(xi_ref.data(1:10:end,1),xi_ref.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
hold on;
h = plot(timeseries(xi_ref_contr.data(1:10:end,1),xi_ref_contr.time(1:10:end)));
set(h(1),'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('x position [m]');
legend('reference','controlled','Location','Northwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('ref_vs_contr_x.tikz','width','.8\textwidth');
end;
% y ref
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
h = plot(timeseries(xi_ref.data(1:10:end,2),xi_ref.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
hold on;
h = plot(timeseries(xi_ref_contr.data(1:10:end,2),xi_ref_contr.time(1:10:end)));
set(h(1),'LineStyle','-','Color','r');
axis([0 12 -2 2]);
xlabel('Time [s]');
ylabel('y position [m]');
legend('reference','controlled','Location','Northwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('ref_vs_contr_y.tikz','width','.8\textwidth');
end;
% z ref
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
h = plot(timeseries(xi_ref.data(1:10:end,3),xi_ref.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
hold on;
h = plot(timeseries(xi_ref_contr.data(1:10:end,3),xi_ref_contr.time(1:10:end)));
set(h(1),'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('z position [m]');
legend('reference','controlled','Location','Northwest');
title('');
if (plot_tikz)
matlab2tikz('ref_vs_contr_z.tikz','width','.8\textwidth');
end;
% alpha ref
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
h = plot(timeseries(xi_ref.data(1:10:end,4),xi_ref.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
hold on;
h = plot(timeseries(xi_ref_contr.data(1:10:end,4),xi_ref_contr.time(1:10:end)));
set(h(1),'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('\alpha angle [rad]','Interpreter','tex');
legend('reference','controlled','Location','Northwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('ref_vs_contr_alpha.tikz','width','.8\textwidth');
end;
% beta ref
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
h = plot(timeseries(xi_ref.data(1:10:end,5),xi_ref.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
hold on;
h = plot(timeseries(xi_ref_contr.data(1:10:end,5),xi_ref_contr.time(1:10:end)));
set(h(1),'LineStyle','-','Color','r');
axis([0 12 -pi/2 pi/2]);
xlabel('Time [s]');
ylabel('\beta angle [rad]','Interpreter','tex');
legend('reference','controlled','Location','Northwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('ref_vs_contr_beta.tikz','width','.8\textwidth');
end;
% gamma ref
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
h = plot(timeseries(xi_ref.data(1:10:end,6),xi_ref.time(1:10:end)));
set(h(1),'LineStyle','--','Color','k');
hold on;
h = plot(timeseries(xi_ref_contr.data(1:10:end,6),xi_ref_contr.time(1:10:end)));
set(h(1),'LineStyle','-','Color','r');
axis([0 12 -pi/2 pi/2]);
xlabel('Time [s]');
ylabel('\gamma angle [rad]','Interpreter','tex');
legend('reference','controlled','Location','Northwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('ref_vs_contr_gamma.tikz','width','.8\textwidth');
end;