ERROR: Incorrect dimensions for matrix multiplication

10 ビュー (過去 30 日間)
Stancu Andreea
Stancu Andreea 2020 年 4 月 16 日
コメント済み: Walter Roberson 2020 年 4 月 16 日
ERROR: Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the
number of rows in the second matrix. To perform elementwise multiplication, use '.*'.
syms s t
A=[1 2 0;1 4 3; 0 2 1];
B=[3 0;1 6;3 2];
C=[6 1 2;2 3 1];
D=[0 0;0 0];
sys=ss(A,B,C,D);
x0=[1; 1 ;1];
t=0:0.01:10;
u=sin(2*t).*(t>=0);
w=2;
plot(t,(((C*inv(j*w*eye(3)-A)*B+D)*exp(j*w*t)-(C*inv(-j*w*eye(3)-A)*B+D)*exp(-j*w*t)))/(2*j))
  1 件のコメント
Walter Roberson
Walter Roberson 2020 年 4 月 16 日
(C*inv(j*w*eye(3)-A)*B+D) is 2x2. j*w*t is 1x1001 I think. You cannot * the two parts together. j*w*t would need to be 2 x something.

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by