matlab code for research