commented matlab code