您好,欢迎访问三七文档
clear;clc;A=[101010100];B=[0.50.20.3];[m,n]=size(A);C=zeros(m,n);fori=1:nC(:,i)=A(:,i)-B(i);End变权A=[]B=[][n,m]=size(A)fori=1:mA(:,i)=A(:,i)/norm(A(:,i))endfori=1:nC(i,:)=A(i,:).*BendD=sum(C,2)fori=1:mF(:,i)=A(:,i)-DendG=F+1fori=1:nH(i,:)=G(i,:).*BendM=A.*HN=sum(M,2)关联系数法(MATLAB代码)A=[]B=[]p=0.5[n,m]=size(A)fori=1:nD(i,:)=A(i,:).*BendV0=sum(D,2)fori=1:nforj=1:mC(i,j)=abs(A(i,j)-V0(i))endendrmin=min(min(C))rmax=max(max(C))fori=1:nforj=1:mE(i,j)=(rmin+p*rmax)/(C(i,j)+p*rmax)endend[n,m]=size(A)fori=1:nR(i,:)=A(i,:).*BE(i,:)=R(i,:).*CendF=sum(E,2)fori=1:nforj=1:mU(i,j)=E(i,j)./F(i)endendG=A.*UH=sum(G,2)评价共识度[n,m]=size(L)fori=1:mforj=1:mY(i,j)=dot(L(:,i),L(:,j))/(norm(L(:,i))*norm(L(:,j)))endendq=(sum(Y(:))-m)/(m*(m-1))fori=1:mX(i,:)=(sum(Y,2)-1)/(m-1)end[n,m]=size(A)fori=1:nC(i,:)=A(i,:).*BendD=sum(C,2)求矩阵方差[n,m]=size(A)fori=1:nC(i,:)=var(A(i,:))endW1=(1./(C+1))/(sum(1./(C+1)))W=0.7*B+0.3.*W1[n,m]=size(A)fori=1:nC(i,:)=0.6*B+0.4*A(i,:)end[n,m]=size(A)dot(A,B)/(norm(A)*norm(B))[n,m]=size(A)C=A.*BD=sum(C,2)fori=1:mF(:,i)=D-A(:,i)endG=F+1H=G.*B熵权法[n,m]=size(A)fori=1:mA(:,i)=A(:,i)/norm(A(:,i))endR=A[rows,cols]=size(R)fori=1:colsR(:,i)=R(:,i)/norm(R(:,i))endk=1/log(rows)f=zeros(rows,cols)sumBycols=sum(R,1)fori=1:rowsforj=1:colsf(i,j)=R(i,j)/sumBycols(1,j)endendlnfij=zeros(rows,cols)fori=1:rowsforj=1:colsiff(i,j)==0lnfij(i,j)=0elselnfij(i,j)=log(f(i,j))endendendhj=-k*(sum(f.*lnfij,1))weights=(1-hj)/sum(1-hj)相对熵n=length(x)f=zeros(1,n)fori=1:nf(i)=x(i).*log(x(i)./y(i))endg=sum(f,2)专家变权A=[]B=[][n,m]=size(A)fori=1:nC(i,:)=A(i,:).*BendD=sum(C,2)fori=1:mF(:,i)=abs(D-A(:,i))endG=max(F,[],2)fori=1:mH(:,i)=G-0.2*F(:,i)endfori=1:nI(i,:)=H(i,:).*Bendfori=1:nM(i,:)=F(i,:).*BendN=G-0.2*sum(M,2)fori=1:mW(:,i)=I(:,i)./NendO=A.*WP=sum(O,2)[n,m]=size(A)C=A.*BD=sum(C,2)fori=1:mF(:,i)=abs(D-A(:,i))endG=max(F,[],2)fori=1:mH(:,i)=G-0.2*F(:,i)endI=H.*BM=F.*BN=G-0.2*sum(M,2)fori=1:mW(:,i)=I(:,i)./Nend[m,n]=size(A)fori=1:nforj=1:mf(i)=x(i).*log(x(i)./y(i))[m,n]=size(A)fori=1:nA(:,i)=A(:,i)/norm(A(:,i))end[rows,cols]=size(R)maxR=max(R,[],1)fori=1:rowsforj=1:colsR(i,j)=R(i,j)/maxR(j)endendfori=1:rowsR(i,:)=R(i,:)/norm(R(i,:))end偏离权重[n,m]=size(A)fori=1:nC(i,:)=A(i,:).*BendD=sum(C,2)fori=1:mF(:,i)=(D-A(:,i)).^2endE=sum(F,2)偏好距离求权重[n,m]=size(A)B=prod(A,2).^(1/m)C=sum(B)D=B/Cfori=1:mF(:,i)=(D-A(:,i)).^2endE=sum(F,1)W=(1./E)./(sum(1./E))群体一致度[n,m]=size(A)fori=1:mB=bsxfun(@minus,A(:,i),A(:,i)')C=B.^2D=1/2*(sum(sum(C))).^(1/2)endW=(1./D)/(sum(1./D))一致性检验A=[][x,y]=eig(A)Jmax=max(max(y))[n,m]=size(A)RI=[000.580.901.121.241.321.411.451.491.51]CI=(Jmax-n)./(n-1)CR=CI./RI(1,n)自适应权重A=[]B=[]D1=[]R=0[n,m]=size(A)C=A.*BD=sum(C,2)D2=(sum((D-D1).^2)).^(1/2)while(D20.001)fori=1:mF(:,i)=abs(D-A(:,i))endG=max(F,[],2)fori=1:mH(:,i)=G-0.2*F(:,i)endI=H.*BM=F.*BN=G-0.2*sum(M,2)fori=1:mW(:,i)=I(:,i)./NendB=WD1=DR=R+1C=A.*BD=sum(C,2)D2=(sum((D-D1).^2)).^(1/2)End从评价的目标来看,用若干个指标或若干评价个体进行综合评价时,其对各被评价对象的作用并不是相同的,为了体现各评价指标或各评价个体在评价过程中的重要程度,在指标体系确定后,必须对各指标赋予不同的权重系数。
本文标题:matlab代码
链接地址:https://www.777doc.com/doc-8693190 .html