function e435
%
% Example 4.3.5
%
P=zeros(7,7);
P(1,:)=[0 0 0 .65 0 .35 0];
P(2,:)=[0 0 0 .9 0 .1 0];
P(3,:)=[.1 .1 0 0 0 0 .8];
P(4,:)=[0 0 .12 0 .88 0 0];
P(5,:)=[.15 .35 0 0 0 0 .5];
P(6,:)=[0 0 .75 0 .25 0 0];
P(7,:)=[0 0 0 .4 0 .6 0];
fprintf(' The original P matrix: \n'); P
[PC,f]=mc_canop(P);
fprintf(' list of state labels: \n',f); f
fprintf(' The trnasition matrix in canonical form \n');
PC
[p]=mc_limsr(PC);
fprintf(' the time average pi \n'); p
%
% Look at the three closed communication classes
%
P3=PC^3;
fprintf(' the P3 matrix \n'); P3
Q1=P3(1:2,1:2); Q2=P3(3:5,3:5); Q3=P3(6:7,6:7);
[p1]=mc_limsr(Q1); [p2]=mc_limsr(Q2); [p3]=mc_limsr(Q3);
fprintf(' p1: '); p1
fprintf(' p2: '); p2
fprintf(' p3: '); p3
pp=[p1 p2 p3]; pp=pp/3