why lsim return empty states?
显示 更早的评论
I have build a sparse state space system, and solved using lsim. According to the documentation, the third output represent the state trajectory.
When I run this example, the third output is empty.
Is there anything wrong I am doing? how can I get the states with time?
Thanks!
% inputs defining sparse state space system size
N_inputs = 41;
N_outputs = 240;
N_states = 2400;
N_time_steps = 10;
% defining the sparse state space system
G = sprand(N_states, N_states, 0.01);
B = sprand(N_states, N_inputs, 0.01);
E = sprand(N_outputs, N_states, 0.01);
D = 0;
C = sprand(N_states, N_states, 0.01);
sys = sparss(G, B, E, D, C);
% solving
t = linspace(0,1,N_time_steps);
[y,tOut,x] = lsim( ...
sys, ...
rand(N_inputs, length(t)), ...
t);
% check the size of each output
disp(size(y))
disp(size(tOut))
disp(size(x)) % why this is empty? how can I force lsim to return it?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Model Attributes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!