function damping_confirmed() H = 1000; % m V = 38; % m/s m = 350; % kg [success,opts, op_point] = get_trim_Lon(H,V,m); if success [Glon,Glat] = linfdm(opts.fcn,op_point); end U0 = V; A1 = Glat.A; B1 = Glat.B; c1 = Glat.C; D1 = Glat.D; % inputs: [da dr] % states: [beta p r phi] % outputs: [beta p r phi] A2 = [A1(1,1) A1(1,2:end)./U0;A1(2,1)*U0 A1(2,2:end);A1(3,1)*U0 A1(3,2:end);A1(4,1)*U0 A1(4,2:end)]; % delta_beta = atan(delta_v/u0) B2 = [B1(1,:)./U0;B1(2,:);B1(3,:);B1(4,:)]; C2 = eye(4); D2 = zeros(4,2); % inputs: [dr da] % states: [beta r p phi] % outputs: [r phi] A = A2([1 3 2 4],[1 3 2 4]); B = B2([1 3 2 4],[2 1]); C = [0 1 0 0;0 0 0 1]; D = zeros(2,2); sys = ss(A,B,C,D); set(sys, 'inputname', {'rudder' 'aileron'},... 'outputname', {'yaw rate' 'bank angle'},... 'statename', {'beta' 'yaw' 'roll' 'phi'}); damp(sys) figure(1) axis(gca,'normal') h = pzplot(sys); setoptions(h,'FreqUnits','rad/s','Grid','off'); figure(2) impulseplot(sys,20) figure(3) sys11 = sys('yaw','rudder'); % select I/O pair h = bodeplot(sys11); setoptions(h, 'FreqUnits','rad/s','MagUnits','dB','PhaseUnits','deg'); figure(4) h = rlocusplot(sys11); setoptions(h,'FreqUnits','rad/s') figure(5) % need positive feedback h = rlocusplot(-sys11); setoptions(h,'FreqUnits','rad/s') sgrid % damping gain k = 0.83; cl11 = feedback(sys11,-k); figure(6) impulseplot(sys11,'b--',cl11,'r') legend('open loop','closed loop','Location','SouthEast') xlim([0 10]); figure(7) % see how the response for the aileron looks cloop = feedback(sys,-k,1,1); damp(cloop) % closed-loop poles impulseplot(sys,'b--',cloop,'r',20) % MIMO impulse response xlim([0 10]); figure(8) impulseplot(cloop('bank angle','aileron'),'r',18) % Form the washout filter s = tf('s'); H = tf([1 0],[1 1]); figure(9) oloop = H * (-sys11); % open loop' h = rlocusplot(oloop); setoptions(h, 'FreqUnits','rad/s') sgrid figure(10) k = 0.83; wof = -k * H; % washout compensator cloop = feedback(sys,wof,1,1); impulseplot(sys,'b--',cloop,'r',20) end