-
Notifications
You must be signed in to change notification settings - Fork 0
/
Output.m
executable file
·157 lines (136 loc) · 3.07 KB
/
Output.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
c=1;
%%%%%%%%%%%%%%%%%TRAJECTORY PLOT%%%%%%%%%%%%%%%%%%%%%%%
figure(c);
hold on;
plot(STATE(:,PosX),STATE(:,PosY),'*');
plot(ERROR(:,PosX)+ DES_STATE(:,PosX),ERROR(:,PosY) + DES_STATE(:,PosY),'rd');
plot(DES_STATE(:,PosX),DES_STATE(:,PosY),'k*');
hold off
grid on
axis equal
title('Trajectory')
fprintf('%d Trajectory\n',c)
legend('NonLinSys','FuzzyErrorSys','Ref')
c=c+1;
%%%%%%%%%%%%%%%%%CONTROL SIGNAL PLOT%%%%%%%%%%%%%%%%%%%%%%%
figure(c);
U = zeros(4,length(t));
V = U;
for i = 1:length(t)
[~,U(:,i)] = DRONE_SANTANA(t(i),STATE(i,:)',SimStruct);
end
plot(t',U,'d');
grid on
title('Control Signal')
fprintf('%d Control Signal\n',c)
legend('U_x','U_y','U_z','U_y_a_w');
c=c+1;
%%%%%%%%%%%%%%%%%COMPONENT PLOT%%%%%%%%%%%%%%%%%%%%%%%
figure(c);
hold on
plot(t,STATE(:,PosX),'*');
plot(t,ERROR(:,PosX)+ DES_STATE(:,PosX),'rd');
plot(t,DES_STATE(:,PosX),'k*');
hold off
grid on
legend('NonLinSys','FuzzyErrorSys','Ref')
title('x(t)')
fprintf('%d x(t)\n',c)
c=c+1;
figure(c);
hold on
plot(t,STATE(:,PosY),'*');
plot(t,ERROR(:,PosY)+ DES_STATE(:,PosY),'rd');
plot(t,DES_STATE(:,PosY),'k*');
hold off
grid on
legend('NonLinSys','FuzzyErrorSys','Ref')
title('y(t)')
fprintf('%d y(t)\n',c)
c=c+1;
figure(c);
hold on
plot(t,STATE(:,PosZ),'*');
plot(t,ERROR(:,PosZ)+ DES_STATE(:,PosZ),'rd');
plot(t,DES_STATE(:,PosZ),'k*');
hold off
grid on
legend('NonLinSys','FuzzyErrorSys','Ref')
title('z(t)')
fprintf('%d z(t)\n',c)
c=c+1;
figure(c);
hold on
plot(t,STATE(:,PosYaw),'*');
plot(t,ERROR(:,PosYaw)+ DES_STATE(:,PosYaw),'rd');
plot(t,DES_STATE(:,PosYaw),'k*');
hold off
grid on
legend('NonLinSys','FuzzyErrorSys','Ref')
title('yaw(t)')
fprintf('%d yaw(t)\n',c)
c=c+1;
if(SimStruct.WindDisturbance.Type)
figure(c);
D = zeros(4,length(t));
for i = 1:length(t)
D(:,i) = WindDisturbance(t(i),SimStruct.WindDisturbance);
end
plot(t',D(1,:));
grid on
% legend('$D_x$','$D_y$','$D_z$','$D_{\psi}$');
legend('Disturbance Signal')
c=c+1;
end
%%%%%%%%%%%%%%%%%ERROR PLOT%%%%%%%%%%%%%%%%%%%%%%%
figure(c);
plot(t,ERROR,'d');
grid on
title('Error')
fprintf('%d Error\n',c)
c=c+1;
%%%%%%%%%%%%%%%%%COMPONENT VELOCITY PLOT%%%%%%%%%%%%%%%%%%%%%%%
figure(c);
hold on
plot(t,STATE(:,VelX),'*');
plot(t,ERROR(:,VelX)+ DES_STATE(:,VelX),'rd');
plot(t,DES_STATE(:,VelX),'k*');
hold off
grid on
legend('NonLinSys','FuzzyErrorSys','Ref')
title('Velx(t)')
fprintf('%d Velx(t)\n',c)
c=c+1;
figure(c);
hold on
plot(t,STATE(:,VelY),'*');
plot(t,ERROR(:,VelY)+ DES_STATE(:,VelY),'rd');
plot(t,DES_STATE(:,VelY),'k*');
hold off
grid on
legend('NonLinSys','FuzzyErrorSys','Ref')
title('Vely(t)')
fprintf('%d Vely(t)\n',c)
c=c+1;
figure(c);
hold on
plot(t,STATE(:,VelZ),'*');
plot(t,ERROR(:,VelZ)+ DES_STATE(:,VelZ),'rd');
plot(t,DES_STATE(:,VelZ),'k*');
hold off
grid on
legend('NonLinSys','FuzzyErrorSys','Ref')
title('Velz(t)')
fprintf('%d Velz(t)\n',c)
c=c+1;
figure(c);
hold on
plot(t,STATE(:,VelYaw),'*');
plot(t,ERROR(:,VelYaw)+ DES_STATE(:,VelYaw),'rd');
plot(t,DES_STATE(:,VelYaw),'k*');
hold off
grid on
legend('NonLinSys','FuzzyErrorSys','Ref')
title('Velyaw(t)')
fprintf('%d Velyaw(t)\n',c)
c=c+1;