MATLAB source code for reproducing the results in the paper and supplementary information