Problem 3 Matlab Code