Can anyone explain why I'm getting this error?

1 回表示 (過去 30 日間)
Luis
Luis 2022 年 10 月 20 日
コメント済み: VBBV 2022 年 10 月 20 日
I am trying to code for a 2 variable function u(y,t).
My variables are as follows:
omega=3pi/2, gamma=1, uo=5, alpha= (-sqrt(omega./2*gamma)) beta= omega*t
I keep getting "error using _* _ " on my funtion of
u(y,t)=uo*exp(alpha*y)*sin(beta+alpha*y).
I'm very new to Matlab, so I'm not sure what I'm coding incorrectly. Any advice is greatly appreciated!
Here is the error code in its entirety:
"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 operate on each element of the matrix
individually, use TIMES (.*) for elementwise
multiplication."

回答 (1 件)

VBBV
VBBV 2022 年 10 月 20 日
omega=3*pi/2
There is missing multiplication operator
  2 件のコメント
VBBV
VBBV 2022 年 10 月 20 日
u(y,t)=uo*exp(alpha*y).*sin(beta+alpha*y)
VBBV
VBBV 2022 年 10 月 20 日
Use element wise .* multiplication if y is a vector

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by