Info

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

Issue with vectors?

1 回表示 (過去 30 日間)
Joshua Crook
Joshua Crook 2019 年 11 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
How do I get this to work:
x = 0:.05:1;
y = exp(-2*x)*sin(x*10*pi);
It throws an error, but all I want it to do is give me an equivalent y matrix for my x matrix input. please help.

回答 (1 件)

the cyclist
the cyclist 2019 年 11 月 1 日
編集済み: the cyclist 2019 年 11 月 1 日
Sorry to be snarky, but did you trying reading the error message? It tells you what to do right there.
x = 0:.05:1;
y = exp(-2*x).*sin(x*10*pi);
Note where I used .* instead of just *. (It's not necessary to do that for every instance of *, because in the other places you are simply multiplying by a scalar.)
You might want to take a look at the documentation on Array vs. Matrix Operations for more info.

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by