Minor mistake Writing a function but error

Hello just a quick question, I am writing a code but an error keeps poping up for the function I entered
By any chance would you know why it keeps coming up as a red warning
f=@ (1./x)+(sqrt(x).*exp(x));

답변 (1개)

ag
ag 2025년 4월 13일

0 개 추천

Hi Jhonie,
The issue with the anonymous function you mentioned is that it input argument field. In your case, the input argument "x" needs to be included.
The below code snippet demonstrates the corrected version of your code:
f=@ (x) (1./x)+(sqrt(x).*exp(x));
For more details, please refer to the following MathWorks documentation: Anonymous Functions - https://www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html
Hope this helps!

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

질문:

2020년 11월 25일

답변:

ag
2025년 4월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by