function w = Update(P,v)
% P is an n-by-n array of transition probabilities
% v is an n-by-1 state vector
% w is the update of v
n = length(v);
w = zeros(n,1);
for i=1:n
% Compute the i-th component of the new state vector..
for j=1:n
w(i) = w(i) + P(i,j)*v(j);
end
end