ERROR: Incorrect dimensions for matrix multiplication

조회 수: 9 (최근 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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by