Home > sp > example5_3_23.m

example5_3_23

PURPOSE ^

example5_3_23.m

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 example5_3_23.m

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % example5_3_23.m
0002 
0003 P=[[0.5 0 0.5 0 0 0 0 0 0 0];
0004    [0 1/3 0 0 0 0 2/3 0 0 0];
0005    [1 0 0 0 0 0 0 0 0 0];
0006    [0 0 0 0 1 0 0 0 0 0];
0007    [0 0 0 1/3 1/3 0 0 0 1/3 0];
0008    [0 0 0 0 0 1 0 0 0 0];
0009    [0 0 0 0 0 0 1/4 0 3/4 0];
0010    [0 0 1/4 1/4 0 0 0 1/4 0 1/4];
0011    [0 1 0 0 0 0 0 0 0 0];
0012    [0 1/3 0 0 1/3 0 0 0 0 1/3]]
0013 
0014 i=[6 1 3 2 7 9 4 5 8 10];  % the order in which you want to see the states
0015 
0016 Q=P(i,i);                  % the re-ordered transition matrix
0017 
0018 break
0019 
0020 
0021 >> showmatrix(P)
0022   0.5000  0.0000  0.5000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0023   0.0000  0.3333  0.0000  0.0000  0.0000  0.0000  0.6667  0.0000  0.0000  0.0000
0024   1.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0025   0.0000  0.0000  0.0000  0.0000  1.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0026   0.0000  0.0000  0.0000  0.3333  0.3333  0.0000  0.0000  0.0000  0.3333  0.0000
0027   0.0000  0.0000  0.0000  0.0000  0.0000  1.0000  0.0000  0.0000  0.0000  0.0000
0028   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.2500  0.0000  0.7500  0.0000
0029   0.0000  0.0000  0.2500  0.2500  0.0000  0.0000  0.0000  0.2500  0.0000  0.2500
0030   0.0000  1.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0031   0.0000  0.3333  0.0000  0.0000  0.3333  0.0000  0.0000  0.0000  0.0000  0.3333
0032 
0033 
0034 >> showmatrix(Q)
0035   1.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0036   0.0000  0.5000  0.5000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0037   0.0000  1.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0038   0.0000  0.0000  0.0000  0.3333  0.6667  0.0000  0.0000  0.0000  0.0000  0.0000
0039   0.0000  0.0000  0.0000  0.0000  0.2500  0.7500  0.0000  0.0000  0.0000  0.0000
0040   0.0000  0.0000  0.0000  1.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0041   0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  1.0000  0.0000  0.0000
0042   0.0000  0.0000  0.0000  0.0000  0.0000  0.3333  0.3333  0.3333  0.0000  0.0000
0043   0.0000  0.0000  0.2500  0.0000  0.0000  0.0000  0.2500  0.0000  0.2500  0.2500
0044   0.0000  0.0000  0.0000  0.3333  0.0000  0.0000  0.0000  0.3333  0.0000  0.3333
0045 
0046 The states in the lower right are transient.
0047 Once X leaves the set of transient states, it cannot return to them.
0048 
0049 >> showmatrix(Q^1000)
0050   1.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0051   0.0000  0.6667  0.3333  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0052   0.0000  0.6667  0.3333  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000  0.0000
0053   0.0000  0.0000  0.0000  0.3913  0.3478  0.2609  0.0000  0.0000  0.0000  0.0000
0054   0.0000  0.0000  0.0000  0.3913  0.3478  0.2609  0.0000  0.0000  0.0000  0.0000
0055   0.0000  0.0000  0.0000  0.3913  0.3478  0.2609  0.0000  0.0000  0.0000  0.0000
0056   0.0000  0.0000  0.0000  0.3913  0.3478  0.2609  0.0000  0.0000  0.0000  0.0000
0057   0.0000  0.0000  0.0000  0.3913  0.3478  0.2609  0.0000  0.0000  0.0000  0.0000
0058   0.0000  0.2222  0.1111  0.2609  0.2319  0.1739  0.0000  0.0000  0.0000  0.0000
0059   0.0000  0.0000  0.0000  0.3913  0.3478  0.2609  0.0000  0.0000  0.0000  0.0000
0060 
0061 This shows quite clearly that after 1000 steps, the chain will not be
0062 in any of the transient states, but will be in one of the irreducible
0063 sets.
0064

Generated on Mon 17-Mar-2008 10:33:42 by m2html © 2003