%EIGSHOW animated display about eigenvectors of the 2-by-2 matrix A.
% If the 2-by-2 matrix  A  is not defined, you will be prompted for it.

% from Cleve Moler jul95, somewhat adapted by cb
% latest change: 17oct97

clf reset
if ~exist('A'), A = input('Enter A: '); end
t = -pi:pi/50:pi;
plot(cos(t),sin(t),'b') 
s = max(norm(A),1);
axis([-s s -s s])
axis square
title(sprintf('A = [ %6.3f  %6.3f; %6.3f  %6.3f ]',A'))
xlabel('Move the span of  x  (the blue line) on top of  A*x  (the red line)')
h(1) = line([0 1],[0 0],'erase','xor','color','b','linew',2); 
h(2) = line([0 -1],[0 0],'LineStyle',':','erase','xor','color','b'); 
h(3) = line(0,0,'marker','o','erase','none','color','r','markersize',2); 
h(4) = line([0 A(1,1)],[0 A(2,1)],'erase','xor','color','r','linew',2); 
set(gcf,'windowbuttondownfcn', ...
  'eigshowf(h,A); set(gcf,''windowbuttonmotionfcn'',''eigshowf(h,A)'')')
set(gcf,'windowbuttonupfcn', ...
     'set(gcf,''windowbuttonmotionfcn'','''')')
