What is "Equation solved,fslove stalled'?

31 ビュー (過去 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 Center および File ExchangeNumeric Solvers についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by