%DisplayEigenInfo.m %Math 128B Spring 2005 %Hmwk2 - Utility Function (Feb. 1, 2005) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function DisplayEigenInfo(V, eigValues) %given an array eigValues whose k'th entry is the k'th eigenvalue % and an array V whose k'th column is the k'th eigenvector % displays information in formatted text cr = sprintf('\n'); sizeof = size(eigValues); dim = sizeof(1); strEigVal = 'eigenvalues: '; for i=1:dim strEigVal = [strEigVal num2str(eigValues(i))]; if (i < dim) strEigVal = [strEigVal ', ']; end end disp([strEigVal cr]); for i=1:dim str = ['eigenvector corresponding to eigVal=' num2str(eigValues(i)) ':' cr]; str = [str ' [' num2str(V(:,i)') ']']; disp(str); end return