ERROR: Incorrect dimensions for matrix multiplication

9 vues (au cours des 30 derniers jours)
Stancu Andreea
Stancu Andreea le 16 Avr 2020
Commenté : Walter Roberson le 16 Avr 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 commentaire
Walter Roberson
Walter Roberson le 16 Avr 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by