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!