MATLAB code for Master Thesis