灰色关联度matlab源程序完整版整理精品范本文档格式.docx
《灰色关联度matlab源程序完整版整理精品范本文档格式.docx》由会员分享,可在线阅读,更多相关《灰色关联度matlab源程序完整版整理精品范本文档格式.docx(16页珍藏版)》请在冰豆网上搜索。
16。
33726。
62940。
2824709。
2752962。
128484.874
55。
6966666730。
80333333885。
21275。
80666671052。
42435。
81
];
%样本数据
fangzhen=[
36。
2714.59836.15420.411011。
83189。
54
64。
7335.63755.45331。
32978.5257.87
42。
4423.07846348.051025。
4296.69
59.3439.7794.31334.631016。
4317。
27
52。
9117.14821.79306.921141.94122.04
4。
214.861815.522584.68963。
610.00
6。
012.431791。
612338。
171278。
0830。
87
3。
011。
581220。
54956。
141244.753。
91
25。
657。
42790.17328.881026.0192.82
115.8027926.5350。
931079.49544。
38
12.638。
751055。
501379.00875。
101.65
];
%待判数据
[rows,cols]=size(fangzhen);
p=0。
5;
%分辨系数
[m,n]=size(yangben);
R=[];
forirow=1:
rows
yy=fangzhen(irow,:
);
data=[yy;
yangben];
data_gyh1=mean(yangben)
fori=1:
m+1
forj=1:
n
data_gyh(i,j)=data(i,j)/data_gyh1(j);
end
fori=2:
Dij(i—1,j)=abs(data_gyh(1,j)-data_gyh(i,j));
Dijmax=max(max(Dij));
Dijmin=min(min(Dij));
m
forj=1:
Lij(i,j)=(Dijmin+p*Dijmax)/(Dij(i,j)+p*Dijmax);
LijRowSum=sum(Lij'
Rij(i)=LijRowSum(i)/n;
R=[R;
Rij];
end
R
matlab求灰色关联度矩阵源代码
2010—12-1122:
57
functiongreyrelationaldegree(X,c)
%GRAYRELATIONALDEGREEthisfunctionisusedforcalculatingthegery
%relationbetweensquence
%rememeberthatthefirstcolumnoftheinputmatrixisthedesicion
%attributionsquences。
whatwewanttocalculateisthegreyralationaldegreebetween
%itandotherattributions
%Xisthesquencematrix,cistheparameterusedinthefunction
%inmostofthetime,thevalueofcis0.5
firstrow=X(1,:
reci_firstrow=1。
/firstrow;
reci_convert=diag(reci_firstrow);
initialMIRROR=X*reci_convert;
%findtheinitialvaluemirrorofthesequcematrix
A=initialMIRROR'
[nrow,ncolumn]=size(A);
for(i=2:
nrow)
C=A(i,:
)—A(1,:
)
D=abs(C);
eval(['
B’num2str(i)’=D'
]);
amax=max(eval([’B'
num2str(i)]))
amin=min(eval([’B'
num2str(i)]))
maxarray(i—1)=amax
minarray(i-1)=amin
end%findthedifferencesquenceandthemaxvalueandminvalueofeachsquence
maxmax=max(maxarray)
minmin=min(minarray)
for(i=2:
for(j=1:
ncolumn)
eval([’greyrelationdegree’num2str(i)'
(j)=(minmin+c*maxmax)/(B’num2str(i)'
(j)+c*maxmax)'
])
end%calculatethegreyralationaldegreeofeachdata
eval(['
greyrelatioanaldegree_value’num2str(i)’=mean(greyrelationdegree'
num2str(i)'
)’
])
基于matlab灰色关联度计算的实现
2006年07月28日星期五上午11:
06
functionr=incident_degree(x0,x1)
%computetheincidentdegreeforgreymodel.
%DesignedbyNIXIUHUI,DalianFisherUniversity。
%17August,2004,LastmodifiedbyNXHat21August,2004
%数据初值化处理
x0_initial=x0./x0
(1);
temp=size(x1);
b=repmat(x1(:
1),[1temp
(2)]);
x1_initial=x1。
/b;
%分辨系数选择
K=0.1;
disp(’Thegreyinterconnectdegreeis:
'
);
x0_ext=repmat(x0_initial,[temp
(1)1]);
contrast_mat=abs(x0_ext—x1_initial);
delta_min=min(min(contrast_mat));
%delta_min在数据初值化后实际为零
delta_max=max(max(contrast_mat));
a=delta_min+K*delta_max;
incidence_coefficient=a。
/(contrast_mat+K*delta_max);
%得到关联系数
r=(sum(incidence_coefficient’))’/temp
(2);
%得到邓氏面积关联度
我们根据图1的步骤和图2的数据进行编程实现,程序如下:
%清除内存空间等
clear;
closeall;
%载入源数据
%其实这里可以载入execl表格的
n=15;
%参与评价的人数
m=4;
%参与评价的指标个数
X_0=zeros(n,m);
%
数据矩阵
X_2=zeros(n,m);
%偏差结果的求取矩阵
X_3=zeros(n,m);
%
相关系数计算矩阵
a1_0=[131817181717181713171813181318];
a2_0=[181817171813171318131713131717];
a3_0=[48.6743。
3343.5641。
8939。
4743.4437。
9741。
1439.6739。
8334。
1140.5834.1930.7521.22];
a4_0=[1010。
735.45。
40。
74。
20.59.30。
852。
95.454。
22。
76];
%指标数
X_1=[a1_0’,a2_0’,a3_0’,a4_0’];
%最后使用到的数据矩阵
%1寻找参考列
x0=[max(a1_0),max(a2_0),max(a3_0),max(a4_0)];
%取每列的最大值(指标的最大值)
%2计算偏差结果
i=1;
while(i~=m+1)
%为什么这个地方会出问