Undefined function or method 'fsolve' for input arguments of type 'function_handle'
3 views (last 30 days)
Show older comments
I'm using a script that needs to solve a nonlinear function, and when executing the function, I get an error stating it is Undefined.
I have looked into an example use of this function in the Matlab documentation here:
I follow the specific steps shown in the example. I create a file called root2d.m, that contains this:
% Copyright 2015 The MathWorks, Inc.
function F = root2d(x)
F(1) = exp(-exp(-x(1)+x(2))) - x(2)*(1+x(1)^2);
F(2) = x(1)*cos(x(2)) + x(2)*sin(x(1)) - 0.5;
then execute the following in the command window:
>> fun = @root2d; >> x0 = [0,0]; >> x = fsolve(fun,x0)
and get the following result:
??? Undefined function or method 'fsolve' for input arguments of type 'function_handle'.
I see fsolve was included as a native function prior to R2006. Any idea what is wrong? Thanks in advance!
Walt
0 Comments
Answers (1)
Steven Lord
on 7 Jan 2016
FSOLVE is part of Optimization Toolbox. Based on that error I suspect you do not have this product installed; you can check this by looking at the output of the VER function.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!