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 assignmenthave 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 liter to m and converted from bar to kPa. Im getting a correct result for the ideal gas law but not for van der waals. Correct pressures are kPa for IGL and kPa for van der Waals. Percent difference should be I have cut and pasted my script here.
T; Temperature, T K
V; Volume, V m
n; moles, n mol
a; intermolecular force, a m Pa mol
be; volume of molecules, b m mol
R; gas constant, R kPa m kmol K
R; gas constant L bar mol k
PIGLnRTV; IGL ideal gas law, calculation for pressure, kPa
PvdWnRTVnbanV; van der Waals, calculation for pressure, kPa
PdiffabsPvdWPIGLPvdW; percent difference
Display the results
dispPressure from Ideal Gas Law IGL: numstrPIGL 'kPa';
dispPressure from van der Waals vdW: numstrPvdW 'kPa';
dispPercent Difference',numstrPdiff;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
