I keep getting error using sin and Not enough input arguments. I'm not sure what I did wrong here
x = z + (1/s).*sin.*(s*r0*t);

 採用された回答

Dyuman Joshi
Dyuman Joshi 2023 年 9 月 19 日

0 投票

sin is not a variable that you are multiplying with s*r0*t, it is a function which needs input arguements to provide an output.
So, remove the element-wise multiplication sign in between sin and the parenthesis, and it should work (Assuming variables have compatible sizes for the operations performed)
%Corrected
x = z + (1/s).*sin(s*r0*t);

1 件のコメント

Lan
Lan 2023 年 9 月 19 日
Thank you both so much. It worked!

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 9 月 19 日

0 投票

The .* operator is element-by-element multiplication. Your code is asking to evaluate the token sin and multiply the result by (s*r0*t) . But sin as a token is a request to evaluate the sin function with no parameters, which is a problem because sin() needs to be passed one parameter.
If you want to take the sine of something, you need sin(EXPRESSION) such as sin(s*r0*t)

1 件のコメント

Lan
Lan 2023 年 9 月 19 日
Thank you!

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

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

質問済み:

Lan
2023 年 9 月 19 日

コメント済み:

Lan
2023 年 9 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by