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
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 CenterFile Exchange에서 Argument Definitions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by