Matlab script implemented