Question: I have a MATLAB assignment - - have to write a script to find final pressure using the ideal gas law and the van der

I have a MATLAB assignment--have to write a script to find final pressure using the ideal gas law and the van der waals equation of state. I have converted the volume from 1 liter to .001 m^3 and converted 5.536 from bar to 0.5536 kPa. I'm getting a correct result for the ideal gas law but not for van der waals. Correct pressures are 9528.37 kPa for IGL and 7932.743 kPa for van der Waals. Percent difference should be 20.11%. I have cut and pasted my script here.
T=573; % Temperature, T [K]
V=.001; % Volume, V [m^3]
n=2; % moles, n [mol]
a=0.5536; % intermolecular force, a [m^6 Pa mol^-2]
b=3.049e-5; % volume of molecules, b [m^3 mol^-1]
R=8.314; % gas constant, R [kPa m^3 kmol^-1 K^-1]
R=0.08314; % gas constant [L bar mol^-1 k^-1
P_IGL=((n*R*T)/V); % IGL ideal gas law, calculation for pressure, [kPa]
P_vdW=((n*R*T)/(V-(n*b)))-((a*n^2)/V^2); % van der Waals, calculation for pressure, [kPa]
Pdiff=abs((P_vdW-P_IGL)/P_vdW)*100; % percent difference
% Display the results
disp(['Pressure from Ideal Gas Law (IGL): ',num2str(P_IGL), 'kPa']);
disp(['Pressure from van der Waals (vdW): ',num2str(P_vdW), 'kPa']);
disp(['Percent Difference',num2str(Pdiff*100),'%']);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!