increasing fsolve accuracy when fval values are different in terms of order of magnitude

조회 수: 2 (최근 30일)
I have a set of six equations-six unknowns. When I solve it by fsolve, it "stops prematurely" and gives me 6 values for unknowns that are not exactly the answers that I'm expecting (I've tried different initial guesses, but it's the same). Answer set that fval gives is:
[x1=6.242, x2=2.148, x3=2.688, x4=1.563, x5=-3.359, x6=0.996]
and values of "fval" after solving are:
[-9e-9, 1e-10, -2e-6, 0.0054, -0.1208, -0.1615 ]
(The last 3 fvals are comparatively larger). Please let me know what I can do to enhance the results accuracy? Thanks

답변 (1개)

John D'Errico
John D'Errico 2015년 6월 25일
편집: John D'Errico 2015년 6월 25일
The simple answer is the one you need to use.
SCALE YOUR VARIABLES. Scale them so they are all roughly the same order of magnitude. A factor of 10 is irrelevant. A dynamic range of 1e10 is a problem.
Then after the solve is done, scale them back.
  댓글 수: 6
Sayed
Sayed 2015년 6월 29일
Dear Walter,
Thanks for commenting.
When we use fsolve, it returns two different things:
1- an answer set: that depending to your equations have different components and of course could be very different in their order of magnitude as well.
2- fval values that is the values of your equations function calculated with the final answer that Matlab has found (F==0). So, fval can't basically have very different values and all its components should be very close to zero; while in my case only the first 3 component are close to zero, but the rest are not [-9e-9, 1e-10, -2e-6, 0.0054, -0.1208, -0.1615 ]
This is fsolve message when stops:
Solver stopped prematurely.
fsolve stopped because it exceeded the function evaluation limit, options.MaxFunEvals = 9000 (the selected value).

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

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by