Undefined function or method 'fsolve' for input arguments of type 'function_handle'

I am trying to solve two equations with two unknowns (x(1),x(2)). The problem is when I try a generic type of solver, I get the following error:
??? Undefined function or method 'fsolve' for input arguments of type 'function_handle'.
Error in ==> solution at 3
[x,fval] = fsolve(@myfun,x0,options)
First, I write a file that computes F, the values of the equations at x.
function F = myfun(x)
F = [quad('mexicanh', 0, x(2)-x(1), 1.0e-06)-quad('mexicanh', 0, x(2)+x(1), 1.0e-06)+quad('mexicanh', 0, 2*x(2), 1.0e-06;
quad('mexicanh', 0, 2*x(2), 1.0e-06)+quad('mexicanh', 0, 2*x(1), 1.0e-06)-2*quad('mexicanh', 0, x(2)+x(1), 1.0e-06)];
and mexicanh is a function
function y=mexicanh(z)
y=exp(-abs(z)).*(sin(abs(z))+cos(z));
then I save this function file as myfun.m and write
x0 = [-5; -5];
options=optimset('Display','iter');
[x,fval] = fsolve(@myfun,x0,options)
Thanks in advance

 채택된 답변

Walter Roberson
Walter Roberson 2011년 11월 29일
fsolve() is part of the Global Optimization Toolbox, and is not available unless you have that optional toolbox installed and licensed.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

태그

질문:

2011년 11월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by