Error using * in a simple matlab program
10 ビュー (過去 30 日間)
古いコメントを表示
>> 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
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 '.*
採用された回答
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 件のコメント
Thenesshvaran Gobalakrishnan
2018 年 8 月 15 日
Can u show is the example of this equation because I'm having the same error.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!