Symbolic equation system - Hi! Can someone please tell me why this algortim is not working? I know resultant values for XA and T are 0.2 and 657 but i want it to work.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have to mention that ec2 value type is symfalse, i think the code not working has to do with that but i don't know how to solve it.
CPA=14.5;
CPR=12.4;
CPS=7.2;
dHR=5665;
R=1.987;
h=-90820/R;
t=31.6;
syms XA T
ec1=0==CPA*(25-672)+dHR*XA/4+XA*CPR*(T-25)/4+3*XA*CPS*(T-25)/2+(1-XA)*CPA*(T-25);
ec2=t*1.052*10^19==int(1./exp(h./T)./(1-XA),XA,0,XA);
vpasolve(ec1,ec2,XA)
1 Commento
KSSV
il 3 Mag 2023
Your problem comes frm this:
int(1./exp(h./T)./(1-XA),XA,0,XA);
the above integral gives NaN. Check dod you write the function properly. Becuase of this integral your variable ec2 is symfalse.
Risposte (1)
VBBV
il 7 Giu 2023
Modificato: VBBV
il 7 Giu 2023
If you use vpaintegral instead of int and it can be solved using the vpasolve function.. Also, the integral needs to done w.r.t variable T instead of XA.
CPA=14.5;
CPR=12.4;
CPS=7.2;
dHR=5665;
R=1.987;
h=-90820/R;
t=31.6;
syms XA T real
ec1 = CPA*(25-672)+dHR*XA/4+XA*CPR*(T-25)/4+3*XA*CPS*(T-25)/2+(1-XA)*CPA*(T-25) == 0
I = vpaintegral(1./exp(h./(T.*(1-XA))),XA,0,T)
ec2 = I == t*1.052*1e19;
sol = vpasolve([ec1,ec2],[XA,T]);
XA = vpa(sol.XA,3)
T = vpa(sol.T,3)
can you also check whether the input constants provided are correct ?
0 Commenti
Vedere anche
Categorie
Scopri di più su Calculus in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!