function P1()
% Examines the functions MakeTransition and Stationary.
close all
% A small example...
theta = [10 56 60 63  120 150 187 189 270 350]'*pi/180;
plot(cos(linspace(0,2*pi)),sin(linspace(0,2*pi)))
hold on
axis equal off
plot(cos(theta),sin(theta),'.r','Markersize',15)
hold off
n = length(theta);
T = MakeTransition(theta);
x0 = Stationary(T);
x = ceil(10000*x0)
text(1.02,.17,sprintf('%4d',x(1)),'fontsize',14)
text(.62,.82,sprintf('%4d',x(2)),'fontsize',14)
text(.55,.89,sprintf('%4d',x(3)),'fontsize',14)
text(.46,.96,sprintf('%4d',x(4)),'fontsize',14)
text(-.65,.90,sprintf('%4d',x(5)),'fontsize',14)
text(-1.05,.50,sprintf('%4d',x(6)),'fontsize',14)
text(-1.2,-.10,sprintf('%4d',x(7)),'fontsize',14)
text(-1.2,-.20,sprintf('%4d',x(8)),'fontsize',14)
text(-0.04,-1.10,sprintf('%4d',x(9)),'fontsize',14)
text(1,-.18,sprintf('%4d',x(10)),'fontsize',14)
shg
clc
fprintf('Example 1.\n\n|| T*x0 - x0|| = %10.3e\n\n',norm(T*x0-x0))
fprintf('min(min(T) = %10.3e\n\n',min(min(T)))
fprintf('||sum(T) - ones(1,n)|| = %10.3e\n\n',norm(sum(T)-ones(1,n)))
fprintf('x = \n')
fprintf('   %10.3f\n',x)

% Example 2...
figure
rand('seed',0);
theta = sort(rand(100,1)*2*pi);
T = MakeTransition(theta);
x0 = Stationary(T);
plot(x0)
title('Example 2')
shg







        

    
    