fsolve residue almost zero error, I calculate and find errors

1 回表示 (過去 30 日間)
Lingling Fan
Lingling Fan 2021 年 7 月 31 日
回答済み: Walter Roberson 2021 年 7 月 31 日
Hi,
fsolve gives me zero error.
But I find the function is not zero with the solution.
Where I could check? Thanks!

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 7 月 31 日
I speculate that you have
format short
in effect (because it is the default),
and that you are taking the 4-decimal-place results that are being displayed, and typing them in by hand as inputs to the function, and are finding that the function does not return (nearly) 0 for those inputs.
When you use fsolve, you should assign the first output to a variable, and pass the variable into the function if you want to test, not type in the results by hand. Especially with nonlinear functions, every bit of the coefficients returned by fsolve might be important.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by