Write a computer program to calculate the heat addition per
     Write a computer program to calculate the heat addition per unit mass, the net work per unit mass, the thermal efficiency, and the mean effective pressure of an air-standard Diesel cycle. Plot each of the above quantities as functions of the compression ratio for p_1 = 1 bar, T_1 = 300 K, and for maximum cycle temperatures of 1200, 1500, 1800, and 2100 K. 
  
  Solution
Matlab code
cp = 1
 Ta = 300
 Tb = 1200
 Tc = 1500
 Td = 1800
%Heat addition per unit mass
 heatIn = cp*(Tc-Tb)
 print(\'Head addition per unit mass\')
 print(heatIn)
 %net work
 netWork = cp((Tc-Tb) - (Td-Ta))
 print(\'Net work per unit mass\')
 print(netWork)
% efficiency
 efficiency = netWork/heatIn
 print(\'Efficiency\')
 print(efficiency)

