1、幂迭代

%%%%%%%%%%%%%%%%%% % Power Iteration %%%%%%%%%%%%%%%%%% A=[ 11.2 12.6 1.0 -13.7 4.3 6.6 1.5 -6.4 8.3 17.5 4.5 -17.6 6.1 3.0 1.7 -4.3 ]; % First step:Generate an Unit matrix [m,n] = size(A); x = rand(1,n); x = x / norm(x); x = x'; % Set Iteration tol = 1e-6; res_1 = 0; res_2 = inf; num = 0; while(abs(res_2 - res_1) > tol) num = num + 1; y = A*x; x = y/norm(y); u = dot(x, A*x); res_1 = res_2; res_2 = u; end x,u,num
2、反迭代

%%%%%%%%%%%%%%%%%% % Power Iteration %%%%%%%%%%%%%%%%%% A=[ 11.2 12.6 1.0 -13.7 4.3 6.6 1.5 -6.4 8.3 17.5 4.5 -17.6 6.1 3.0 1.7 -4.3 ]; % First step:Generate an Unit matrix [m,n] = size(A); x = rand(1,n); x = x / norm(x); x = x'; % Set Iteration tol = 1e-6; res_1 = 0; res_2 = inf; num = 0; while(abs(res_2 - res_1) > tol) num = num + 1; y = (A-2*eye(4))*x; x = y/norm(y); u = dot(x, A*x); res_1 = res_2; res_2 = u; end x,u,num
3、Rayleigh商迭代

%%%%%%%%%%%%%%%%%% % Power Iteration %%%%%%%%%%%%%%%%%% A=[ 11.2 12.6 1.0 -13.7 4.3 6.6 1.5 -6.4 8.3 17.5 4.5 -17.6 6.1 3.0 1.7 -4.3 ]; % First step:Generate an Unit matrix [m,n] = size(A); x = rand(1,n); x = x / norm(x); x = x'; % Set Iteration tol = 1e-6; res_1 = 0; res_2 = inf; sigma = x'*(A*x); num = 0; while(abs(res_2 - res_1) > tol) num = num + 1; y = (A-sigma*eye(4,4))^-1*x; x = y/norm(y); u = dot(x, A*x); sigma = u; res_1 = res_2; res_2 = u; end x,u,num
4、正交迭代

%%%%%%%%%%%%%%%%%% % Orthogonal Iteration %%%%%%%%%%%%%%%%%% A=[ 11.2 12.6 1.0 -13.7 4.3 6.6 1.5 -6.4 8.3 17.5 4.5 -17.6 6.1 3.0 1.7 -4.3 ]; % First step:Generate an Unit matrix [m,n] = size(A); Z = eye(4); for k = 1:100 Y = A*Z; [Q,R] = qr(Y); Z = Q; end R
5、QR迭代

%%%%%%%%%%%%%%%%%% % QR Iteration %%%%%%%%%%%%%%%%%% A=[ 11.2 12.6 1.0 -13.7 4.3 6.6 1.5 -6.4 8.3 17.5 4.5 -17.6 6.1 3.0 1.7 -4.3 ]; for k = 1:100 [Q,R] = qr(A); A = R*Q; end A
特征值计算算法(含matlab demo)