Copy of Matlab code for masters/phd