MATLAB implementation of grating interferometry