fsolve, fmincon producing different results
조회 수: 10 (최근 30일)
이전 댓글 표시
Hi,
I am wondering how to think about fsolve and fmincon producing different results when solving the same system of nonlinear equations. To explain, fsolve finds a solution that sets x, y, z simultaneouly to zero when x, y, z are some equations.
To run the same routine in fmincon, I set the objective as [x y z]*[x y z]' to be minimized (tolerance 1e-15). And these two routines produce very different solutions, even when they start from the same initial value.
Is it the way I set the objective in fmincon that is wrong or leads to a different solution? How should I think about this? Thanks for any advice in advance!
Best,
Ara
댓글 수: 0
답변 (2개)
Matt J
2021년 9월 20일
Do they both achieve the same objective value? If so, you simply have multiple solutions.
댓글 수: 0
Sargondjani
2021년 9월 20일
I believe fmincon could also be stuck in a local minimum, due to the quadratic terms. This solution might not actually solve the equations.
And in addition to what Matt says: if you start fmincon from a point close to the solution of fsolve, does it converge to the same point then?
On a side note:
- do you need fminconsince you have no constraint. Maybe fminunc suffices?
- lsqnonlin is a special function to minimize vector valued functions in least square sense. It can also handle bounds, so this might be useful too.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!