《马尔科夫链matlab代码》由会员分享,可在线阅读,更多相关《马尔科夫链matlab代码(4页珍藏版)》请在人人文库网上搜索。
1、马尔科夫链%This is programmed for calculating the Markov-chain state transfer probability(First order) matrice!%This program is based on 4 thresholds,that is, the transfer probability matrice is 4x4.%Follow the notes to conduct the processing.%Coded by EOS%Nanchang Chinaclearclc%A=csvread(widetype.csv);%。
2、 % or manually define via A= .A= %A is the information matrix which must be adjusted to wide-type,i(section)-j(time)%out=zeros(4,4);%Initialize the transfering probability(First order) matricer1,r2,r3=deal(1.009, 1.285, 1.7256);%!Define the state threshold value manually.flag=0;trans=zeros(4,4);s0=z。
3、eros(1,4);epro=zeros(10,4);for i=1:10if A(i,1)= r1 & A(i,1)=r2 & A(i,1)= r1 & A(i,t)=r2 & A(i,t)=r1 & A(s,t+1)=r2 & A(s,t+1)=r1 & A(s,t)=r1 & A(s,t+1)=r2 & A(s,t+1)=r2 & A(s,t)=r1 & A(s,t+1)=r2 & A(s,t+1)=r1 & A(s,t+1)=r2 & A(s,t+1)r3trans(flag,3)=trans(flag,3)+1;elsetrans(flag,4)=trans(flag,4)+1;endendendend%Calculate the Markov state transfering probability matricefor i=1:4for j=1:4out(i,j)=trans(i,j)/sum(trans(i,:);endenddisp(Markov state transfering probability matrice is:)disp(out。