% % code21: homework hint (djm - 29 oct 2001) % % matrix with alge-mult =2, geom-mult = 1 J = [1 1 ; 0 1]; eigJ = 1; w_J = [1 ; 0]; w_perp = [0 ; 1]; % random perturbation a = rand(2,2) % epsilon domain de = 0.01; emax = 0.2; % eigenplots figure(1); clf; subplot(2,1,1); hold on title('\bf eigenvalues') xlabel('\epsilon') ylabel('\lambda(\epsilon)-\lambda(0); real=r imag=k') axis([-emax emax -0.5 0.5]) subplot(2,1,2); hold on title('\bf eigenvector projection orthogonal to w1') xlabel('\epsilon') ylabel('|w(\epsilon)\cdot w(0)^{\perp}|') axis([-emax emax 0 0.5]) % loop for epsilon perturbed matrix for epsilon = -emax:de:emax J1 = J + epsilon*a; [W,D] = eig(J1); c1 = abs(W(:,1)'*w_perp); c2 = abs(W(:,2)'*w_perp); subplot(2,1,1) plot(epsilon,real(D(1,1)-eigJ),'rx'); plot(epsilon,real(D(2,2)-eigJ),'ro'); plot(epsilon,imag(D(1,1)-eigJ),'kx'); plot(epsilon,imag(D(2,2)-eigJ),'ko'); subplot(2,1,2) plot(epsilon,c1,'rx'); plot(epsilon,c2,'ro'); end