error message: Form of equation?

I keep getting an error in the command window. Here is my equation and error message:
x = (1.2)*exp((-1/2)*t)*sin(3*t) + 5*exp((-1/2)*t)*cos(3*t);
Error using *
Inner matrix dimensions must agree.
Error in HW_3 (line 21)
x = (1.2)*exp((-1/2)*t)*sin(3*t) +
5*exp((-1/2)*t)*cos(3*t);
Thanks for any help!

 採用された回答

Roger Stafford
Roger Stafford 2014 年 9 月 2 日

2 投票

If t is an array, then to use matrix multiplication "*" the number of columns in exp((-1/2)*t) needs to be the same as the number of rows in sin(3*t). A similar statement hold for exp((-1/2)*t) and cos(3*t). Probably what you meant was:
x = (1.2)*exp((-1/2)*t).*sin(3*t) + 5*exp((-1/2)*t).*cos(3*t);

1 件のコメント

Joseph
Joseph 2014 年 9 月 2 日
That was it! Thank You!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

質問済み:

2014 年 9 月 2 日

コメント済み:

2014 年 9 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by