Relevant Matlab Code for PS2