echo off
disp(sprintf('**** Graphical presentation of Power method - all vectors ***'));
%A=[0.5 0.1; 0.1 0.3] 	% initial matrix with maximal eigenvalue < 1
A=[0.7 1; 0.1 -1.2] 	% initial matrix with maximal eigenvalue > 1
axis equal;
hold on;   
plot(0,0,'r+');	%plot origin (0,0) point
t=[-1:.01:1];
%Calculate vectors from the unit circle
U=[cos(t*pi); sin(t*pi)];
Xi=A*U;
plot(U(1,:),U(2,:),'r.');
plot(Xi(1,:),Xi(2,:),'b.');
for i=1:5
	Xi=A*Xi;	% generate next vector
	axis equal;
	plot(Xi(1,:),Xi(2,:),'b.'); %plot vector
end
[V,D]=eig(A)	%MatLab eigenvectors and eigenvalues.
