Solve system of equations give wrong solution
5 ビュー (過去 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 で Assumptions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!