The following links should be a good starting point for you
- Plotting a PV diagram - https://www.mathworks.com/matlabcentral/answers/489174-plotting-a-p-v-diagram?s_tid=answers_rc1-2_p2_MLT
- Stirling engine example - https://www.mathworks.com/help/physmod/simscape/ug/gamma-stirling-engine.html