Solve system of equations give wrong solution
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi guys and thanks in advance. I am trying to solve a system of nonlinear equations as shown in the code below using vpasolve. However, when I run the code it gives me wrong answers
syms atx btx ctx aGA bGA cGA
eq1=atx+btx;
eq2=atx+btx*exp(-105*ctx);
eq3=atx+btx*exp(-180*ctx);
eq4=aGA+bGA;
eq5=aGA+bGA*exp(-105*cGA);
eq6=aGA+bGA*exp(-180*cGA);
eqns=[eq1==BMDT, eq2==AMDT1, eq3==AMDT2]; % Where BMDT and AMDT1 and AMDT2 are change in every run but for example take them as 204, 192.61 and 177.6 respectiviely.
eqns2=[eq4==BMDA, eq5==AMDA1, eq6==AMDA2]; % Where BMDA and AMDA1 and AMDA2 are change in every run but for example take them as and 2772.4, 2060.1 and 1965.6 respectiviely.
S = vpasolve(eqns, [atx btx ctx]);
S2 = vpasolve(eqns2, [aGA bGA cGA]);
at= S.atx;
bt= S.btx;
ct= S.ctx;
aA= S2.aGA;
bA= S2.bGA;
cA= S2.cGA;
What possible could be wrong knowing that sometimes it gives correct answer while other time I doesn't, and what is a possible soultion for it
댓글 수: 0
채택된 답변
Jesús Zambrano
2019년 8월 5일
Hi Abdullah,
When using vpasolve, try (if possible) to include a good guess of the solution (X0). The X0 is optional, if no value is used, the numerical solver makes its own internal choices.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Quantum Mechanics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!