1.熵权系数法matlab

A=[40    84    4800000    213853928    4017615739    78400000
100    37    3485750    111573116    4090207204    438154449.3
70    54    22111578    26203800    4941825082    802000000
40    38    18574476    16400734    5114949044    490134571.3
215    114    41814571    39522425    5456405468    1200000000
90.1    141    14005808    44307038    5538427424    2227000000
70    160    10128204    9474070    5935741324    2000000000
160    172    18000000    82797400    6088683554    4819049
173    125    22049544    127417244    6469129736    3300000000
59.5    60    8000000    40491051    6700765879    1700000000
528    246    73084400    1347514000    6853019414    4241035120
];
[n,m]=size(A);
yj_max=max(A)
for j=1:m
    for i=1:n
        A2(i,j)=A(i,j)/yj_max(j);
    end
end
sum_A2=sum((sum(A2))');
for j=1:m
    for i=1:n
        d_ij(i,j)=A2(i,j)/sum_A2;
    end
end
d_j=sum(d_ij);
for j=1:m
    for i=1:n
        E_ij(i,j)=-d_ij(i,j)/d_j(j)*log(d_ij(i,j)/d_j(j));
    end
end
E_j=sum(E_ij);
e_j=-1/log(m).*E_j;
theta_j=(1-e_j)./(sum(1-e_j))
for i=1:n
    for j=1:m
        w(i,j)=theta_j(j)*A2(i,j);
    end
end
w_i=sum(w')%最终得分

 2.层次分析法

clc;clear all
A=[1 1/5 1/3
    5 1 3
    3 1/3 1];
sum3=0;
[n,n]=size(A);
sum1=sum(A);
for j=1:n
    for i=1:n
    A2(i,j)=A(i,j)/sum1(j);
    end
end
A2(i,j);
sum2=sum(A2');
sum22=sum(sum2);
W=sum2./sum22;
W=W'
AW=A*W;
for i=1:n
    sum3=sum3+AW(i)/W(i);
end
lambda=1/n*sum3;   
%一致性检验  
CI=(lambda-n)/(n-1);
RI=[0 0 0.52 0.89 1.12 1.26 1.36 1.41 1.46 1.49 1.52 1.54 1.56 1.58 1.59];  
CR=CI/RI(n)

 

posted on 2016-01-21 20:42  planet  阅读(2445)  评论(0编辑  收藏  举报