How to apply a step input to only ONE of the multi-inputs in a MIMO state space model?
Show older comments
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 Comments
Raj
on 2 May 2019
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
on 2 May 2019
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!