Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Eror Using * Inner matrix dimensions must agreee HELP

1 回表示 (過去 30 日間)
Isaac Al-rai
Isaac Al-rai 2015 年 2 月 28 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello, here is my inputs
>> t=(0:t:2*pi);
>> y=exp(-0.3*t)*(2*cos(2*t)+4*sin(2*t))
Error using *
Inner matrix dimensions must agree.
the two trig values must be in a parenthesis, i do not understand the error any help would be greatly appreciated.

回答 (1 件)

Star Strider
Star Strider 2015 年 2 月 28 日
Don’t you just hate it when your inner matrix dimensions argue? And over such trivial issues! I remember one time when ... But we can save that for a later time.
You need to vectorise your ‘y’ assignment:
t = pi/10;
t=(0:t:2*pi);
y=exp(-0.3*t).*(2*cos(2*t)+4*sin(2*t))
It produces:
y =
Columns 1 through 6
2.0000e+000 3.6122e+000 3.6625e+000 2.4015e+000 502.8544e-003 -1.2485e+000
Columns 7 through 12
-2.2548e+000 -2.2863e+000 -1.4991e+000 -313.8960e-003 779.3223e-003 1.4075e+000
Columns 13 through 18
1.4271e+000 935.7615e-003 195.9428e-003 -486.4751e-003 -878.6170e-003 -890.8659e-003
Columns 19 through 21
-584.1289e-003 -122.3131e-003 303.6716e-003
I created an initial value for ‘t’ that was necessary for the vector ‘t’. Choose the value you want.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by