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)
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)
Error using mupadengine/feval_internal
Arithmetical expression expected.

Error in sym/vpasolve (line 172)
sol = eng.feval_internal('symobj::vpasolve',eqns,vars,X0);
  1 Commento
KSSV
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.

Accedi per commentare.

Risposte (1)

VBBV
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
ec1 = 
I = vpaintegral(1./exp(h./(T.*(1-XA))),XA,0,T)
I = 
ec2 = I == t*1.052*1e19;
sol = vpasolve([ec1,ec2],[XA,T]);
XA = vpa(sol.XA,3)
XA = 
24.2
T = vpa(sol.T,3)
T = 
3.32e+20
can you also check whether the input constants provided are correct ?

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by