Matlab code to solve pressure and temperature variation


Problem specification

5 kg of air is contained in the piston-cylinder device, initially at pressure of 2MPa and a specific volume of 0.08m3/kg. The air then expands, as an ideal gas, through a polytropic process, with variable values of n, to a final specific volume of 0.30m3/kg.

Objective:

Write the MATLAB code to solve for pressure and temperature variation throughout the expansion process and to calculate work and heat produced in processes for variable values of n.

Procedure:

1) Begin by defining the temperature at the initial state and then define the temperature and pressure at the final state. Sketch rough graph of what the process looks like on P-v coordinates. Write out by hand the equations and steps you would take to determine the actual P, T, and v at all points along the process. Identify unknowns, equations, constants, and calculation orders.
2) Using your hand calculations as guide, write the simple MATLAB m-file to calculate properties at points along the process (minimum of 20 points, but must be a variable which can be changed) using one of the values of n (I recommend using n=1.5). Plot P-v and T-v diagrams for the process using MATLAB.
3) Calculate work performed for process by integrating the curve of pressure versus specific volume. Use the “trapezoidal area method” for calculating integral.
4) Assume that specific internal energy for the air in this problem can be defined as the function of temperature as follows:

u(T)=(1.0344∗10−4)∗T2+(6.4476∗10−1)∗T+(1.3727∗102)

Add code to your MATLAB program to calculate the specific internal energy for process using the information of the pressure and specific volume at each state.
5) Using conservation of energy and the work calculated, determine amount of heat transferred for each process.
6) Write the loop in the code to analyze the different values of n, or run the code for the different values of n asked for below.

Deliverables

1) MATLAB code (m-file) that calculates the state variables P, v, T, and u for the defined process, and that calculates the work and heat for each process.
2) On the same graph, plot of P-v for this process with 4 different values of n: 1, 1.4, 1.5, 1.8.
3) Plot of P-v and T-v for n=1.5 on a single graph. Use the function plotyy.
5) Table summarizing results of work and heat as a function of n.
6) A brief paragraph detailing what you learned in this exercise and how useful you think these skills will be for your future as an engineer.

Solution Preview :

Prepared by a verified Expert
Mechanical Engineering: Matlab code to solve pressure and temperature variation
Reference No:- TGS0549

Now Priced at $70 (50% Discount)

Recommended (97%)

Rated (4.9/5)