<< Chapter < Page | Chapter >> Page > |
Arrival times and recurrence times
The basic simulation produces one or more trajectories of a specified length. Sometimes we are interested in continuing until first arrival at (or visit to)a specific target state or any one of a set of target states. The time (in transitions) to reach a target state is one less than the number of stages in the trajectory whichbegins with the initial state and ends with the target state reached.
Data files
For use of MATLAB in simulation, we find it convenient to organize the appropriate data in an m-file.
An example data file used to illustrate the various procedures is shown below. These data were generated artificially and have no obvious interpretations in terms of aspecific systems to be modeled. However, they are sufficiently complex to provide nontrivial illustrations of the simulation procedures.
% file markovp1.m
% Artificial data for a Markov chain, used to% illustrate the operation of the simulation procedures.
P = [0.050 0.011 0.155 0.155 0.213 0.087 0.119 0.190 0.008 0.0120.103 0.131 0.002 0.075 0.013 0.081 0.134 0.115 0.181 0.165
0.103 0.018 0.128 0.081 0.137 0.180 0.149 0.051 0.009 0.1440.051 0.098 0.118 0.154 0.057 0.039 0.153 0.112 0.117 0.101
0.016 0.143 0.200 0.062 0.099 0.175 0.108 0.054 0.062 0.0810.029 0.085 0.156 0.158 0.011 0.156 0.088 0.090 0.055 0.172
0.110 0.059 0.020 0.212 0.016 0.113 0.086 0.062 0.204 0.1180.084 0.171 0.009 0.138 0.140 0.150 0.023 0.003 0.125 0.157
0.105 0.123 0.121 0.167 0.149 0.040 0.051 0.059 0.086 0.0990.192 0.093 0.191 0.061 0.094 0.123 0.106 0.065 0.040 0.035];states = 10:3:37;
PI = [0.0849 0.0905 0.1125 0.1268 0.0883 0.1141 ...0.1049 0.0806 0.0881 0.1093]; % Long-run distribution
Notification Switch
Would you like to follow the 'Applied probability' conversation and receive update notifications?