How to create a Markov chain sequence given the transition matrix and the states

1 回表示 (過去 30 日間)
sn at
sn at 2017 年 2 月 11 日
コメント済み: shahab anjum 2020 年 3 月 9 日
There is 5 states as follows:
QS=[2.0243
-0.6361
0.7770
1.0486
1.1569] % or QS={2.024 ,-0.6361 ,0.7770, 1.0486 ,1.1569}
And this is the transition matrix that has the probabilities of going from one state to another:
P=[0.5000 0.0556 0.0556 0.0556 0.0556
0.0556 0.5000 0.0556 0.0556 0.0556
0.0556 0.0556 0.5000 0.0556 0.0556
0.0556 0.0556 0.0556 0.5000 0.0556
0.0556 0.0556 0.0556 0.0556 0.5000];
How can I get a Markov chain sequence Js=[Js(1)...Js(t)] from these given P and QS? (t is a given time)
I used the following code to produce the sequence but it does not use the state space which is known in computing the sequence.
transition_probabilities=P;
chain_length=512;
chain = zeros(1,chain_length);
chain(1)=starting_value; %Starting value=1;
for i=2:chain_length
this_step_distribution = transition_probabilities(chain(i-1),:);
cumulative_distribution = cumsum(this_step_distribution);
r = rand();
chain(i) = find(cumulative_distribution>r,1);
end
Will I still get the right sequence, even if I don't use the State space?
  1 件のコメント
shahab anjum
shahab anjum 2020 年 3 月 9 日
can u please tell me how u get the transition probablity matrix please

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMarkov Chain Models についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by