- 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.
How to apply a step input to only ONE of the multi-inputs in a MIMO state space model?
조회 수: 22 (최근 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
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:
Basically what I am trying to tell is that C and D should have same number of rows. Can you please check again.
채택된 답변
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
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 Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!