clear all
n=2000;
h=1/(n+1);
voffdiag=ones(n-1,1);
mymat=-2*eye(n)+diag(voffdiag,1)+diag(voffdiag,-1);
D=sort(eig(mymat),'descend');
lam=sqrt(-D)/h;
check=lam/pi;
myint=(1:n)';
plot(myint,check,myint,myint)
myerr=abs(check-myint)./(myint);
figure
semilogy(myint,myerr)