Problem with solving equation with 'FSOLVE'
Show older comments
Hello,
I am solving a system of equations with FSOLVE. I generated starting points with
x0 = rand(2,1);
However, for some x0s, there's an error message saying
Error using trustnleqn (line 28)
Objective function is returning undefined values at initial point. FSOLVE cannot continue.
It seems that for some starting points, the fsolve cannot find solutions.
However, I want FSOLVE to immediately retry with a new random starting point rather than stopping and showing an error message. How can I do that?
Accepted Answer
More Answers (1)
Jakub Rysanek
on 4 Oct 2016
To me it appears that the initial conditions to your optimization problem must lie within a specific, perhaps bounded, region. For example, you cannot ask what is the zero point of
log(x)
and start with the initial guess at x=-1, because log(.) function is defined in the positive domain only.
fsolve(), just like many other optimization routines must always start within the feasible region.
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!