Added code for generating state transition matrix given a state matrix.