- 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?

31 views (last 30 days)

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:

Basically what I am trying to tell is that C and D should have same number of rows. Can you please check again.

### Accepted Answer

Raj
on 3 May 2019

Edited: Raj
on 3 May 2019

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 Comments

Raj
on 3 May 2019

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!