# Solving an implicit equation in matlab

22 views (last 30 days)
Yogan on 13 Nov 2022
Edited: Bruno Luong on 13 Nov 2022
Dear all,
I need to solve the following equation:
and the equation that coorelates by the following equation( the term 5 was ignored):
and the variables b, A, B, C, k, Tc can be founded in this table:
As the variavle V can not be isolated, we should solve it implicit. I am trying witht he following code:
Tc = 367.85;
Pc = 3374.84;
R = 7.290839*10.^-2;
b = 3.973395*10.^-4;
k = 5.033;
A2 = -0.1398755;
A3 = 4.031561*10^-4;
A4 = -1.508838*10.^-7;
B2 = 1.677524*10.^-4;
B3 = -6.739375*10.^-7;
B4 = 0;
C2 = -1.518125;
C3 = 5.521381*10^-5;
C4 = 0;
Vapor_pressure_ref = 100
syms F P V T
F = -P + ((R*T)/(V-b)) + (((A2) + (B2*T) + (C2*exp(-k*T/Tc)))/(V-b)^2) + (((A3) + (B3*T) + (C3*exp(-k*T/Tc)))/(V-b).^3) + (((A4) + (B4*T) + (C4*exp(-k*T/Tc)))/(V-b).^4);
dV_dT = - diff(F,T)/diff(F,V)
Eq = (V - (dV_dT*T))
int(Eq,P,Vapor_pressure_ref,1)
However,the output is:
-(17211847986098922057056496272843303410021431145154622943954950247403281191336156397430653844910382510721336111875*exp(3956657/1051000) + 171221942040754850037313460159985281792124894590638846549063088630653073472919905693201072792645916265515881332736)/(1065840624671895280778428055080140800000*(64450689896085148577946341147025193190720307559496600271150138269013626089*exp(3956657/1051000) + 236272089264744816453435291457063368284234553216075863541003706881470889984))
How to simplify it?
Bruno Luong on 13 Nov 2022
Edited: Bruno Luong on 13 Nov 2022
"T must be prescribed"
Correct. OP forgets to tell us.

Bruno Luong on 13 Nov 2022
Edited: Bruno Luong on 13 Nov 2022
format long
-(17211847986098922057056496272843303410021431145154622943954950247403281191336156397430653844910382510721336111875*exp(3956657/1051000) + 171221942040754850037313460159985281792124894590638846549063088630653073472919905693201072792645916265515881332736)/(1065840624671895280778428055080140800000*(64450689896085148577946341147025193190720307559496600271150138269013626089*exp(3956657/1051000) + 236272089264744816453435291457063368284234553216075863541003706881470889984))
ans =
-0.284179329144572

Bruno Luong on 13 Nov 2022
Edited: Bruno Luong on 13 Nov 2022
D=1/(V-b) is a root of fifth order polynomial, where the coefficients depend on P, T, etc...
It looks like it is small non-linear correction of the linear equation.
P = RT*D
I assume the equation has single real root in the range you consider, so actually it is not really an implicit equation, it is explicit equation if you write it as root of the polynomial.
It seems int is smart enough to figure this fact out, and able to gie back the expression you look for.

### Categories

Find more on Mathematics and Optimization in Help Center and File Exchange

R2022b

### Community Treasure Hunt

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

Start Hunting!