- Problem was that your u was a scalar. Used elementwise multiplication .* to fix this. Then transposed u.
- Problem was that your System has two inputs. So you have to provide 2 inputs by giving u a second column. I used zeros for this and applied the sine to the first input. Please check if this needs to be changed.
Error using lsim for state space representation
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, I'm running into an issue with my state space model on matlab and it keeps giving me the same error: "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. Error in t2a (line 8) lsim(sys,u1,t)" I'm trying to run a sine wave input to my two degrees of freedom system and would love some help. Thanks!
A =[ 0 1 0 0; -0.2452 0 -.1205 0; 0 0 0 1; 0.13196 0 -0.13196 0]; B = [0 0; 1/2887 0; 0 0; 0 1/2637]; C = [1 0 0 0; 0 0 1 0]; D = [0]; t = 0:0.1:4; u = sin(11.17*t); sys = ss(A,B,C,D) lsim(sys,u,t) grid
0 件のコメント
回答 (1 件)
Stephan
2018 年 11 月 3 日
Hi,
this works:
A =[ 0 1 0 0; -0.2452 0 -.1205 0; 0 0 0 1; 0.13196 0 -0.13196 0];
B = [0 0; 1/2887 0; 0 0; 0 1/2637];
C = [1 0 0 0; 0 0 1 0]; D = [0];
t = 0:0.1:4
u(:,1) = (sin(11.17.*t))'
u(:,2) = zeros(numel(t),1)
sys = ss(A,B,C,D)
lsim(sys,u,t)
grid
If this answer was useful for you please accept it.
Best regards
Stephan
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Time and Frequency Domain Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!