% CHAINSET file chainset.m Setup for simulating Markov chains % Version of 1/2/96 Revise 7/31/97 for version 4.2 and 5.1 P = input('Enter the transition matrix '); ms = length(P(1,:)); MS = 1:ms; states = input('Enter the states if not 1:ms '); if isempty(states) states = MS; end disp('States are') disp([MS;states]') PI = input('Enter the long-run probabilities '); F = [zeros(1,ms); cumsum(P')]'; A = F(:,MS); B = F(:,MS+1); e = input('Enter the set of target states '); ne = length(e); E = zeros(1,ne); for i = 1:ne E(i) = MS(e(i)==states); end disp(' ') disp('Call for for appropriate chain generating procedure')