Hi,
I have a state space model of an aircraft at a specific flight condition as follows:
A = [ -12 -4 1 -1;... 1 -5 4 2;... 0 0 5 -2;... 5 5 2 0]; %inputs: u1 u2 u3 u4 u5 u6 u7
B = [10 2 -11 17 2 7 34;... 10 0 5 0 -6 1 9;... -10 0 2 -10 7 1 5;... 0 0 0 0 0 0 0]; C = [1 0 0 0;... 0 1 0 0;... 0 0 1 0;... 0 0 0 1;... 0 0 0 0;... .1 0 .1 0;... 0 .1 .1 .1;... 0 0 .1 .1;... 0 0 0 0]; D = [0 0 0 0 0 0 0;... 0 0 0 0 0 0 0;... 0 0 0 0 0 0 0;... 0 0 0 0 0 0 0;... 0 0 0 0 0 0 0;... 0 0 0 0 0 0 0;... 0 0 .1 0 0 0 0;... 0 .1 0 0 0 .1 0;... 0 .1 0 0 .1 0 0]; %state space
sys = ss(A,B,C,D); %ss system
[y1,t,x1] = step(sys); %get sim time only
t=t'; %sim time
%step input applied only to elevator
u = [zeros(size(t)); zeros(size(t)); ones(size(t)); zeros(size(t));... zeros(size(t)); zeros(size(t)); zeros(size(t))]; %u3(elevator) = 1, a step input
[y,t,x] = lsim(sys,u,t);%plot
figure(1), plot(t,x(:,1)), title('pitch rate')
I am trying to apply a step input and an impulse ONLY to the elevator of the aircraft which is u3 (based on the 7 inputs from the B matrix). I am not sure if the lsim functon works by applying a step input only to the elevator as included in the code above or if there is a better way to do this (same for the impulse). Also, how to plot the response to this inputs?
Any help would be greatly appreciate it.
Thank you.
Best Answer