%%%%%%%%%%%%%%%%%%%%% Eigenvalue plot procedure %%%%%%%%%%%%%%%%%%%%% % % EIGPLOT % Usage: EIGPLOT(A) % Input: A - square matrix % % the eigenvalues of the matrix A are plotted against % the background of the unit circle and the x and y axes function y=eigplot(A) t=0:(2*pi)/100:2*pi; % find polar co-ordinates for cx= cos(t); cy=sin(t); % 101 points on the unit circle lam=eig(A); % vector of eigenvalues lamx=real(lam); % find polar coordinates of eigenvalues lamy=imag(lam); mlam=1.1*max([abs(lam)' 1]); % this guarantees that unit circle and all % eigenvalues will be visible xx=[-mlam mlam]; % coordinates of endpoints of x-axis xy=[0 0]; yx=[0 0]; % coordinates of endpoints of y-axis yy=[-mlam mlam]; plot(xx,xy,'-r',yx,yy,'-r',cx,cy,'-r',lamx,lamy,'*k') axis('equal'); axis([-mlam,mlam,-mlam,mlam]); % plot everything in the order % x-axis, y-axis, circle % and then eigenvalues % observe that eigen values are % yellow stars title('Eigenvalue Plot')