MATLAB: Finding the roots of a cubic equation

differential equationsSymbolic Math Toolbox

I need to find the roots of the equation in the attached photo. (bottom boxed equation. solving for 'V')
%
syms v
syms T
Tc=96.15+273 %K
Pc=4990; %KPa
R=(8.314/86.47)
Ta=1400
a=(0.42748*R*R*Tc^2.5)/(Pc)
b=(0.08664*R*Tc)/(Pc)
P=inline('((0.0961*T)/(v-6.1626e-04))- (2.0735/((T^0.5*v*(v+6.1626e-04))))','T','v')
f1=diff(P(T,v),T)
g1=vpa(subs(f1,T,Ta))
f2=diff(P(T,v),v)
g2=vpa(subs(f2,T,Ta))
v=(g1/g2)*Ta
x=solve(v)
end
I am supposed to have 3 roots but I only end up with 2 roots. Not able to figure out where the fault in my code is.

Best Answer

syms v
syms T
Tc=96.15+273 %K
Pc=4990; %KPa
R=(8.314/86.47)
Ta=1400
a=(0.42748*R*R*Tc^2.5)/(Pc)
b=(0.08664*R*Tc)/(Pc)
P=inline('((0.0961*T)/(v-6.1626e-04))- (2.0735/((T^0.5*v*(v+6.1626e-04))))','T','v')
f1=diff(P(T,v),T)
g1=vpa(subs(f1,T,Ta))
f2=diff(P(T,v),v)
g2=vpa(subs(f2,T,Ta))
v=(g1/g2)*Ta
x=vpasolve(v)