Filter löschen
Filter löschen

Is there any missing in my simulation via lsim?

1 Ansicht (letzte 30 Tage)
Volkan Yangin
Volkan Yangin am 3 Dez. 2020
Kommentiert: Deepak Gupta am 3 Dez. 2020
Hi,
I have a state space model below and my inputs are u1=[0.1 0.1] and u2=[1000 1000] for t=[0 0.01]. I have created a simulation via lsim, but cannot interpret the result. y contains 2 row and 5 colums.
First and second row of y matrix may be response of u1 and u2, respectively. Is it true? If not, what kind of changes should be implemented?
Thanks a lot!
clear all
clc
A=[-7444.77164115946,-599.270627675764,8044.02226883523;-691.454570395112,-16892.1898770254,17583.6444474206;372.559091389383,552.872851621845,-925.411948133179]
B=[46.4975814650873,4.86992276325991e-05;79.6181664163725,8.33880620847428e-05;84.7452633446908,0.000485367885501476]
C=[-7444.77164115946,-599.260627675764,8044.03226883523;0,1,0;372.549091389383,552.862851621845,-925.411948133179;1,0,0;0,0,1]
D=[46.4975814650873,4.86992276325991e-05;0,0;84.7452633446908,0.000485367885501476;0,0;0,0]
sys=ss(A,B,C,D);
tspan=[0 0.01]
[y,tspan]=lsim(sys,[0.1*ones(1,numel(tspan)); 1000*ones(1,numel(tspan))],tspan);

Akzeptierte Antwort

Deepak Gupta
Deepak Gupta am 3 Dez. 2020
Bearbeitet: Deepak Gupta am 3 Dez. 2020
Hi Volkan,
I am not being sarcastice, just a suggetion, i think you should go through the basics of state space modeling. for better understanding.
Looking at the matrices in the code, i drive following.
Sizes of matrices... A = 3*3, B = 3*2; C = 5*3, and D = 5*2;
Now state space equtions are
diff(x) = Ax+Bu
y = Cx+Du;
So from second equation you can see dimentions of C and D decide the number of outputs you are generating. Mutiplication of C with x with give you 5*3*3*1 = 5*1 and so will multiplication of D and u i.e. Du = 5*2*2*1 = 5*1.
So the output you are getting is correct.
Note: From your comments i get impresstion that you think, outputs will be the size of input vector but that's not true. One input can generate multiple outputs, it simply depends upon the design of your system.
Cheers,
Deepak
  2 Kommentare
Volkan Yangin
Volkan Yangin am 3 Dez. 2020
Thanks a lot Dinesh,
Number of elements of state variables and output variables are different in my simulation as you mentioned. I think, i couldn't express this situation correctly, but we agree on this problem. :)
Deepak Gupta
Deepak Gupta am 3 Dez. 2020
You are welcome.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Model Predictive Control Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by