Error using _*_. What am I doing wrong?

조회 수: 6 (최근 30일)
Atli Tobiasson
Atli Tobiasson 2021년 2월 19일
댓글: Alan Stevens 2021년 2월 19일
t = linspace(t1,10,200);
x(t) = ((F0*exp((-zeta*omega*t.)))/(k*sqrt(1-zeta^2)))*((exp(zeta*omega*t1)*cos(omega*(t.-t1))-phi)-cos(omega*t.-phi));
First I got this error
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 '.*'.
Then I added '.*' after every 't' and now I get the following error. Where am I getting this wrong?
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check
for mismatched delimiters.
  댓글 수: 2
Stephen23
Stephen23 2021년 2월 19일
If you are not doing linear algebra then you should not be using matrix operations:
Use array operations.
Atli Tobiasson
Atli Tobiasson 2021년 2월 19일
thanks!

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

답변 (1개)

Alan Stevens
Alan Stevens 2021년 2월 19일
You need dots before the * and before the / , not after the t.
  댓글 수: 2
Atli Tobiasson
Atli Tobiasson 2021년 2월 19일
Thank you. I fixed it and also changed x(t) -> x, which gave me an error too
Alan Stevens
Alan Stevens 2021년 2월 19일
You will need to post your full code for anyone to be able to resolve your further error.

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

카테고리

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