%Determine the volume of the gas using van der Waals equation if the
%cylinder tank is to be filled up with 170 g-mol of CO2 to a pressure of 65
%atm and -70 C.
N = 170;P = 65;T = -70 + 273; %Celsius to Kelvin conversion
Tc = 304.2;Pc = 73.83*0.986923; %bar to atm conversion
R = 0.08205;%Equation of State Parameters
a = (27*R^2*Tc^2)/(64*Pc);b = (R*Tc)/(8*Pc);%van der Waals Equation (fzero)
x = @(V)((P + (N^2*a)/V^2)*(V - N*b) - N*R*T);z = fzero(x,30);%van der Waals equation in terms of a third degree polynomial equation
%(roots)
vdW = (P - (P*N*b + N*R*T) + a*N^2 - a*b*N^3);r = roots(vdW);fprintf('fzero Volume (in L): %8.3f \n', z)fprintf('roots Volume (in L): %8.3f\n', r)
MATLAB: I don’t know what’s wrong with the codes. There’s no answer to the roots volume in the command window. Please help
roots
Best Answer