Project 1 Code in Matlab