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

1 view (last 30 days)
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.

Accepted Answer

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

More Answers (0)

Categories

Find more on Dynamic System Models in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!