Is there any missing in my simulation via lsim?

조회 수: 1 (최근 30일)
Volkan Yangin
Volkan Yangin 2020년 12월 3일
댓글: Deepak Gupta 2020년 12월 3일
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. :)
Deepak Gupta
Deepak Gupta 2020년 12월 3일
You are welcome.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by