Error using * in a simple matlab program

16 vues (au cours des 30 derniers jours)
Libby Goodes
Libby Goodes le 18 Jan 2018
Commenté : Maxim Gaida le 25 Sep 2020
>> format short e
C=1;
O=0;
y=3;
m=1;
w=50;
t=0:1:10;
f=C.*exp(-(y.*t)/(2.*m))*cos(w.*t+O);
disp([t,f])
Error using *
Inner matrix dimensions must agree.
  2 commentaires
Maxim Gaida
Maxim Gaida le 25 Sep 2020
y=log(abs(x))*(x*cos(x)+log(abs(x)))
Error using *
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 '.*
Maxim Gaida
Maxim Gaida le 25 Sep 2020
need help

Connectez-vous pour commenter.

Réponse acceptée

Birdman
Birdman le 18 Jan 2018
Modifié(e) : Birdman le 18 Jan 2018
C=1;
O=0;
y=3;
m=1;
w=50;
t=0:1:10;
f=C.*exp(-(y.*t)./(2.*m)).*cos(w.*t+O);
Be careful that you should be doing element-wise multiplication while multipyling the exp term with cos term.
  2 commentaires
Libby Goodes
Libby Goodes le 18 Jan 2018
thank you! its worked now!
Thenesshvaran  Gobalakrishnan
Thenesshvaran Gobalakrishnan le 15 Août 2018
Can u show is the example of this equation because I'm having the same error.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices 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