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

1 Ansicht (letzte 30 Tage)
Volkan Yangin
Volkan Yangin am 3 Nov. 2020
Beantwortet: Ameer Hamza am 3 Nov. 2020
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.

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 3 Nov. 2020
Vector 'u' must have same number of elements as 't'
u = 5*ones(size(t));

Weitere Antworten (0)

Kategorien

Mehr zu Dynamic System Models 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