function Q=AHP (A)
[M,n]=size (A);
Ri=[0 0 0.58 0.90 1.12 1.24 1.32 1.41 1.45 1.49 1.51];
R=rank (A); The rank of the Judgment matrix
[V,d]=eig (A); % to determine the eigenvalues and eigenvectors of the Matrix, v eigenvalues, D eigenvectors;
Tz=max (D);
B=max (TZ); % Maximum characteristic value
[Row, Col]=find (d==b); % Maximum Eigenvalue location
C=v (:, col); % corresponding feature vector
Ci= (b-n)/(n-1); % Calculation Consistency Test indicator CI
Cr=ci/ri (1,n);
If cr<0.10
Disp (' ci= ');d ISP (CI);
Disp (' cr= ');d ISP (CR);
Disp (' contrast matrix A through consistency test, each vector weight vector q is: ');
Q=zeros (n,1);
For I=1:n
Q (i,1) =c (i,1)/sum (C (:, 1)); % feature vector normalization
End
Else
Disp (' Contrast matrix A does not pass the conformance test, need to reconstruct ' the contrast matrix A ');
End
The above is written in M file, finally add a judgment matrix in the main interface, call the function method: AHP (A);