Calculates the iteration matrix and its eigenvalues arising from solving the system Ax = b iteratively by splitting A=B+C and Cx=-Bx+b. Input arguments: C, square matrix B, square matrix w, relaxation parameter (w=1 gives unrelaxed iterations) Output arguments: H, iteration matrix E, eigenvalues of the iteration matrix
0001 function [ H,E ] = iteration_analysis( C,B,w ) 0002 % Calculates the iteration matrix and its eigenvalues 0003 % arising from solving the system Ax = b iteratively 0004 % by splitting A=B+C and Cx=-Bx+b. 0005 % Input arguments: 0006 % C, square matrix 0007 % B, square matrix 0008 % w, relaxation parameter (w=1 gives unrelaxed iterations) 0009 % Output arguments: 0010 % H, iteration matrix 0011 % E, eigenvalues of the iteration matrix 0012 0013 [m,n]=size(C); % find the size of C 0014 if n~= m 0015 error('first input is not a square matrix'); 0016 end; 0017 [k,l]=size(B); % find the size of B 0018 if k~= l 0019 error('second input is not a square matrix'); 0020 end; 0021 if m~=k 0022 error('matrix dimensions do not agree'); 0023 end; 0024 0025 H=(1-w)*eye(n)-w*inv(C)*B; 0026 E=eig(H); 0027 0028 end 0029 0030