灰色关联度matlab源程序(完整版)

灰色关联度matlab源程序(完整版)

近几天一直在写算法,其实网上可以下到这些算法的源程序的,但是为了搞懂,搞清楚,还是自己一个一个的看了,写了,作为自身的积累,而且自己的的矩阵计算类库也迅速得到补充,以后关于算法方面,基本的矩阵运算不用再重复

写了,挺好的,是种积累,下面把灰关联的matlab程序与大家分享。

灰色关联度分析法是将研究对象及影响因素的因子值视为一条线上的点,与待识别对象及影响因素的因子值所绘制的曲线进行比较,比较它们之间的贴近度,并分别量化,计算出研究对象与待识别对象各影响因素之间的贴近程度的关联度,通过比较各关联度的大小来判断待识别对象对研究对象的影响程度。

简言之,灰色关联度分析的意义是指在系统发展过程中,如果两个因素变化的态势是一致的,即同步变化程度较高,则可以认为两者关联较大;反之,则两者关联度较小。因此,灰色关联度分析对于一个系统发展变化态势提供了量化的度量,非常适合动态(Dynamic)的历程分析。灰色关联度可分成“局部性灰色关联度”与“整体性灰色关联度”两类。主要的差别在于局部性灰色关联度有一参考序列,而整体性灰色关联度是任一序列均可为参考序列。关联度分析是基于灰色系统的灰色过程, 进行因素间时间序列的比较来确定哪些是影响大的主导因素, 是一种动态过程的研究。

关联度计算的预处理,一般初值化或者均值化,根据我的实际需要,本程序中使用的是比较序列与参考序列组成的矩阵除以参考序列的列均值等到的,当然也可以是其他方法。 %注意:由于需要,均值化方法采用各组值除以样本的各列平均值 clear;clc; yangben=[

47.924375 25.168125 827.4105438 330.08875 1045.164375 261.374375 16.3372 6.62 940.2824 709.2752 962.1284 84.874

55.69666667 30.80333333 885.21 275.8066667 1052.42 435.81 ]; %样本数据 fangzhen=[

36.27 14.59 836.15 420.41 1011.83 189.54 64.73 35.63 755.45 331.32 978.5 257.87

42.44 23.07 846 348.05 1025.4 296.69 59.34 39.7 794.31 334.63 1016.4 317.27 52.91 17.14 821.79 306.92 1141.94 122.04 4.21 4.86 1815.52 2584.68 963.61 0.00 6.01 2.43 1791.61 2338.17 1278.08 30.87 3.01 1.58 1220.54 956.14 1244.75 3.91 25.65 7.42 790.17 328.88 1026.01 92.82 115.80 27 926.5 350.93 1079.49 544.38 12.63 8.75 1055.50 1379.00 875.10 1.65 ]; %待判数据

[rows,cols]=size(fangzhen); p=0.5; %分辨系数 [m,n]=size(yangben); R=[];

for irow=1:rows yy=fangzhen(irow,:); data=[yy;yangben]; data_gyh1=mean(yangben) for i=1:m+1 for j=1:n

data_gyh(i,j)=data(i,j)/data_gyh1(j); end end

for i=2:m+1 for j=1:n

Dij(i-1,j)=abs(data_gyh(1,j)-data_gyh(i,j)); end end

Dijmax=max(max(Dij)); Dijmin=min(min(Dij)); for i=1:m for j=1:n

Lij(i,j)=(Dijmin+p*Dijmax)/(Dij(i,j)+p*Dijmax);

end end

LijRowSum=sum(Lij'); for i=1:m

Rij(i)=LijRowSum(i)/n; end R=[R;Rij]; end R

matlab求灰色关联度矩阵源代码

2010-12-11 22:57

function greyrelationaldegree(X,c)

%GRAYRELATIONALDEGREE this function is used for calculating the gery %relation between squence

%rememeber that the first column of the input matrix is the desicion %attribution squences.what we want to calculate is the grey ralational degree between

%it and other attributions

%X is the squence matrix, c is the parameter used in the function %in most of the time, the value of c is 0.5

firstrow = X(1,:);

reci_firstrow = 1./firstrow;

reci_convert = diag(reci_firstrow);

initialMIRROR = X*reci_convert;% find the initial value mirror of the sequce matrix

A = initialMIRROR'

[nrow,ncolumn] = size(A);

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4