The "fslove function" got different answer on two computers

2 ビュー (過去 30 日間)
Jonathan Chen
Jonathan Chen 2019 年 2 月 20 日
編集済み: Matt J 2019 年 2 月 20 日
I recently use the "fslove function" to solve the non-linear equations,
Indeed, the function solved it successfully, however, when I used my file running on my mentor's computer,
We suprisely found that the results (solution) are different (almost every variable),
The gap between answers is quite small,
For example, one variable solved on my computer is
0.201819444801955
And on my mentor's
0.203068462986796
There is only 0.6% deviation, but still, that is different,
Becasue the file is completely identical, including the initial guess value and code, nothing makes any change,
Since that, it makes me to wonder that the computer difference or the version of MATLAB (my mentor's ver2016b) might be the reason to cause that kinds of issue?
If that so, is there any adjustment can be done to fix this difference,
Or might be simply something I wasn't aware of about the fsolve funtion?
Right now I am not sure about it, thus I come to here to leave a question.
Many thanks for your reading, if you need any information for my side, please leave a message below, I will reply it ASAP,
Thanks again!
Jonathan

採用された回答

Matt J
Matt J 2019 年 2 月 20 日
編集済み: Matt J 2019 年 2 月 20 日
Have you checked whether both results are valid solutions to the equations? If a continuum of solutions exists, it is quite conceivable (and largely inevitable) for two different computers or Matlab versions to reach different solutions. What was the final fval and exitflag in each case.
  2 件のコメント
Jonathan Chen
Jonathan Chen 2019 年 2 月 20 日
Hi Matt,
Thanks for your fast reply and answer,
After checking with my code,
The exitflag is 1 for sure,
and the fval as follows (there are 7 initial guesses),
-1.1123e-13 0 4.1633e-17 5.7397e-13 -5.1229e-12 0 1.3878e-17
and it seems like reasonable for both exitflag and fval running on my computer.
As for my mentor's part, I can only tell the exitflag is certainly 1 ,
But I am not sure about his fval matrix for now, I will update it once I get the result, thanks!
So, in your point of view,
That is possible to casue this various outcome due to computer/version difference,
humm, that is interesting, but it also makes the result not much robust by this variation.
Jonathan
Matt J
Matt J 2019 年 2 月 20 日
編集済み: Matt J 2019 年 2 月 20 日
humm, that is interesting, but it also makes the result not much robust by this variation.
Correct, but if the problem has a continuum of solutions, then it is the problem itself that is to blame for the non-robustness, not the software or computer that tries to solve it.

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

その他の回答 (0 件)

製品


リリース

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by