Code for 380 Matlab project