plot(t,(180/pi)*thtC,'-r','Linewidth',1);
hold off;
grid;
title('pitch (in deg) vs time(s)');
legend('Actual Measure','Reference')
subplot(325);
plot(t,z,'-g','Linewidth',2);
hold on
plot(t,ref(:,3),'-r','Linewidth',1);
hold off;
grid;
title('z(m) vs time(s)');
legend('Actual Measure','Reference')
subplot(326);
plot(t,(180/pi)*psi,'-g','Linewidth',2);
hold on;
plot(t,ref(:,4),'-r','Linewidth',1);
hold off;
grid;
title('yaw (in deg) vs time(s)');
legend('Actual Measure','Reference')
figure(3)
subplot(411)
plot(t,u1);
grid
title('Thrust (N) vs Time(s)');
subplot(412)
plot(t,u2(:,1));
grid
title('Rolling I/P(N m) vs Time(s)');
subplot(413)
plot(t,u2(:,2));
grid
title('Pitching I/P(N m) vs Time(s)');
subplot(414)
plot(t,u2(:,3));
grid
title('Yawing I/P(N m) vs Time(s)');
figure(4)
注释优化:
% subplot 1:绘制pitch变化随时间的曲线图
plot(t,(180/pi)*thtC,'-r','Linewidth',1);
hold off;
grid;
title('pitch (in deg) vs time(s)');
legend('Actual Measure','Reference')
% subplot 2:绘制z坐标变化随时间的曲线图(实际值和参考值)
subplot(325);
plot(t,z,'-g','Linewidth',2);
hold on
plot(t,ref(:,3),'-r','Linewidth',1);
hold off;
grid;
title('z(m) vs time(s)');
legend('Actual Measure','Reference')
% subplot 3:绘制yaw变化随时间的曲线图(实际值和参考值)
subplot(326);
plot(t,(180/pi)*psi,'-g','Linewidth',2);
hold on;
plot(t,ref(:,4),'-r','Linewidth',1);
hold off;
grid;
title('yaw (in deg) vs time(s)');
legend('Actual Measure','Reference')
% figure 3: 绘制四个子图,分别表示推力、滚转、俯仰和偏航的输入值随时间的变化情况
figure(3)
subplot(411)
plot(t,u1);
grid
title('Thrust (N) vs Time(s)');
subplot(412)
plot(t,u2(:,1));
grid
title('Rolling I/P(N m) vs Time(s)');
subplot(413)
plot(t,u2(:,2));
grid
title('Pitching I/P(N m) vs Time(s)');
subplot(414)
plot(t,u2(:,3));
grid
title('Yawing I/P(N m) vs Time(s)');
其中,subplot 1、2、3分别显示了pitch、z、yaw这三个值随时间的变化情况,subplot 2和3还额外表示了参考值。figure 3绘制了四个子图,分别表示推力、滚转、俯仰和偏航的输入值随时间的变化情况。