fsolve No Solution found (but there is one)

9 visualizaciones (últimos 30 días)
Federico Maglione
Federico Maglione el 31 de Ag. de 2017
Editada: Matt J el 1 de Sept. de 2017
Hello everyone,
I have checked in other posts having the same problem but, given the specificity of those, the proposed solutions do not apply to my case. However, I believe my situation is even simpler. I just need a little guidance.
Basically I am using fsolve for solving one non-linear equation F(x)=0. I am sure the solution exists as when I plot the function I can see the point.
However I receive this message
fsolve stopped because the problem appears regular as measured by the gradient, but the vector of function values is not near zero as measured by the default value of the function tolerance.
I suppose it is happening as, despite the look of the graph given the plot range, the solution is in a region where the function is almost flat (between 2.5*10^9 and 3.5*10^9).
I tried to change the starting point, increase the TolFun/TolX but it still produces the same error.
What should I do? Increase TolFun and decrease TolX maybe?
Thank you
  2 comentarios
José-Luis
José-Luis el 31 de Ag. de 2017
Could you post your code?
dpb
dpb el 31 de Ag. de 2017
Specifically at least the function. You might try standardizing the variables to increase dynamic range somewhat but looks like fsolve should have no problem unless there's something funky going on in the neighborhood of the solution that is hidden by the scaling.
Try blowing up the plot in the ROI and see if the smoothness apparent here is really not so smooth...

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 31 de Ag. de 2017
Editada: Matt J el 31 de Ag. de 2017
For starters, fsolve is overkill for a one-variable monotonic function. You could just as well use fzero.
Second, you could adjust TolX or TolFun, but I would instead rescale the function so that the factors of 10^9 both in input and output space go away.
F_new(x)=F_old(x*10^9)/10^9;
  9 comentarios
Federico Maglione
Federico Maglione el 31 de Ag. de 2017
Thank you very much!
dpb
dpb el 1 de Sept. de 2017
The roughness comes from the iterative nature of the solution in prior steps. I've not tried, but I'd guess a better solution in the previous would lead to smoother results later on although that's not guaranteed--it might be a pathological case that the discontinuities become more and more pronounced instead.
The indication of an error in erfc is evidence of how sensitive the internals are.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by