What can be done if fsolve cannot find solution?

6 次查看(过去 30 天)
Hello
I have a large piece of code where I have a loop. In each iteration of the loop I use fsolve to find the solution of relatively large nonlinear system. At some points, fsolve returns
No solution found.
fsolve stopped because the relative size of the current step is less than the
value of the step size tolerance squared, but the vector of function values
is not near zero as measured by the value of the function tolerance.
I have a conditon that uses the exitflag to stop if a solution is not found. However, I don't know what can be done to maybe try resolve the system. I tried changing the initial guess and the alogorithm but no luck. Is there anything that could be done in this case?

采纳的回答

Walter Roberson
Walter Roberson 2022-7-20
  • sometimes there just are no real-valued solutions
  • sometimes you need to narrow down the search range by using tighter upper and lower bounds
  • sometimes it can help a lot to use the solution from the previous iteration as the initial value for the current iteration
  • if it is low enough dimension, graph to see if there are plausible solutions
  • sometimes switching to symbolic toolbox helps, especially if there are fairly large or fairly small intermediate values. But note that when you use vpasolve() if the next iteration would be projected to be outside the bounds, then vpasolve() might just give up instead of adjusting the guess to be within the bounds
  • sometimes adjusting the tolerence can help

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by