clear all
global yy
N=input('N->');
%tic
L=ones(N,1);
C=ones(N+1,1);
C(N/2)=1000;
L(N/2)=1000;
d0=ones(N,1)./L.*(ones(N,1)./C(1:N)+ones(N,1)./C(2:N+1)); % main diagonal of A
d1=-ones(N-1,1)./L(1:N-1).*(ones(N-1,1)./C(2:N));     % upper diagonal
d2=-ones(N-1,1)./L(2:N)./C(2:N);            % down diagonal
A=diag(d0,0)+diag(d1,1)+diag(d2,-1);
%toc
[v,d]=eig(A);
[d1,num]=sort(diag(d)); %to sort diagonal A
figure(2);
but=1;
subplot(2,1,1);
plot(d1,'.');
while but==1
[x,y,but]=ginput(1);
xi=round(x);
subplot(2,1,2);
plot(v(:,num(xi)));
subplot(2,1,1);
end
disp('Ok')
