clc;clear all;close all;%清空环境
%step1确定评价对象,建立评价指标体系,构造指标水平矩阵
x=[35,50,50,2,40,160;
75,150,150,4,80,200;
115,250,475,14,180,300;
150,350,800,24,280,400];
[rows,cols]=size(x); % 输入矩阵的大小,rows为对象个数,cols为指标个数
%step2
xmin = min(x);
xmax = max(x);
A = max(x) - min(x);%
y = x - repmat(xmin,rows,1);%
for j = 1 : size(y,2);
y(:,j) = y(:,j)/A(j);%
end
%step3
S = sum(y,1);
Y = zeros(rows,cols);
for i = 1 : size(Y,2);
Y(:,i) = y(:,i)/S(i);
end
lnYij=zeros(rows,cols); %
for i=1:rows
for j=1:cols
if Y(i,j)==0
lnYij(i,j)=0;
else
lnYij(i,j)=log(Y(i,j));
end
end
end
k=1/log(rows); %
Hj=-k*(sum(Y.*lnYij,1)); %
%step4
w=(1-Hj)/(cols-sum(Hj))%
%step5
F = zeros(rows,cols);
for k = 1 : size(x,2);
F(:,k) = w(k)*y(:,k);
end
format long%
F = sum(F,2); %