Increase accuracy of fsolve
10 views (last 30 days)
Show older comments
I am trying to increase the accuracy of the solution obtained from fsolve by changing the options of fsolve as follows:
options = optimset('Display','iter');
options.MaxIter = 5000 ;
options.MaxFunEvals = 5000000 ;
options.FunctionTolerance = 1e-16;
options.OptimalityTolerance = 1e-16;
options.StepTolerance = 1e-16;
solution = fsolve(@ComputeFunction,solution,options);
However, nothing seems to change even after including the three lines on changing the tolerance. The total number of iterations performed remains the same. Information on the last two iterations is included below for your reference.
Norm of First-order
Iteration Func-count f(x) step optimality
2132 855333 3.66897e-09 0.000570497 0.544
2133 855734 3.66897e-09 8.73214e-15 0.145
Any idea on how I can actually raise the accuracy especially by lowering the value of f(x) even more? Thanks!
1 Comment
Walter Roberson
on 24 Jan 2018
My reading of that is that the last step was by just slightly more than 1E-16 and that the next step would have been less than 1E-16
The documentation recommends against using a tolerance that low https://www.mathworks.com/help/optim/ug/tolerances-and-stopping-criteria.html says using a step tolerance less than eps can lead to inaccuracies; eps is about 2E-16, twice as large as what you are asking for.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!