How to apply a step input to only ONE of the multi-inputs in a MIMO state space model?

33 次查看(过去 30 天)
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.
  2 个评论
Raj
Raj 2019-5-2
I think there is some problem in your state space model itself.
For a model with Nx states, Ny outputs, and Nu inputs:
  • A is an Nx-by-Nx real- or complex-valued matrix.
  • B is an Nx-by-Nu real- or complex-valued matrix.
  • C is an Ny-by-Nx real- or complex-valued matrix.
  • D is an Ny-by-Nu real- or complex-valued matrix.
Basically what I am trying to tell is that C and D should have same number of rows. Can you please check again.
J
J 2019-5-2
@Raj, you are right. I actually modified the code a bit and forgot to make the C and D rows equal! I just fixed that. Any ideas on my actual question? Thanks.

请先登录,再进行评论。

采纳的回答

Raj
Raj 2019-5-3
编辑:Raj 2019-5-3
The 'lsim' functon will work here. The code is correct and the input is getting applied only to the elevator (U3). If you are thinking why all the states are responding to only elevator input then this is expected because its a MIMO system and all the output states are coupled to each other. So basically there is no issue here.
However you can note a few minor things:
1) In this case you are checking open loop system response but I assume your next step will be to design a contoller here as the system is clearly unstable. Its always a good idea to let the plant settledown before applying any input in cases where you have some initial transient response. So in that case, after you define your input you can just make the input U3 zero for say 1 second before giving a step. Something like this:
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
for i=1:127 % Till 127th sample i.e. 1 sec in this case
u(3,i)=0;
end
2) Your state space system 'sys' is basically a 9x7 ss matrix depending on your number of inputs (7) and number of output state vectors (9). Now if you want to see impulse response of third input U3 to first state vector X1(Pitch rate) then just use:
impulse(sys(1,3))
3) You are already plotting the time response of first state vector (Pitch rate). I see no issue there.
  5 个评论
Raj
Raj 2019-5-3
Yes, step also can be done in same way. You are correct about the '1' also. The same thing that you have used in your plot command plot(t,x(:,1)) i.e. the first state (Pitch rate) out of the four states. Glad we both learned something today. Cheers!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Time and Frequency Domain Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by