Problem using FSOLVE 'OptimalityTolerance' is not an option

18 次查看(过去 30 天)
Hi
I'm trying to do Nonlinear regression with Levenberg Marquardt, but I have this problem.
Error using optimoptions (line 105)
'OptimalityTolerance' is not an option for FSOLVE.
A list of options can be found on the FSOLVE documentation page.
Error in Transfer_function_corrected (line 116)
options =
optimoptions(@fsolve,'TolFun',1e-54,'Algorithm','levenberg-marquardt','MaxIter',1e16,'Display','off','TolFun',1e-12,'OptimalityTolerance',1e-12);
My code..
[l,a]=size(H);
for y=1:a
for z=1:l
myfun = @(x) [((H(z,y)-(D(y)*exp(-1i*x(1)*(r(y+1)-r(1))))))^2];
options = optimoptions(@fsolve,'TolFun',1e-54,'Algorithm','levenberg-marquardt','MaxIter',1e16,'Display','off','TolFun',1e-12,'OptimalityTolerance',1e-12);
[K(z,y),fval(z,y)] = fsolve(myfun, [0],options);
c=c+1;
waitbar(c/n)
end
end
Thank you so much.

采纳的回答

Alan Weiss
Alan Weiss 2020-11-2
I am surprised that you got that error, but here is what the fsolve documentation has to say about that option:
Internally, the 'levenberg-marquardt' algorithm uses an optimality tolerance (stopping criterion) of 1e-4 times FunctionTolerance and does not use OptimalityTolerance.
I would also like to point out that many of your chosen options and tolerances do not make sense. To quote from that link: Generally set tolerances such as OptimalityTolerance and StepTolerance to be well above eps, and usually above 1e-14. Setting small tolerances does not always result in accurate results. Instead, a solver can fail to recognize when it has converged, and can continue futile iterations. A tolerance value smaller than eps effectively disables that stopping condition.
Alan Weiss
MATLAB mathematical toolbox documentation

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

产品


版本

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by