Matlab Code for Maximum Likelihood Estimation

The following is the matlab code that performs maximum likelihood estimation, as well as least squares estimation, for the models discussed in the paper by I. J. Myung 'Tutorial in Maximum Likelihood Estimation' published in *Journal of Mathematical Psychology* (vol, 47, pp. 90-100, 2000):

(Please note that the original matlab code included in the appendix of the paper is broken as it contains a few bugs.)