No BSD License  

Highlights from
Control of Spacecraft and Aircraft

P14_4_1b.m
% Script p14_4_1b.m; LQR SAS for OH-6A coupled long./lat. motions in
% hover and response to command for yaw angular velocity; x=[u,w,q,th,v,
% r,p,ph]'; u=[de,dc,da,dr]'; units ft, sec, crad; d's in deci-in;
%                                                 11/90, 9/91, 2/1/01
%
F11=[-.0257 .0113 .013 -.3216; -.0422 -.3404 .0001 -.0093; ...
     1.26 -.6 -1.7645 0; 0 0 .9986 0];
F12=[.0004 -.0006 -.0081 0; -.044 .0147 .0005 .0171; ...
     -.26 .0719 .3763 0; 0 .0532 0 0];
F21=[.0158 -.0194 -.0084 0; -2.62 3.1 -.1724 0; ...
      .03 -.19 -1.136 0; 0 0 -.0015 0];
F22=[-.0435 .0034 -.0134 .3216; -.170 -.8645 -1.075 0; ...
     -4.620 -.2873 -4.92 0; 0 .0289 1 0];
F=[F11 F12; F21 F22];
G=[.0216 .086 -.0028 -.003; -.7343 -.0016 .0011 -.003; ...
   -.785 -7.408 .35 -.096; 0 0 0 0; ...
   -.0057 .0038 .0514 .153; 9.507 .493 1.982 -25.68; ...
   1.206 1.874 12.79 -.781; 0 0 0 0];
H=[eye(2) zeros(2,6); zeros(2,4) eye(2) zeros(2)]; L=zeros(4);
A=eye(4); B=A; k=lqr(F,G,H'*A*H,B); ev=eig(F-G*k);
H1=[0 0 0 1 0 0 0 0; 0 0 0 0 0 0 0 1]; L1=zeros(2,4);
t=[0:.08:8]'; yc=[0 0 0 10]';
[y,y1,u]=stepcmd(F,G,H,L,k,yc,H1,L1,t);
%
figure(1); clf; subplot(311), plot(t,y); grid; axis tight
xlabel('Time (sec)'); legend('u','w','v','r')
title('OH-6A Response to Command for Sideslip Velocity')
subplot(312), plot(t,u); grid; axis tight
legend('\delta_e','\delta_c','\delta_a','\delta_r')
title('Units ft, sec, crad, deci-in')
subplot(313), plot(t,y1); grid; xlabel('Time (sec)'); 
legend('\theta','\phi'); axis tight

Contact us at files@mathworks.com