ERROR: Incorrect dimensions for matrix multiplication

10 visualizaciones (últimos 30 días)
Stancu Andreea
Stancu Andreea el 16 de Abr. de 2020
Comentada: Walter Roberson el 16 de Abr. de 2020
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 comentario
Walter Roberson
Walter Roberson el 16 de Abr. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by