How to enter a function into MATLAB

1 回表示 (過去 30 日間)
Nicholas Deosaran
Nicholas Deosaran 2020 年 9 月 17 日
コメント済み: Walter Roberson 2020 年 9 月 17 日
Hello good day,
I am having issues on how to enter this equation into MATLAB.
I have it as
H/2 * cos(k*x)*cos(sigma*t)
but getting a different answer from my calculator
Thank you

回答 (1 件)

Steven Lord
Steven Lord 2020 年 9 月 17 日
Is your calculator computing the cosine of angles in degrees (which in MATLAB is the cosd function) or in radians (cos)?
  2 件のコメント
Nicholas Deosaran
Nicholas Deosaran 2020 年 9 月 17 日
I did it in radians and degrees and got different answers.
Am I tryping out the code corretly in MATLAB?
I don't know if I need to put the .* in the function.
Walter Roberson
Walter Roberson 2020 年 9 月 17 日
If your inputs are all scalars then you can use either * or .*
If your inputs are not scalars, then you need .*

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

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by