HW2 MATLAB scripts