I write a file that computes F, the values of the equations at x.
function F = myfun(x)
F = [2*x(1) - x(2) - exp(-x(1));
-x(1) + 2*x(2) - exp(-x(2))];
Save this function file as myfun.m somewhere on your MATLAB path. Next, set up the initial point and options and call fsolve:
x0 = [-5; -5];
options=optimset('Display','iter');
[x,fval] = fsolve(@myfun,x0,options)
Then I get a mistake
??? Attempt to execute SCRIPT fsolve as a function:
\fsolve.m
Error in ==> fsolve at 3
[x,fval] = fsolve(@myfun,x0,options)
What is wrong?
Thanks in advance.

 採用された回答

Sean de Wolski
Sean de Wolski 2012 年 1 月 16 日

0 投票

which fsolve -all
will show which fsolve you're calling and the real one. More than likely you wrote a script called 'fsolve' and saved it on your path. Rename this script and life should be good.

3 件のコメント

Elena
Elena 2012 年 1 月 17 日
I renamed it.. it doesn't work
I still get a mistake
??? Undefined function or method 'fsolve' for input arguments of type 'function_handle'.
Sean de Wolski
Sean de Wolski 2012 年 1 月 17 日
If you type:
ver
at the command line, does the Optimization Toolbox show up?
Walter Roberson
Walter Roberson 2012 年 1 月 17 日
GADS, not Optimization
http://www.mathworks.com/matlabcentral/answers/22578-undefined-function-or-method-fsolve-for-input-arguments-of-type-function_handle

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSystems of Nonlinear Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by