Hi Alex,
I understand that you want to plot the PV graph for the given compressions and expansions so that the resulting graph looks similar to the reference graph.
Initially, it is important to note that there are some imperfections in the given constants.
- For an isothermal process PV should be constant, but p5*v5 is not equal to p6*v6.
- For an adiabatic process PVɣ should be constant. The adiabatic constant that you calculated in line 9 evaluates to 5/3. But again p1*(v1^(5/3)) is not equal to p2*(v2^(5/3)).
So, I suggest you recheck the values so that all the conditions are satisfied.
Once you get all the values correct you can generate the data points for all the plots as below:
- Adiabatic compression
v_adiabatic = linspace(0.0243, 0.0285, 42);
p_adiabatic = p1*(v1^kappa) ./ (v_adiabatic .^ kappa);
- Isobaric compression:
v_isobar = linspace(0.0243, 0.0197, 42);
p_isobar = linspace(152061, 152061, 42);
- Isothermal expansion
v_isothermal = linspace(0.0197, 0.0285, 88);
p_isothermal = p5*v5 ./ v_isothermal;
Hope this Helps!