Reputation: 51
Implementing this MATLAB function
function y=myfunc(x)
y=x^2+5*x+6;
end
is resulting in the following error.
>>myfunc(5)
Undefined function 'myfunc' for input arguments of type 'double'
I'm new to MATLAB, and any help would be appreciated!
Upvotes: 1
Views: 5624
Reputation: 1
You can get results by two methods in matlab
answer= myfunc(5) function y=myfunc(x) y=(x^2)+(5*x)+6; end
so make a file name as myfunc and write you function code there
function y=myfunc(x)
y=(x^2)+(5*x)+6; end
answer= myfunc(5)
Upvotes: 0