lsim function not work for polynomial model

5 views (last 30 days)
zhenzhen Jiang
zhenzhen Jiang on 3 Nov 2021
Commented: zhenzhen Jiang on 4 Nov 2021
a= lsim(sys_MIMO(1, 1),X_filt(:,1),t_new) %based on transfer function model works
b= lsim(sys_MIMO1(1, 1),X_filt(:,1),t_new) %based on polynomial model error popup
%Error using DynamicSystem/lsim (line 84)
%For models with unspecified sample time, time is counted in samples and the time increment must be 1 (one %sample).

Accepted Answer

Paul
Paul on 3 Nov 2021
I'm not sure what a "polynomial model" is. But that error message means that lsim is being called on a discrete time system that has an unspcifiied sample time, but the time vector input to lsim is not [0 1 2 3 4 5 ....] (actually, the first point doesn't have to be 0 I don't believe).
For example define a discrete time system with sample time = 0.1 and simuate it for 1 second
sys = tf(1,[1 .5],0.1);
t = 0:.1:1;
y = lsim(sys,sin(t),t); % works
Now define a discrete time system with undefined sample time an simulate it for 11 samples
sys = tf(1,[1 .5],-1)
sys = 1 ------- z + 0.5 Sample time: unspecified Discrete-time transfer function.
n = 0:10;
y = lsim(sys,sin(n),n); % works
But an error results with
y = lsim(sys,sin(t),t)
Error using DynamicSystem/lsim (line 84)
For models with unspecified sample time, time is counted in samples and the time increment must be 1 (one sample).
So sys_MIMO1 either needs to have a sample time defined, or you'll have to lsim() it with a sequence of integers as the time input.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!