clear; clc; close all;

rng(9999);

pages = 5;
T = zeros(pages, pages);
for i = 1 : pages
    v = rand(1, pages);
    T(:, i) = v / sum(v);
end

% v = ones(pages, 1) / pages;
v = ones(pages, 1) / pages;
orders = [0, 1, 2, 4, 8, 16];
w = zeros(length(orders), pages);
for i = 1 : length(orders)
    w(i, :) = T ^ orders(i) * v;
end
figure; hold on;
bar(w, 'grouped');
grid on;
w(end, :)'

[V, D] = eig(T);
V(:, 1) / sum(V(:, 1))