不是负值问题,而是你没有算完.
例如
A=[1 1/4 5 3 1/4 2;4 1 5 1/4 2 1/5;1/5 1/5 1 1/5 3 1/5;1/3 4 5 1 3 1;4 1/2 1/3 3 1 1/5;1/2 5 5 1 5 1];
中用MATLAB运算
[x,y]=eig(A)
得
x =
-0.3933 0.5545 0.5545 -0.1418 - 0.1176i -0.1418 + 0.1176i 0.2080
-0.3736 -0.1312 - 0.1778i -0.1312 + 0.1778i -0.6244 -0.6244 0.0829
-0.1632 -0.2014 + 0.1217i -0.2014 - 0.1217i 0.1608 - 0.3796i 0.1608 + 0.3796i -0.2020
-0.4591 -0.0045 + 0.3640i -0.0045 - 0.3640i -0.1243 + 0.3315i -0.1243 - 0.3315i -0.3294
-0.3682 -0.0144 - 0.4490i -0.0144 + 0.4490i 0.3175 + 0.2812i 0.3175 - 0.2812i 0.0034
-0.5769 -0.2119 + 0.4574i -0.2119 - 0.4574i 0.0765 + 0.3084i 0.0765 - 0.3084i 0.8948
y =
9.9809 0 0 0 0 0
0 -1.6706 + 4.4342i 0 0 0 0
0 0 -1.6706 - 4.4342i 0 0 0
0 0 0 -0.3707 + 2.6609i 0 0
0 0 0 0 -0.3707 - 2.6609i 0
0 0 0 0 0 0.1016
得x为特征向量矩阵 y为特征值矩阵
找到y中对应最大的特征值所在列m
w=x(:,m)/sum(x(:,m))
w就是权重!
w=x(:,1)/sum(x(:,1))
运算程序
>> A=[1 1/4 5 3 1/4 2;4 1 5 1/4 2 1/5;1/5 1/5 1 1/5 3 1/5;1/3 4 5 1 3 1;4 1/2 1/3 3 1 1/5;1/2 5 5 1 5 1];
>> [x y]=eig(A)
x =
-0.3933 0.5545 0.5545 -0.1418 - 0.1176i -0.1418 + 0.1176i 0.2080
-0.3736 -0.1312 - 0.1778i -0.1312 + 0.1778i -0.6244 -0.6244 0.0829
-0.1632 -0.2014 + 0.1217i -0.2014 - 0.1217i 0.1608 - 0.3796i 0.1608 + 0.3796i -0.2020
-0.4591 -0.0045 + 0.3640i -0.0045 - 0.3640i -0.1243 + 0.3315i -0.1243 - 0.3315i -0.3294
-0.3682 -0.0144 - 0.4490i -0.0144 + 0.4490i 0.3175 + 0.2812i 0.3175 - 0.2812i 0.0034
-0.5769 -0.2119 + 0.4574i -0.2119 - 0.4574i 0.0765 + 0.3084i 0.0765 - 0.3084i 0.8948
y =
9.9809 0 0 0 0 0
0 -1.6706 + 4.4342i 0 0 0 0
0 0 -1.6706 - 4.4342i 0 0 0
0 0 0 -0.3707 + 2.6609i 0 0
0 0 0 0 -0.3707 - 2.6609i 0
0 0 0 0 0 0.1016
>> w=x(:,1)/sum(x(:,1))
w =
0.1685
0.1601
0.0699
0.1967
0.1577
0.2471
W为最终结果