How to generate a second order markov chain?
조회 수: 4 (최근 30일)
이전 댓글 표시
I have 27 symbols (numbers 1 to 27) and a probability transition matrix of size 729*27 for generating a second order markov chain.
I have already done first order one with a 27*27 probability transition matrix. The code snippet for 1st order markov chain was like this:
states = zeros(1,10000);% for 10000 length string output
states(1) = randsample(27, 1, true, prior);% 27 symbols
for t=2:10000
states(t) = randsample(27, 1, true, TRANS(states(t-1),:));% 27 symbols
end
(where prior is the probability distribution of symbols and TRANS is the transition matrix, states is the generated sequence.) How can I extend this to 2nd order markov chain?
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Markov Chain Models에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!