1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| A = [1 2 4 2; 1/2 1 3 2; 1/4 1/3 1 1/3; 1/2 1/2 3 1];
B1 = [1 4 6; 1/4 1 2; 1/6 1/2 1]; B2 = [1 2 3; 1/2 1 2; 1/3 1/2 1]; B3 = [1 8 1; 1/8 1 1/9; 1 9 1]; B4 = [1 2 4; 1/2 1 3; 1/4 1/3 1];
[V2, D2] = eig(A); W2 = V2(:, 1) / sum(V2(:, 1)); lambda2 = D2(1, 1);
CI2 = (lambda2 - size(A, 1)) / (size(A, 1) - 1); RI = [0 0 0.58 0.90 1.12 1.24 1.32 1.41 1.45 1.49]; CR2 = CI2 ./ RI(size(A, 1)); if CR2 < 0.1 disp('准则层一致性检验通过'); CR2 else error('准则层一致性检验不通过'); end
[V3_1, D3_1] = eig(B1); [V3_2, D3_2] = eig(B2); [V3_3, D3_3] = eig(B3); [V3_4, D3_4] = eig(B4); W3_1 = V3_1(:, 1) / sum(V3_1(:, 1)); W3_2 = V3_2(:, 1) / sum(V3_2(:, 1)); W3_3 = V3_3(:, 1) / sum(V3_3(:, 1)); W3_4 = V3_4(:, 1) / sum(V3_4(:, 1)); lambda3_1 = D3_1(1, 1); lambda3_2 = D3_2(1, 1); lambda3_3 = D3_3(1, 1); lambda3_4 = D3_4(1, 1);
lambda3 = [lambda3_1 lambda3_2 lambda3_3 lambda3_4]; CI3 = (lambda3 - size(B1, 1)) ./ (size(B1, 1) - 1); CR3 = CI3 ./ RI(size(B1, 1)); if CR3 < 0.1 disp('方案层一致性检验通过'); CR3 else error('方案层一致性检验不通过'); end
CR = CR2 + CR3 * W2; if CR < 0.1 disp('组合一致性检验通过'); CR else error('组合一致性检验不通过'); end
W3 = [W3_1 W3_2 W3_3 W3_4]; W = W3 * W2;
disp('最终权向量为:'); W
|