The van der Waals equation gives a relationship between the pressure p (in atm), volume V (in L), and temperature T (in K) for a real gas: P = V3 nRT V - nb where n is the number of moles, R = 0.08206 (L atm)/(mol K) is the gas constant, and a (in L² atm/mol²), and b (in L/mol) are material constants. The equation can be easily used for calculating p (given T and V) or T (given p and V). The equation is not as readily solved for V when p and T are given, since it is nonlinear in V. One useful way to solve for V is by rewriting the equation as a third-order polynomial n² a V² (nb + "RT) v V² + n²av n Р Р n³ ab Р Use the function to calculate V for p = and b=0.0322L/mol. 0 and calculating the root of the polynomial. Write a user-defined function that calculates V for given p, T, n, a, and b. Name the function waals_email (where email is your Tulane email before the @ sign). The function will have these five inputs p, T, n, a, b and one output V. The function calculates V by using MATLAB's built-in function roots. Note that the solution of the polynomial can have non-real (complex) roots. The output argument V in waals should be a physically realistic solution (positive and real). Recall the MATLAB built-in functions real and imag which determine if the solution is real or imaginary respectively. If there are two positive real roots, choose the larger one. The main script should ask the user for the five input values and should display the results like in the following example With p=30atm, T=300K, n=1.5, a=1.345L^2 atm/mol, and b=0.0322 L/mol the volume V is 1.1984L. 30atm, T = 300K, n = 1.5, a = 1.345L² atm/mol,

icon
Related questions
Question

please answer in matlab

The van der Waals equation gives a relationship between the pressure p (in atm), volume
V (in L), and temperature T (in K) for a real gas:
р
V3
=
where n is the number of moles, R = 0.08206 (L atm)/(mol K) is the gas constant, and
a (in L² atm/mol²), and 6 (in L/mol) are material constants. The equation can be easily
used for calculating p (given T and V) or T (given p and V). The equation is not as readily
solved for V when p and T are given, since it is nonlinear in V. One useful way to solve for
V is by rewriting the equation as a third-order polynomial
n² a
n RT
V - nb V2
ᎡᏆ
3 - (nb + TRT)₁
V² + n² av
р
Use the function to calculate V for p
and b=0.0322L/mol.
n³ ab
Р
and calculating the root of the polynomial.
Write a user-defined function that calculates V for given p, T, n, a, and b. Name the
function waals_email (where email is your Tulane email before the @ sign). The function
will have these five inputs p, T,n,a,b and one output V. The function calculates V by using
MATLAB's built-in function roots. Note that the solution of the polynomial can have
non-real (complex) roots. The output argument V in waals should be a physically realistic
solution (positive and real). Recall the MATLAB built-in functions real and imag which
determine if the solution is real or imaginary respectively. If there are two positive real
roots, choose the larger one.
The main script should ask the user for the five input values and should display the results
like in the following example
With p=30atm, T=300K, n=1.5, a=1.345L^2 atm/mol, and b=0.0322 L/mol,
the volume V is 1.1984L.
= 1.345L² atm/mol,
30atm, T = 300K, n = 1.5, a =
Transcribed Image Text:The van der Waals equation gives a relationship between the pressure p (in atm), volume V (in L), and temperature T (in K) for a real gas: р V3 = where n is the number of moles, R = 0.08206 (L atm)/(mol K) is the gas constant, and a (in L² atm/mol²), and 6 (in L/mol) are material constants. The equation can be easily used for calculating p (given T and V) or T (given p and V). The equation is not as readily solved for V when p and T are given, since it is nonlinear in V. One useful way to solve for V is by rewriting the equation as a third-order polynomial n² a n RT V - nb V2 ᎡᏆ 3 - (nb + TRT)₁ V² + n² av р Use the function to calculate V for p and b=0.0322L/mol. n³ ab Р and calculating the root of the polynomial. Write a user-defined function that calculates V for given p, T, n, a, and b. Name the function waals_email (where email is your Tulane email before the @ sign). The function will have these five inputs p, T,n,a,b and one output V. The function calculates V by using MATLAB's built-in function roots. Note that the solution of the polynomial can have non-real (complex) roots. The output argument V in waals should be a physically realistic solution (positive and real). Recall the MATLAB built-in functions real and imag which determine if the solution is real or imaginary respectively. If there are two positive real roots, choose the larger one. The main script should ask the user for the five input values and should display the results like in the following example With p=30atm, T=300K, n=1.5, a=1.345L^2 atm/mol, and b=0.0322 L/mol, the volume V is 1.1984L. = 1.345L² atm/mol, 30atm, T = 300K, n = 1.5, a =
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer