Error using DynamicSystem/lsim

조회 수: 5 (최근 30일)
Anthony Sirico
Anthony Sirico 2021년 2월 12일
답변: Shubham Khatri 2021년 2월 21일
clear; clc; close all;
A = [1 0 0 0; 0 -1 0 0; 0 0 -2 0; 0 0 0 -3];
B = [1 0; -1 1; 0 -1; 1 -1];
C = eye(4);
D = 0;
X0 = [-2; -1; 1; 2];
EvA = eig(A);
sys = ss(A,B,C,D);
AT = transpose(A)
BT = transpose(B)
t = 0:1:3;
t0 = 0;
tfinal = 3;
Wc = integral(@(t) integrand(t,t0,A,B),t0,tfinal,'ArrayValued',true);
IW = inv(Wc)
phi = exp(AT.*(-t));
u = -BT*phi*IW*X0;
lsim(sys, u, t, X0)
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 of numeric values with at least two rows (samples) and without
any NaN or Inf.
Error in HW3_1 (line 19)
lsim(sys, u, t, X0)
Any thoughts

답변 (1개)

Shubham Khatri
Shubham Khatri 2021년 2월 21일
Hello,
This error occurs when the number of rows in 'u' is not equal to number of rows in 't'. Please refer to the documentation link of the integral , lsim for more information.
Hope it helps

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by