Error using optimoptions (Reference to non-existent field 'TolFunValue')

9 ビュー (過去 30 日間)
Omar Khalifa
Omar Khalifa 2020 年 12 月 6 日
コメント済み: Omar Khalifa 2020 年 12 月 7 日
I have a function that I am trying to solve using fsolve and optimoptions. The code is as follows:
fun = @meow;
x0 = [0,0];
options = optimoptions('fsolve','Algorithm','levenberg-marquardt',...
'Display','iter','TolFun',1e-20,'TolX',1e-20,'MaxFunctionEvaluations', 12000,'MaxIterations',600);
[x,fval,exitflag,output] = fsolve(fun,x0,options)
and the function @meow is as follows (named "meow" obviously)
function catsound = meow(x)
catsound(1) = 2*x(1)-x(2);
catsound(2) = x(1)-0.5;
When running the code as is, it produced an error that says the following:
"Error using optimoptions (line 124)
Reference to non-existent field 'TolFunValue'.
Error in solve4cat (line 3)
options = optimoptions('fsolve','Algorithm','levenberg-marquardt',..."
If I remove the optimoptions, it solves it perfectly. The real code is more complicated than this for sure. When I remove the optimoptions of my real code, the answer that I get is just below the guess that I am providing for the function, which is weird. Can anyone help in this? Thank you in advance.

採用された回答

Stephan
Stephan 2020 年 12 月 6 日
For optimoptoptions the correct option is FunctionTolerance. The usage of TolFunValue is the equivalent option when you use optimset instead. See here for more details.
  2 件のコメント
Mario Malic
Mario Malic 2020 年 12 月 6 日
+1
Omar Khalifa
Omar Khalifa 2020 年 12 月 7 日
Thanks! It works perfectly!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by