What is "Equation solved,fslove stalled'?

조회 수: 8 (최근 30일)
Tsu-Hsin Lin
Tsu-Hsin Lin 2018년 11월 29일
편집: Timothy Beckham 2021년 7월 22일
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?

답변 (2개)

Alex Sha
Alex Sha 2020년 1월 9일
There are two solutions:
1:
x1: -0.000499999999999997
x2: -2.28184863820141E-18
2:
x1: -2.52247055758755E-18
x2: -0.000429468203349305

Walter Roberson
Walter Roberson 2020년 1월 9일
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
WAQAR HUSSAIN AFRIDI
WAQAR HUSSAIN AFRIDI 2021년 1월 19일
Good explaination!
Timothy Beckham
Timothy Beckham 2021년 7월 22일
편집: Timothy Beckham 2021년 7월 22일
Agree with you! It's definitely good!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by