MATLAB code for imaging