topsis评价法程序

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

topsis评价法程序functiony=Topsis1(A,ave,m)%ave:元素的平均值。m:背景值范围min~max。y=D_count(A);rr=A(:,6:13);r=zeros(5,8);I=zeros(5,8);sum=zeros(1,5);fori=1:5ifi==1a=1;b=y(i);elsea=y(i-1)+1;b=y(i);endforj=1:8fork=a:bI(i,j)=I(i,j)+rr(k,j)/(avg(j)*(b-a+1));endendendfori=1:5forj=1:8sum(i)=sum(i)+I(i,j);endendfori=1:5%权重forj=1:8w(i,j)=I(i,j)/sum(i);endendfori=1:5ifi==1a=1;b=y(i);elsea=y(i-1)+1;b=y(i);endforj=a:bfork=1:8ifrr(j,k)m(k,1)rr(j,k)=abs(rr(j,k)-m(k,1));elseifrr(j,k)m(k,2)rr(j,k)=abs(rr(j,k)-m(k,2));elserr(j,k)=0;endr(i,k)=r(i,k)+rr(j,k);%先加起来再取平均endendfork=1:8r(i,k)=r(i,k)/(b-a+1);endendfori=1:5forj=1:8if(max(r(:,j))-min(r(:,j)))==0x(i,j)=inf;elsex(i,j)=(r(i,j)-min(r(:,j)))/(max(r(:,j))-min(r(:,j)));endendendfori=1:5forj=1:8z(i,j)=w(i,j)*x(i,j);endendforj=1:8z_inter(j)=min(z(:,j));z_neg(j)=max(z(:,j));endfori=1:5sum1=0;sum2=0;forj=1:8sum1=sum1+(z(i,j)-z_inter(j))^2;sum2=sum2+(z(i,j)-z_neg(j))^2;endd_inter(i)=sqrt(sum1);d_neg(i)=sqrt(sum2);endfori=1:5y(i)=d_inter(i)/(d_inter(i)+d_neg(i));end

1 / 4
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功