What is "Equation solved,fslove stalled'?

19 visualizaciones (últimos 30 días)
Tsu-Hsin Lin
Tsu-Hsin Lin el 29 de Nov. de 2018
Editada: Timothy Beckham el 22 de Jul. de 2021
function F = root2d2(x)
h = 10^(-10);
F(1)=-0.0045+x(1)*(1+(10^18.7)*x(2)+(10^22.3)*x(2)*h+(10^24.6)*x(2)*(h^2)+(10^31.3)*(x(2)^2)*h+(10^38.4)*(x(2)^2)*(h^2)+(10^42.1)*(x(2)^2)*(h^3)+(10^45.6)*(x(2)^2)*(h^4))+(x(1)^2)*(10^21.1)*x(2);
F(2)=-0.0050+x(2)*(1+(10^18.7)*x(1)+(10^22.3)*x(1)*h+(10^24.6)*x(1)*(h^2)+(10^21.1)*(x(1)^2))+(x(2)^2)*((10^31.3)*(x(1)^2)*h+(10^38.4)*(x(1)^2)*(h^2)+(10^42.1)*(x(1)^2)*(h^3)+(10^45.6)*(x(1)^2)*(h^4));
fun = @root2d2;
x0 = [0,0];
x = fsolve(fun,x0);
I am new in Matlab. Here is my code. and I got the respond
''>> sol2
Equation solved, fsolve stalled.
fsolve stopped because the relative size of the current step is less than the
default value of the step size tolerance squared and the vector of function values
is near zero as measured by the default value of the function tolerance.
<stopping criteria details>"
could any one explain what it is and how to fix it?

Respuestas (2)

Alex Sha
Alex Sha el 9 de En. de 2020
There are two solutions:
1:
x1: -0.000499999999999997
x2: -2.28184863820141E-18
2:
x1: -2.52247055758755E-18
x2: -0.000429468203349305

Walter Roberson
Walter Roberson el 9 de En. de 2020
That message indicates that fsolve succeeded in getting at least as close to 0 as the default options ask for.
The solutions are not necessary the closest representable numbers to the abstract perfect roots: the default options say that when you get down to a small enough step size that you can give up.
The function tried some additional points after finding that particular one, to see if the answer could be improved, but those additional points did not come out better and after a few tries in the area that had been configured by default as good enough, it said "ok, this is good enough!"
You could potentially get a marginally better solution by passing in options that told it to try harder, but I can see that you have a lot of round off in your coefficients, so it does not make physical sense to push for the last decimal place.
Anyhow, the program gave you the best solution to with the margin of error you asked for, and then told you that, so that you know that it succeeded. This is the most common "I did what you asked me and it worked" message.
  2 comentarios
WAQAR HUSSAIN AFRIDI
WAQAR HUSSAIN AFRIDI el 19 de En. de 2021
Good explaination!
Timothy Beckham
Timothy Beckham el 22 de Jul. de 2021
Editada: Timothy Beckham el 22 de Jul. de 2021
Agree with you! It's definitely good!

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by