added matlab code