How can i get any response of this state space model?
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
Ameer Hamza
2020년 11월 3일
Vector 'u' must have same number of elements as 't'
u = 5*ones(size(t));
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Dynamic System Models에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!