Is there any missing in my simulation via lsim?

1 次查看(过去 30 天)
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);

采纳的回答

Deepak Gupta
Deepak Gupta 2020-12-3
编辑:Deepak Gupta 2020-12-3
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 个评论
Volkan Yangin
Volkan Yangin 2020-12-3
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. :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Model Predictive Control Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by