Matlab programming implementation of Markov decision process