update state matrix