


system2.m sets up the transition matrix for a simple system with no absorbing state, calculates powers of the transition matrix, and shows simulations of the chain


0001 % system2.m sets up the transition matrix for a simple system with no absorbing state, calculates powers of the transition matrix, and shows simulations of the chain 0002 0003 P=zeros(7,7); 0004 P(1,2)=1; 0005 for i=2:6, 0006 P(i,i-1) = 0.5; 0007 P(i,i+1) = 0.5; 0008 end; 0009 P(7,3)=1; 0010 0011 showmatrix(P); 0012 showmatrix(P^2); 0013 showmatrix(P^10); 0014 showmatrix(P^100); 0015 showmatrix(P^250); 0016 0017 mu=[0 1 0 0 0 0 0]; % initial distribution 0018 0019 simulate_chain;