Added some comments to describe MATLAB code