I'm just trying to make a function file with the function f(x)=e^cosx -x^3+2x^2+5x-3

1 回表示 (過去 30 日間)
Olivia
Olivia 2024 年 7 月 23 日
コメント済み: Walter Roberson 2024 年 9 月 12 日
function y = e^cosx -x^3+2x^2+5x-3
%I keep getting a parse error at the = that says it might be invalid matlab syntax.

回答 (1 件)

Taylor
Taylor 2024 年 9 月 11 日
function y = myFunc(x)
y = exp(cos(x)) - x^3 + 2*x^2 + 5*x -3;
end
  1 件のコメント
Walter Roberson
Walter Roberson 2024 年 9 月 12 日
Possibly
y = exp(cos(x) - x^3 + 2*x^2 + 5*x - 3);
or possibly
y = exp(cos(x)) - (x^3 + 2*x^2 + 5*x - 3);
or possibly
y = exp(cos(x) - (x^3 + 2*x^2 + 5*x - 3));
.. The notation is somewhat ambiguous.

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

カテゴリ

Help Center および File ExchangeArgument Definitions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by