Wrong with matrix dimensions(lsim command)

2 ビュー (過去 30 日間)
semih kahraman
semih kahraman 2020 年 5 月 4 日
コメント済み: semih kahraman 2020 年 5 月 4 日
It gives an error while using the lsim command.
a=[-15000 -10000 4000;-3333.333 -7000 -2666.666;2000 -4000 -8500];
b=[1000 0 0 ;333.333 0 0; 25000 0 0];
c=[1 0 0;0 1 0;0 0 1];
d=[0 0 0;0 0 0;0 0 0];
x0=[5.6,-4.82,6.51];
t=0:0.01:5;
u=[5*t.^2+10;2*exp(t)+5;1];
[y x]= lsim(a,b,c,d,u,t,x0);
subplot(331),plot(t,x(:,1)); xlabel('t'),ylabel('I_1(t)'),grid
subplot(332),plot(t,x(:,2)); xlabel('t'),ylabel('I_2(t)'),grid
subplot(333),plot(t,x(:,3)); xlabel('t'),ylabel('I_3(t)'),grid
Error using vertcat
Dimensions of arrays being concatenated are not consistent.

採用された回答

Paresh yeole
Paresh yeole 2020 年 5 月 4 日
In the input u, the dimensions are not properly assigned.
Try:
u=[5*t.^2+10;2*exp(t)+5;ones(size(t))];
  1 件のコメント
semih kahraman
semih kahraman 2020 年 5 月 4 日
thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by