added MATLAB code