MATLAB code for GSP tutorial