added Matlab code