5 kg of air is contained in the piston-cylinder device, initially at a pressure of 2MPa and a specific volume of 0.08m3/kg. The air then expands, as an ideal gas, via a polytropic process, with variable values of n, to a final specific volume of 0.30m3/kg.
prepare down a MATLAB code to solve for the pressure and temperature variation all through the expansion process and to compute the work and heat produced in the processes for variable values of n.
A) Start by defining the temperature at initial state and then define the temperature and pressure at final state. Sketch a rough graph of what the process looks like on P-v coordinates. prepare out by hand the equations and steps you would take to find out the actual P, T, and v at all points all along the process. Identify unknowns, equations, constants and calculation orders.
B) By using your hand calculations as a guide, prepare a simple MATLAB m-file to compute the properties at points all along the process (minimum of 20 points, however must be a variable that can be changed) by using one of the values of n (I recommend using n = 1.5). Plot P-v and T-v diagrams for the process by using the MATLAB.
C) Compute the work performed for the process by integrating the curve of pressure versus specific volume. Use the ‘trapezoidal area method’ for computing the integral.
D) Suppose that the specific internal energy for the air in this problem can be defined as the function of temperature as shown below:
u(T) = (1.0344 ∗ 10−4) ∗ T2 + (6.4476 ∗ 10−1) ∗ T + (1.3727 ∗ 102)
Add code to your MATLAB program to compute the specific internal energy for the process by using the information of the pressure and specific volume at each and every state.
E) Using conservation of energy and the work computed, find out the amount of heat transferred for each process.
F) prepare a loop in the code to analyze the various values of n, or run the code for the distinct values of n asked for below.
A) Hand calculations which outline planned MATLAB code.
B) MATLAB code (m-file) which find outs the state variables P, v, T, and u for the defined process, and which find outs the work and heat for each process.
C) On same graph, plot of P-v for this process with 4 different values of n: 1, 1.4, 1.5, 1.8.
D) Plot of P-v and T-v for n=1.5 on a single graph. Use the function plotyy.
E) Table summarizing results of work and heat as a function of n.
F) A brief paragraph detailing what you learned and how useful you think such skills will be for your future as an engineer.