Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started