different answers with different methods

조회 수: 1 (최근 30일)
Gisela
Gisela 2016년 4월 18일
편집: Torsten 2016년 4월 18일
Hi
I have a doubt regarding non linear systems. I'm trying to solve my system using the typical fsolve function and giving matlab an initial possible solution x0. A friend of mine decided of using the command syms x1 x2 in order to simulate the initial value of x and then to use vpa to obtain the real value of the roots. In both cases matlab gives an answer but the value of the roots are quite different depending on the method use.
Given the problem we have it seems that the answers given by the sym/vpa method make more sense, yet considering I have roots to an equation I would assume in both ways I'd get the same values. Can anyone explain the difference between the methods and why I obtain different answers in each case?
Thank you
  댓글 수: 1
Torsten
Torsten 2016년 4월 18일
편집: Torsten 2016년 4월 18일
Insert x1 and x2 into the equations and you'll see what solution is the correct one.
fsolve does not operate on symbolic variables, and I don't see any advantage of introducing them.
To see what goes wrong in one of your two versions, we'll have to see your MATLAB code.
Best wishes
Torsten,

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numbers and Precision에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by