How can i get any response of this state space model?

1 回表示 (過去 30 日間)
Volkan Yangin
Volkan Yangin 2020 年 11 月 3 日
回答済み: Ameer Hamza 2020 年 11 月 3 日
Hi,
I want to get response of my state space model for any input i create. For this purpose, i use lsim command, but take error message from MATLAB.
My input should be constant for 0.01 second. I add my codes below.
State space model i have is cell-array format. At the code box, you will see the model as sys{1}, nevertheless i have wrote the A,B,C,D matrices.
Thanks for your help!
Note: I know that step command can be used for this, but in the next steps, i will create different and various input signals. So, i should learn the method of creating of user-defined input signals.
A =
x1 x2
x1 0.4343 -10.59
x2 0.6581 -0.9007
B =
u1
x1 0.07221
x2 0.1236
C =
x1 x2
y1 7.463 10.63
y2 0 1
D =
u1
y1 0
y2 0
time=0:0.001:0.01;
u=[5 ; 5];
lsim(sys{1},u,time)
grid on
%Error using DynamicSystem/lsim (line 97)
%When simulating the response to a specific input signal, the input data U must be a matrix with as many rows as samples in the time vector T, and as many columns as input channels.

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 3 日
Vector 'u' must have same number of elements as 't'
u = 5*ones(size(t));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDynamic System Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by