A = [1 2 2 -2; 0 2 0 -3; 3 -6 -4 6; -1 2 2 -3];
[U,B] = schur(A,'complex')
eig(B)'

eig(A)'

[V,lambda] = eig(A);
v1 = V(:,1); v2 = V(:,3); % eigenvectors associated with -7,-1
v3 = [1 0 0 0]'; v4 = [0 1 0 0]'; % arbitrary linearly independent vectors
q1 = v1/norm(v1); % Gram-Schmidt orthogonalization procedure
q2 = (v2-(v2'*q1)*q1)/norm(v2-(v2'*q1)*q1);
q3 = (v3-(v3'*q1)*q1-(v3'*q2)*q2); q3 = q3/norm(q3);
q4 = (v4-(v4'*q1)*q1-(v4'*q2)*q2-(v4'*q3)*q3); q4 = q4/norm(q4);
U = [q1,q2,q3,q4]

B=U'*A*U

U*B*U'

lambda = eig(A)'

null((A-lambda(1)*eye(4))^4)

null((A-lambda(2)*eye(4))^4)

null((A-lambda(3)*eye(4))^4)

C = [4 3 -2 5 7; 0 5 3 6 9; 0 -5 2 1 -7;0 0 0 4 3; 0 0 0 -2 -1];
C22 = [5 3; -5 2];
C33 = [4 3; -2 -1];
eig(C)

eig(C22)

eig(C33)

A = [4 2 4; 2 0 5; 4 5 -6];
lambda = eig(A)'

norm(A)

A = [2 -0.3 1; 4 -2 0; 0.5 1 -1];
lambda = eig(A)

plot(real(lambda),imag(lambda),'dr')
t=[0:0.01:2*pi]; hold on;
plot(2+1.3*sin(t),1.3*cos(t))
plot(-2+4*sin(t),4*cos(t))
plot(-1+1.5*sin(t),1.5*cos(t)); 
axis([-7 4 -5 5]);
