echo off
disp(sprintf('**** Graphical presentation of Power method - single starting vector*'));
echo on
%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
xi=[0.1,0.1]' % initial vector
echo off;
axis equal;
plot(xi(1,1),xi(2,1),'-'); %plot starting vector
hold on;   
plot(0,0,'r+');	%plot origin (0,0) point
for i=1:10
	xi=A*xi;	% generate next vector
	axis equal;
	plot(xi(1,1),xi(2,1),'r*'); %plot vector
end
echo on;
v=norm(xi);
xn=xi/v		% approximate normalized eigenvector 
axis equal;
plot(xn(1,1),xn(2,1),'g*')
x=A*xi;	% generate one additional vector
v=x(1,1)/xi(1,1)	% approximate maximal eigenvalue 
[V,D]=eig(A)	%MatLab eigenvectors and eigenvalues.
