I'm just trying to make a function file with the function f(x)=e^cosx -x^3+2x^2+5x-3
1 次查看(过去 30 天)
显示 更早的评论
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
2024-9-11
function y = myFunc(x)
y = exp(cos(x)) - x^3 + 2*x^2 + 5*x -3;
end
1 个评论
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 Exchange 中查找有关 Argument Definitions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!