Using MATLAB, given the following information: The ideal gas law: and Van der Wa
ID: 3877376 • Letter: U
Question
Using MATLAB, given the following information:
The ideal gas law:
and Van der Waals modification of the ideal gas law:
Using MATLAB, provide the lines of code to do the following calculations:
a) Use both the ideal gas law and vad der Waals' equation to calculate the temperature of water vapor (steam), given the following data.
b) Leaving the other variables the same as (a), find the value of temperature (T) for 10 values of pressure from 0 bar to 400 bar - use both the ideal gas law and Van der Waals
PV = nRTExplanation / Answer
Answer a)
For P = 220, the temperature using ideal gas law is 1323.0
The temperature using Van der Waal's equation is 1367.4
Answer b) The different values for Pressure , Temperature( from ideal gas law) , Temperature (van der waal's eq)
0.0000e+00 0.0000e+00 1.2504e+02
4.4444e+01 2.6727e+02 3.7602e+02
8.8889e+01 5.3454e+02 6.2699e+02
1.3333e+02 8.0181e+02 8.7797e+02
1.7778e+02 1.0691e+03 1.1289e+03
2.2222e+02 1.3364e+03 1.3799e+03
2.6667e+02 1.6036e+03 1.6309e+03
3.1111e+02 1.8709e+03 1.8819e+03
3.5556e+02 2.1382e+03 2.1328e+03
4.0000e+02 2.4054e+03 2.3838e+03
======================
Matlab code that generates the needed output
=================
P = 220;
n = 2;
V = 1;
a = 5.536;
b = 0.03049;
R = 0.08314472;
format short
%question a)
%calculate temperature for P=220 using ideal gas law and Van der Walls equation
T_Ideal_At_220 = (P * V) / (n * R)
T_Vander_At_220 = (P + (n^2*a/V^2)) * (V - n*b) / (n*R)
%question b)
%calculate temperator for 10 values of pressure from 0 to 400
P = linspace(0, 400, 10);
T_Ideal = (P .* V) ./ (n * R);
T_Vander = (P + (n^2*a./V^2)) * (V - n*b) /(n*R);
%show the values in 3 columns- Pressure, Temperature using Ideal Gas law and Temperature using Van der equation
table = [P' T_Ideal' T_Vander']
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.