1、求权重程序A = 1,1/3,3,1;3,1,7,3;1/3,1/7,1,1/5;1,1/3,5,1;%求得x为特征向量矩阵,y为特征值矩阵x,y = eig(A);%找到y中对应最大的特征值所在列mmaxy, m = find(y=max(max(y);% w即为矩阵A的权重!w = x(:,m)/sum(x(:,m)结果:w = 0.18810.53470.05970.2175求最大特征值b=1,1/3,3,1;3,1,7,3;1/3,1/7,1,1/5;1,1/3,5,1v,d=eig(b)r=abs(sum(d);n=find(r=max(r);max_d_b=d(n,n) %最大特征
2、根max_v_b=v(:,n) %最大特征根所对应的特征向量结果:b = 1.0000 0.3333 3.0000 1.00003.0000 1.0000 7.0000 3.00000.3333 0.1429 1.0000 0.20001.0000 0.3333 5.0000 1.0000v =0.3083 -0.4859 -0.1383 - 0.0804i -0.1383 + 0.0804i0.8765 0.8503 -0.8693 -0.86930.0979 0.0000 0.0514 + 0.1126i 0.0514 - 0.1126i0.3565 0.2024 0.3162 - 0.3216i 0.3162 + 0.3216id =4.0571 0 0 00 -0.0000 0 00 0 -0.0285 + 0.4804i 00 0 0 -0.0285 - 0.4804imax_d_b = 4.0571最大特征根max_v_b =最大特征根所对应的特征向量0.30830.87650.09790.3565