Solve system of equations give wrong solution

6 visualizaciones (últimos 30 días)
Abdullah Azzam
Abdullah Azzam el 31 de Mayo de 2019
Respondida: Jesús Zambrano el 5 de Ag. de 2019
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

Respuesta aceptada

Jesús Zambrano
Jesús Zambrano el 5 de Ag. de 2019
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.

Más respuestas (0)

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by