Q4: Suppose we apply the Markov model on the transition matrix of the web where
ID: 3282489 • Letter: Q
Question
Q4: Suppose we apply the Markov model on the transition matrix of the web where the transition matrix MT-B is 1 0 2 3 2 1 0 0 A hypothetical example of a Web Find the probability of being at state i, i=1,2,3,4 at infinity (or steady state). i) You can use the iteration Pk+1 B Pk with initial state probabilities Po= [0.25 0.25 0.25 0.25] T to calculate the steady state probability values. ii) or, you can solve the equation: P= BP You should get the same answer in parts (i) and (ii). You can use MATLABExplanation / Answer
MATLAB code
close all
clear
clc
B = [0 1/2 1 0;
1/3 0 0 1/2;
1/3 0 0 1/2;
1/3 1/2 0 0]';
P = [0.25 0.25 0.25 0.25]';
% part (i)
fprintf('Part (i) ');
while 1
P_prev = P;
P = B*P;
c = 0;
for i=1:length(P)
if abs(P(i) - P_prev(i)) <= 1e-6
c = c + 1;
end
end
if c == length(P)
break
end
end
Pinf = P
% part (ii)
fprintf(' Part (ii) ');
P = [0.25 0.25 0.25 0.25]';
Pinf = pinv(B)*P
Output
Part (i)
Pinf =
0.2500
0.2500
0.2500
0.2500
Part (ii)
Pinf =
0.2500
0.2500
0.2500
0.2500
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.