Make a function which will calculate the pressure of a gas using Van der Waals Equation: The Van der Waals function will have arguments: temperature (T) in Kelvin,molar volume (Vm) in L/mole,critical temperature (Tc) in Kelvin andcritical pressure (Pc) in atm.(Tc and Pc are characteristics of the substance.) Within the function also define the gas constant R= 0.08206 L·atm/mole·K. The Van der Waals equation to calculate the pressure, P is:   Where   Within the function, create variables a, b and Vc, and calculate the value for each prior to calculating P. Using the MATLAB editor, make a script m-file for the following: Calculate the pressure withTemperatures over the range 255 to 315 K at intervals of 2 K, and Vm = 25.35 L/mole, Consider two substances:For ammonia: Tc = 141.15 K and Pc = 111.5 atm.For carbon dioxide: Tc = 241.9 K and Pc = 73.0 atm. Make a table with temperature in column 1, pressure for carbon dioxide in column 2 and pressure for ammonia in column 3, and write the table to a file.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.1: Function And Parameter Declarations
Problem 5E: (Statics) An annulus is a cylindrical rod with a hollow center, as shown in Figure 6.7. Its second...
icon
Related questions
Question

 Make a function which will calculate the pressure of a gas using Van der Waals Equation:

The Van der Waals function will have arguments:

temperature (T) in Kelvin,
molar volume (Vm) in L/mole,
critical temperature (Tc) in Kelvin and
critical pressure (Pc) in atm.
(Tc and Pc are characteristics of the substance.)

Within the function also define the gas constant R= 0.08206 L·atm/mole·K.

The Van der Waals equation to calculate the pressure, P is:

 

Where

 

Within the function, create variables a, b and Vc, and calculate the value for each prior to calculating P.

Using the MATLAB editor, make a script m-file for the following:

Calculate the pressure with
Temperatures over the range 255 to 315 K at intervals of 2 K, and Vm = 25.35 L/mole,

Consider two substances:
For ammonia: Tc = 141.15 K and Pc = 111.5 atm.
For carbon dioxide: Tc = 241.9 K and Pc = 73.0 atm.

Make a table with temperature in column 1, pressure for carbon dioxide in column 2 and pressure for ammonia in column 3, and write the table to a file.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr