I have the code below which solves for the roots of the polynomial (its a 3rd degree polynomial, specified in the 'inline' function).
However, I'm getting 8 roots instead of 3 and I am not sure where I am making the mistake.
Can someone please correct/point out the fault in my code?
I believe the error is in the last 2 lines of the code v=v=(g1/g2)*Ta; x=vpasolve(v);.
clc clear allclose all syms vsyms TTc=96.15+273 %K
Pc=4990; %KPa
R=(8.314/86.47)Ta=1400a=(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)*Tax=vpasolve(v)
myoutput comes out to be
x =
-0.040991209604397432084120108739213 -0.00061855000000000004596600877704304 -0.00061855000000000004596600877704304 0 0 0.0006001598864238780912163945225872 0.00061855000000000004596600877704304 0.00061855000000000004596600877704304
I should only have 3 roots.
Best Answer