x(1,:)=[830.19112.97.289.40.4326.33];x(2,:)=[750.18911.69.182.30.4535.87];x(3,:)=[640.16511.910.369.30.5126.31];%列出各数值,可修改x(4,:)=[630.16512.89.768.20.4556.6];x(5,:)=[560.21113.212.677.50.3177.12];m=5;n=7;x0=[830.21113.27.289.40.3175.87];%参考序列fori=1:navg(i)=0;%均值初始化endfori=1:mforj=1:navg(j)=avg(j)+x(i,j);endend%求均值序列fori=1:navg(i)=avg(i)/m;endforj=1:mfori=1:nx(j,i)=x(j,i)/avg(i);%均值化endendfori=1:nx0(i)=x0(i)/avg(i);%参考序列均值化endforj=1:mfori=1:ndelta(j,i)=abs(x(j,i)-x0(i));%求序列差endendmax=delta(1,1);forj=1:mfori=1:nifdelta(j,i)maxmax=delta(j,i);endendend%求两极差min=0;forj=1:mxgd(j)=0;fori=1:nglxs(j,i)=0.5*max/(0.5*max+delta(j,i));%计算关联系数及相关度xgd(j)=xgd(j)+glxs(j,i);endxgd(j)=xgd(j)/n;endxgd%因此,A—E区与参考序列(最佳指标)的相关度分别为0.84890.69830.55880.58580.7105