function tr = Trans(Sys,xo,uo,delt,tf,LLD,SBA,LON,DIM) % LTI Transient Response using 'lsim' % January 8, 2009 tr = 1; if LLD >=1 % Reduced-Order Model if SBA >= 1 'Stability Axes' xo = [xo(4),xo(5),xo(6),xo(7),xo(8),xo(9),... xo(10),xo(11),xo(12),xo(13),xo(14),xo(15)]; if DIM < 6 'Fourth Order' if LON >= 1 'Longitudinal' xo = [xo(1),(xo(11) - xo(3)),xo(8),xo(3)]; uo = [uo(1),uo(4),uo(6),uo(7)]; else 'Lateral-Directional' xo = [xo(9),xo(2),xo(7),xo(10)]; uo = [uo(2),uo(3),uo(5)]; end else 'Sixth Order' if LON >= 1 'Longitudinal' xo = [xo(1),xo(3),xo(8),xo(11),xo(4),xo(6)]; uo = [uo(1),uo(4),uo(6),uo(7)]; else 'Lateral-Directional' xo = [xo(2),xo(7),xo(9),xo(10), xo(12), xo(5)]; uo = [uo(2),uo(3),uo(5)]; end end else 'Body Axes' xo = [xo(1),xo(2),xo(3),xo(7),xo(8),xo(9),... xo(10),xo(11),xo(12),xo(13),xo(14),xo(15)]; if DIM < 6 'Fourth Order' if LON >= 1 'Longitudinal' xo = [xo(1),xo(3),xo(8),xo(11)]; uo = [uo(1),uo(4),uo(6),uo(7)]; else 'Lateral-Directional' xo = [xo(2),xo(7),xo(9),xo(10)]; uo = [uo(2),uo(3),uo(5)]; end else 'Sixth Order' if LON >= 1 'Longitudinal' xo = [xo(1),xo(3),xo(8),xo(11),xo(4),xo(6)]; uo = [uo(1),uo(4),uo(6),uo(7)]; else 'Lateral-Directional' xo = [xo(2),xo(7),xo(9),xo(10), xo(12), xo(5)]; uo = [uo(2),uo(3),uo(5)]; end end end else 'Original Model' xo = [xo(1),xo(2),xo(3),xo(7),xo(8),xo(9),... xo(10),xo(11),xo(12),xo(13),xo(14),xo(15)]; end % Transient Response Simulation t = 0:delt:tf; u = []; for i = 1:length(t) u = [u;uo]; end [y,t,x] = lsim(Sys,u,t,xo); figure subplot(2,2,1) plot(t,x(:,1)) xlabel('Time, s'), ylabel('x(1)'), grid subplot(2,2,2) plot(t,x(:,2)) xlabel('Time, s'), ylabel('x(2)'), grid subplot(2,2,3) plot(t,x(:,3)) xlabel('Time, s'), ylabel('x(3)'), grid subplot(2,2,4) plot(t,x(:,4)) xlabel('Time, s'), ylabel('x(4)'), grid if (LLD <= 0) figure subplot(2,2,1) plot(t,x(:,5)) xlabel('Time, s'), ylabel('x(5)'), grid subplot(2,2,2) plot(t,x(:,6)) xlabel('Time, s'), ylabel('x(6)'), grid subplot(2,2,3) plot(t,x(:,7)) xlabel('Time, s'), ylabel('x(7)'), grid subplot(2,2,4) plot(t,x(:,8)) xlabel('Time, s'), ylabel('x(8)'), grid figure subplot(2,2,1) plot(t,x(:,9)) xlabel('Time, s'), ylabel('x(9)'), grid subplot(2,2,2) plot(t,x(:,10)) xlabel('Time, s'), ylabel('x(10)'), grid subplot(2,2,3) plot(t,x(:,11)) xlabel('Time, s'), ylabel('x(11)'), grid subplot(2,2,4) plot(t,x(:,12)) xlabel('Time, s'), ylabel('x(12)'), grid end if (LLD >= 1 & DIM >= 6) figure subplot(1,2,1) plot(t,x(:,5)) xlabel('Time, s'), ylabel('x(5)'), grid subplot(1,2,2) plot(t,x(:,6)) xlabel('Time, s'), ylabel('x(6)'), grid end