灰色关联度matlab源程序

标签:
灰色灰色关联度关联度matlab程序休闲 |
分类: 学习历程 |
灰色关联度matlab源程序
最近几天一直在写算法,其实网上可以下到这些算法的源程序的,但是为了搞懂,搞清楚,还是自己一个一个的看了,写了,作为自身的积累,而且自己的的矩阵计算类库也迅速得到补充,以后关于算法方面,基本的矩阵运算不用再重复写了,挺好的,是种积累,下面把灰关联的matlab程序与大家分享。
灰色关联度分析法是将研究对象及影响因素的因子值视为一条线上的点,与待识别对象及影响因素的因子值所绘制的曲线进行比较,比较它们之间的贴近度,并分别量化,计算出研究对象与待识别对象各影响因素之间的贴近程度的关联度,通过比较各关联度的大小来判断待识别对象对研究对象的影响程度。
关联度计算的预处理,一般初值化或者均值化,根据我的实际需要,本程序中使用的是比较序列与参考序列组成的矩阵除以参考序列的列均值等到的,当然也可以是其他方法。
%注意:由于需要,均值化方法采用各组值除以样本的各列平均值
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
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);
for (i=2:nrow)
end %find the difference squence and the max value and min value of
each squence
maxmax = max(maxarray)
minmin = min(minarray)
for(i=2:nrow)
end % calculate the greyralational degree of each data
for(i=2:nrow)
end
基于matlab灰色关联度计算的实现
2006年07月28日 星期五 上午 11:06
function r=incident_degree(x0,x1)
%compute the incident degree for grey model.
�signed by NIXIUHUI,Dalian Fisher University.
August,2004,Last modified by NXH at 21 August,2004
%
x0_initial=x0./x0(1);
temp=size(x1);
b=repmat(x1(:,1),[1 temp(2)]);
x1_initial=x1./b;
%分辨系数选择
K=0.1;
disp('The grey interconnect degree is: ');
x0_ext=repmat(x0_initial,[temp(1) 1]);
contrast_mat=abs(x0_ext-x1_initial);
delta_min=min(min(contrast_mat));�lta_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;
close all;
clc;
%载入源数据
n=15;
m=4;
X_0=zeros(n,m);
X_2=zeros(n,m);
X_3=zeros(n,m);
a1_0=[13 18 17 18 17 17 18 17 13 17 18 13 18 13
18];
a2_0=[18 18 17 17 18 13 17 13 18 13 17 13 13 17 17];
a3_0=[48.67 43.33 43.56 41.89 39.47 43.44 37.97 41.14 39.67 39.83
34.11 40.58 34.19 30.75 21.22];
a4_0=[10 10.7 3 5.4 5.4 0.7 4.2 0.5 9.3 0.85 2.9 5.45 4.2 2.7
6];
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)
end
%3
error_min=min(min(X_2));
error_max=max(max(X_2));
%4
计算相关系数
i=1;
p=0.5;
while(i~=m+1)
end
%X_3
%5
计算各个学生的关连序
a=zeros(1,n);
for j=1:1:n
%
end
%a
%改进:如果各个指标的所占权重不一样的话,可以添加相应的权系数
%6
排序
b=a';
[c,s]=sort(b);
for i=1:1:n
end
d=d';
result=[d b c s]
%7
将结果显示出来
figure(1);
plot(a);
figure(2)
bar(a);
图3 程序运行结果
图4
曲线图
图5
柱状图
根据以上的启示,我用matlab灰度关联分析的想法是:
1、参考序列我可以选择已知属于某一类神经元的统计数据,我选择平均值。
2、加入一个未知类的数据,与已有类中的数据一起计算他们与平均值的关联度。
3、计算出来的关联度我们可以有多种处理思路,如果未知类的关联度不是排在最末,可以认为它属于这一类,或者未知类的关联度大于计算出来的关联度平均值,我们可以认为它属于这一类。
参考文献:
[1] 郝海燕,王斌.大学生综合素质测评的灰色关联分析法[J].承德石油高等专科学校学报,2009,11(2):57-59.
请教一下用MATLAB实现灰色关联分析的程序
初始矩阵为x=[1.14 1.49 1.69 2.12 2.43 4.32 5.92 6.07 7.85;3.30 3.47 3.61 3.80 4.00 4.19 4.42 4.61 4.80;6.00 6.00 6.00 7.50 7.50 7.50 9.00 9.00 9.00;1.20 1.20 1.80 1.80 1.80 2.40 2.70 3.60 4.00;4.87 5.89 6.76 7.97 8.84 10.05 11.31 12.25 11.64]
我写的程序如下:
x1=[1.14 1.49 1.69 2.12 2.43 4.32 5.92 6.07 7.85;3.30 3.47 3.61 3.80 4.00 4.19 4.42 4.61 4.80;6.00 6.00 6.00 7.50 7.50 7.50 9.00 9.00 9.00;1.20 1.20 1.80 1.80 1.80 2.40 2.70 3.60 4.00;4.87 5.89 6.76 7.97 8.84 10.05 11.31 12.25 11.64]%原始数据5行9列
x1=x
for i=1:5
end
x1=x
for i=1:5
end
max=x(1,1)
min=x(1,1)
for i=1:5
end
for i=1:5
end
k=0.5 %分辨系数取值
l=(min+k*max)./(x+k*max)%求关联系数矩阵
但是运算错误!!!!
请教一下高手
问题补充:
楼下回答的不对,那样虽不会运行错误,但得不到正确的答案
怎么没人再给我回答啊555555555
其他回答 共1条
4.00;4.87 5.89 6.76 7.97 8.84 10.05 11.31 12.25 11.64]%原始数据5行9列
x1=x %有错,应该为 x=x1
for i=1:5