答案 0 :(得分:1)
如果您的系统有10个输入,并且您希望模拟Nt
个时间步,那么t
应为1 x Nt
且u
应为18 x Nt
,例如:
sys = whatever;
m = 10; % num inputs
Nt = 1000; % 1000 samples
t_end = 10; % simulate for 10 seconds
t = linspace(0, t_end, Nt);
u = ones(m, Nt); % a step input on all inputs
y = lsim(sys, u, t);
% or, e.g.
u = [sin(t); cos(t); zeros(m-2, Nt)]; % sin and cos for the first two inputs,
% zero for the others
y = lsim(sys, u, t);