# MATLAB: Eig doesn’t converge – can you explain why

eigeigenvalueeigenvectorMATLABmatrices

Hi,
I have been having a problem with the eigenvalue function. I have two 240×240 matrices (which I have attached with this post) that I add together, and then get matrices of eigenvalues and eigenvectors. I have many such matrices like the ones that I posted that are added together and such during the program, but this combination does not work for some reason. It always works with the eigenvalues, so it seems like the eigenvectors are causing the problem. Any clues as to why so? The line of code that I have been using is:
[a,b] = eig(hh(1:240,1:240)+ pot(1:240,1:240));
The reason that I specified the range of indices is that if I use either 1:239 or 2:240 on both "hh" and "pot" at the same time, the eig function doesn't have a problem anymore. Anyway, thanks for any help you can give.

% First we compute the squared Frobenius norm of our matrixnA = sum(sum(A.^2));% Then we make this norm be meaningful for element wise comparisonnA = nA / numel(A);% Finally, we smooth our matrixAs = A;As( As.^2 < 1e-10*nA ) = 0;
% We check that the result is correctev = eig(A);[eVs,evs] = eig(As);fprintf('Error of smoothing: %g%%\n',100*norm(ev-evs)/norm(ev));