load athans.dat % t=athans(:,1); x1=athans(:,2); x2=athans(:,3); x3=athans(:,4); x4=athans(:,5); l1=athans(:,6); l2=athans(:,7); l3=athans(:,8); l4=athans(:,9); S=athans(:,10); u=athans(:,11); % clf subplot(2,2,1) plot(t,x1) xlabel('State Variable x_1(t)','FontSize',13) axis([0 4.2 -10 15]) % subplot(2,2,2) plot(t,x2) xlabel('State Variable x_2(t)','FontSize',13) axis([0 4.2 -15 10]) % subplot(2,2,3) plot(t,x3) xlabel('State Variable x_3(t)','FontSize',13) axis([0 4.2 -15 15]) % subplot(2,2,4) plot(t,x4) xlabel('State Variable x_4(t)','FontSize',13) axis([0 4.2 -15 15]) % print -depsc athans1 % pause figure % clf subplot(2,2,1) plot(t,l1) xlabel('Adjoint Variable \lambda_1(t)','FontSize',13) axis([0 4.2 -1 1.5]) % subplot(2,2,2) plot(t,l2) xlabel('Adjoint Variable \lambda_2(t)','FontSize',13) axis([0 4.2 -1.5 1.5]) % subplot(2,2,3) plot(t,l3) xlabel('Adjoint Variable \lambda_3(t)','FontSize',13) axis([0 4.2 -1.5 1.5]) % subplot(2,2,4) plot(t,l4) xlabel('Adjoint Variable \lambda_4(t)','FontSize',13) axis([0 4.2 -1.5 1.5]) % print -depsc athans2 % pause figure % clf subplot(2,2,1) plot(t,u) xlabel('Optimal Control u(t)','FontSize',13) axis([0 4.2 -1.2 1.2]) % subplot(2,2,3) plot(t,S) xlabel('Switching Function S(t)','FontSize',13) axis([0 4.2 -2 2]) hold plot([0 4.2],[0 0],'r--') % print -depsc athans3 % pause % clear all return