Just question (2) by using matlab
Show transcribed image text Week #6 In-class Problems CBE 160 Fall 2017 9/25/2017 I. Ideal Gas Law vs Van der Waals Gas Law, part 2 Write two well-documented MATLAB functions to calculate pressare according to both the idcal and Van der aals gas laws The first function will calculate pressure based on the ideal gas law and will be named deal gas.m. The second function will calculate pressure based on the Van der Waals equations of state and will The ideal gas law can be written as: PV. RT The Van der Waals equation of state may be written as: whereV is the molar volume (n), and a and b are the gas specific constants and R-8.3145 x10Lbarimol K Substance 1.361 0.0247 Hydrogen (H 10.78 A. Create 2 separate user-defined fumctions according to each respective gas law. They should use temperature and molar volumes as inputs and calculate the corresponding pressures as outputs. . How many inputs should you have for the ideal gas.m function? the vdw.m function? The same or different? What if I quickly wantod to compare other gases besides water and Freon? B. In a third script file, define vectors of semperature, moles, and volume as given in the hint section below and use the user-defined functions you created in part A to calculate the pressure of Freon and water according to both the ideal gas law and Van der Waals gas equations . Define temperature from 0 to 1000 K with 100 evenly spaced points Define moles (n) from 0.1 to 1 with 100 evenly spaced points Define volume (V) from 0 to 1L with 100 evenly spaced points C. Using the data created in part B, create a figure with six subplots (2 rows, 3 columns). Each subplot will compare the ideal gas law to the Van der Waals equation、(This means each subplot should contain 2 lines). * Position 1 : For Freon, plot temperature (independent) vs pressure
Week #6 In-class Problems CBE 160 Fall 2017 9/25/2017 I. Ideal Gas Law vs Van der Waals Gas Law, part 2 Write two well-documented MATLAB functions to calculate pressare according to both the idcal and Van der aals gas laws The first function will calculate pressure based on the ideal gas law and will be named deal gas.m. The second function will calculate pressure based on the Van der Waals equations of state and will The ideal gas law can be written as: PV. RT The Van der Waals equation of state may be written as: whereV is the molar volume (n), and a and b are the gas specific constants and R-8.3145 x10Lbarimol K Substance 1.361 0.0247 Hydrogen (H 10.78 A. Create 2 separate user-defined fumctions according to each respective gas law. They should use temperature and molar volumes as inputs and calculate the corresponding pressures as outputs. . How many inputs should you have for the ideal gas.m function? the vdw.m function? The same or different? What if I quickly wantod to compare other gases besides water and Freon? B. In a third script file, define vectors of semperature, moles, and volume as given in the hint section below and use the user-defined functions you created in part A to calculate the pressure of Freon and water according to both the ideal gas law and Van der Waals gas equations . Define temperature from 0 to 1000 K with 100 evenly spaced points Define moles (n) from 0.1 to 1 with 100 evenly spaced points Define volume (V) from 0 to 1L with 100 evenly spaced points C. Using the data created in part B, create a figure with six subplots (2 rows, 3 columns). Each subplot will compare the ideal gas law to the Van der Waals equation、(This means each subplot should contain 2 lines). * Position 1 : For Freon, plot temperature (independent) vs pressure





