Error using * in a simple matlab program

조회 수: 9 (최근 30일)
Libby Goodes
Libby Goodes 2018년 1월 18일
댓글: Maxim Gaida 2020년 9월 25일
>> 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
Maxim Gaida
Maxim Gaida 2020년 9월 25일
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 2020년 9월 25일
need help

댓글을 달려면 로그인하십시오.

채택된 답변

Birdman
Birdman 2018년 1월 18일
편집: Birdman 2018년 1월 18일
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
Libby Goodes
Libby Goodes 2018년 1월 18일
thank you! its worked now!
Thenesshvaran  Gobalakrishnan
Thenesshvaran Gobalakrishnan 2018년 8월 15일
Can u show is the example of this equation because I'm having the same error.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by