No matter how many iterations one makes, the bad solution will never converge to the correct. But there is a method that is usually successful in nudging a solution away from a bad stationary point. This we call annealing and is done by expanding the covariance matrices of the PDF estimates and by pushing the state transition matrix and prior state probabilities closer to ``uniform". The utility software/ann_hmm.m does this. Attempt to find a ``bad" stationary point by re-running the above sequence until one is found. Next, use the commands
    [log_pdf_val, parm] = hmm_reest(parm, x, istart, nsamp, NIT);
This should correct the problem. Try it to satisfy yourself that it works. The second argument is the expansion factor for Cholesky factors of the covariance matrices and the third is a parameters greater than 1.0 that determines how much the state transition matrix is annealed.

Baggenstoss 2017-05-19