MATLAB codes