newstat - % First, we can rewrite v = vP by v(P-I) = z,...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
C:\work\stat.m Page 1 July 11, 2003 3:36:32 PM function v = stat(P) % % This is a MATLAB function that calculates the stationary probability vect or v % of a Markov chain transition matrix P, i.e., we solve v = v*P . % We assume the existence of a unique stationary vector. % For a finite-state Markov chain, the condition is that the chain be irred ucible. % % We input the matrix P when we call the function. % First find the number n of rows in the transition matrix P. s = size(P); n = s(1); % % There is one redundant equation in the n equations v = vP. % We fill gap by using the fact that v(1) + . .. + v(n) = 1.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % First, we can rewrite v = vP by v(P-I) = z, where I is an identity matrix and z is a vector of zeros. % We then add a column of 1's to make a new equation % I = eye(n); %the identity matrix z = zeros(1,n); %a row of zeros w = ones(n,1); %a column of 1's A = [P-I w]; % % The desired system of equations is vA = [z 1], where A is n by (n+1) % We solve it by writing v = [z 1]/A % v = [z 1]/A; % % Using transposes, we could also write v' = A'\[z 1]' % We could also use the matrix inverse applied to square matrices. % That approach is in the other program stationary.m...
View Full Document

This note was uploaded on 10/20/2010 for the course IEOR 4106 taught by Professor Whitt during the Spring '08 term at Columbia.

Ask a homework question - tutors are online