Solve system of equations give wrong solution

5 ビュー (過去 30 日間)
Abdullah Azzam
Abdullah Azzam 2019 年 5 月 31 日
回答済み: Jesús Zambrano 2019 年 8 月 5 日
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

採用された回答

Jesús Zambrano
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 件)

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by