Is there any missing in my simulation via lsim?

2 visualizaciones (últimos 30 días)
Volkan Yangin
Volkan Yangin el 3 de Dic. de 2020
Comentada: Deepak Gupta el 3 de Dic. de 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);

Respuesta aceptada

Deepak Gupta
Deepak Gupta el 3 de Dic. de 2020
Editada: Deepak Gupta el 3 de Dic. de 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 comentarios
Volkan Yangin
Volkan Yangin el 3 de Dic. de 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 el 3 de Dic. de 2020
You are welcome.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Model Predictive Control Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by