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

1 vue (au cours des 30 derniers jours)
Olivia
Olivia le 23 Juil 2024
Commenté : Walter Roberson le 12 Sep 2024
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.

Réponses (1)

Taylor
Taylor le 11 Sep 2024
function y = myFunc(x)
y = exp(cos(x)) - x^3 + 2*x^2 + 5*x -3;
end
  1 commentaire
Walter Roberson
Walter Roberson le 12 Sep 2024
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Argument Definitions dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by