Project 2 Matlab Functions