ERROR: Incorrect dimensions for matrix multiplication
10 views (last 30 days)
Show older comments
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 Comment
Walter Roberson
on 16 Apr 2020
(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.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!