fsolve no solution found results

8 ビュー (過去 30 日間)
Fernando
Fernando 2023 年 7 月 18 日
コメント済み: Fernando 2023 年 7 月 18 日
Hello,
I wanted to ask what does fsolve do after no solution has been found and it stops interating? Is the output the last iteration or does it output the initial conditions?
Also, is there a way when no solution has been found to tell it to output nothing, or for example an array of zeros?
Kind regards.

採用された回答

Matt J
Matt J 2023 年 7 月 18 日
編集済み: Matt J 2023 年 7 月 18 日
Is the output the last iteration or does it output the initial conditions?
It is the last iteration, as you can easily test, .e.g.,
fsolve( @(x) x^2+1,10 )
No solution found. 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 value of the function tolerance.
ans = 5.5834e-09
Essentially, if no solution exists, fsolve can be thought of as a least squares solver.
Also, is there a way when no solution has been found to tell it to output nothing
No, but there is no reason why your code can't do its own post-assessment of the result after fsolve completes.
  1 件のコメント
Fernando
Fernando 2023 年 7 月 18 日
Ok I see thank you!!

サインインしてコメントする。

その他の回答 (1 件)

Chunru
Chunru 2023 年 7 月 18 日
doc fsolve for more details.
[x, fval, exitflag, output] = fsolve() % check out exitflag and output

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by