% Step4_Plot_Noninear_Sim.m   Version 9.2.1 9/28/06
% 
% OBJECTIVE: Plot results from the nonlinear flat earth simulation.
%
% INPUTS: In the Matlab workspace must be an array of simulation times (taircraft)
%         and a matrix of simulation outputs (yaircraft). These are generally
%         created by the SIMULINK simulations FlatEarth_MATLABx.mdl.
% OUTPUTS: Four figures, each with three subplots.

disp(' ');disp('Start here');disp(' ');
input='Time History Plots';
figure(1)
subplot(311)
plot(taircraft,yaircraft(:,5))
xlabel('time (sec)')
ylabel('Q, Pitch Rate (rad/sec)')
title(input)

subplot(312)
plot(taircraft,yaircraft(:,8))
xlabel('time (sec)')
ylabel('theta, Pitch Angle (rad)')

subplot(313)
plot(taircraft,yaircraft(:,14))
xlabel('time (sec)')
ylabel('alpha, Angle of Attack (rad)')

figure(2)
subplot(311)
plot(taircraft,yaircraft(:,6))
xlabel('time (sec)')
ylabel('R, Yaw Rate (rad/sec)')
title(input)

subplot(312)
plot(taircraft,yaircraft(:,9))
xlabel('time (sec)')
ylabel('psi, Yaw Angle (rad)')

subplot(313)
plot(taircraft,yaircraft(:,15))
xlabel('time (sec)')
ylabel('beta, Side Slip (rad)')

figure(3)
subplot(311)
plot(taircraft,yaircraft(:,4))
xlabel('time (sec)')
ylabel('P, Roll Rate (rad/sec)')
title(input)

subplot(312)
plot(taircraft,yaircraft(:,7))
xlabel('time (sec)')
ylabel('phi, Roll Angle (rad)')

subplot(313)
plot(taircraft,yaircraft(:,11))
xlabel('time (sec)')
ylabel('Y (ft)')

figure(4)
subplot(311)
plot(taircraft,deltaE)
xlabel('time (sec)')
ylabel('Elevator (rad)')
title(input)

subplot(312)
plot(taircraft,deltaA)
xlabel('time (sec)')
ylabel('Aileron (rad)')

subplot(313)
plot(taircraft,deltaR)
xlabel('time (sec)')
ylabel('Rudder (rad)')

figure(5)
subplot(211)
plot(taircraft,yaircraft(:,12))
xlabel('time (sec)')
ylabel('Altitude (ft)')

subplot(212)
plot(taircraft,yaircraft(:,13))
xlabel('time (sec)')
ylabel('Velocity (ft/sec)')
