MATLAB Answers

Way to overcome tolerance limit restriction, without change in initial value in fsolve function OR any other way out.

2 views (last 30 days)
Agrim Singh
Agrim Singh on 14 Jun 2021
Answered: Alan Weiss on 14 Jun 2021
Inside a xyz fsolve function, I used a good initial point that needed to be used but now I am struck here getting this
fsolve completed because the vector of function values at the initial point
is near zero as measured by the value of the function tolerance, and
the problem appears regular as measured by the gradient.
<stopping criteria details>
Equation solved. The final point is the initial point.
The sum of squared function values, r = 1.067653e-22, is less than sqrt(options.FunctionTolerance) = 1.000000e-03.
The relative norm of the gradient of r, 1.038534e-11, is less than options.OptimalityTolerance = 1.000000e-06.
Now, the query is that I want the fsolve function to solve all steps irrespective of how little the value we get and not stop the function and give a constant output. So, what change in that function shoul be implemented keeping the above code output lines in mind.

Answers (1)

Alan Weiss
Alan Weiss on 14 Jun 2021
I'm not sure what you are trying to do, because apparently the initial point is a solution. But if you want fsolve to take a futile step anyway, you can set the following options:
options = optimoptions('fsolve','MaxIterations',3,... % Or whatever you want
x = fsolve(fun,x0,options)
Alan Weiss
MATLAB mathematical toolbox documentation

Community Treasure Hunt

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

Start Hunting!

Translated by