Simulation 2
Simulation 2
Simulation Lab 2
Salman Ahmad Khan
28/1/2025
1
2. Determine if the fundamental equations give reasonable values of T and P . Write
a short comment in your MATLAB code about whether you get reasonable values of
T and P . Hint: Use MATLAB’s gradient function. See the demo codes.m file for
how to use the gradient function. (Report)
3. Check if the equations satisfy the extensivity criterion. Write a short comment in
your MATLAB code about the extensivity of the functions. Hint: You should think
abot calculating the difference between the L.H.S and R.H.S of e.q. 4. The abs()
and max() functions might be helpful here. (Report)
Note, we can similarly check for the stability criterion. But we are not doing that in
this exercise.
1. Plot the total entropy of the system as a function of Ua and Va . Ua and Va are the
energy and volume of chamber A, respectively.
2. Find the values of Ua , Ub , Va , and Vb at equilibrium. You can visually do it but you
will be given full points for using fminunc. See the demo codes.m file for how to
use fminunc.
3. You do not have to answer this part (part 3) here with your code. Answer this in
the report. What will happen if the initial volume and energy of chamber A were
3J and 4m3 , respectively. (Report)
2. Submit a short report answering questions marked with (Report) at the end. You
can submit the report by 11:59 pm today (28/01/2025).