clear; clc; close all;

rng(9999);

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

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

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