Matlab Maximum Likelihood Estimation Algorithm