《五种灰色关联度分析matlab代码(4页).docx》由会员分享,可在线阅读,更多相关《五种灰色关联度分析matlab代码(4页).docx(4页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、-五种灰色关联度分析matlab代码-第 4 页灰色邓氏关联度分析% P12 - The Study on the Grey Relational Degree and Its Application function r1 = gld_deng(x)s = size(x);len = s(2);num = s(1);ro = 0.5;for i = 1: num x(i,:) = x(i,:)./x(i,1);enddx(num,len) = 0;for i = 2 : num for k = 1 : len dx(i,k) = abs(x(1,k) - x(i,k); endendmax_
2、dx = max(max(dx);min_dx = min(min(dx);r(1,1:len-1) = 1;for i = 2 : num for k = 1 : len r(i,k) = (min_dx + ro*max_dx)/(dx(i,k) + ro*max_dx); endendr1 = sum(r(2:num,:),2)/(len);改进灰色绝对关联度分析% P11 - The Study on the Grey Relational Degree and Its Application function r1 = gld_gjjd(x)s = size(x);len = s(2
3、);num = s(1);for i = 1: num x(i,:) = x(i,:)./x(i,1);enddx(num,len-1) = 0;for i = 1 : num for j = 1 : len - 1 dx(i,j) = x(i,j+1) - x(i,j); endendc = 1;beta(1,1:len-1) = 0;w(1,1:len-1) = 0;for i = 2 : num temp = sum(abs(x(i,:) - x(1,:),2); for k = 1 : len - 1 beta(i,k) = atan(dx(i,k) - dx(1,k)/(1 + dx
4、(i,k)*dx(1,k); if beta(i,k) 0 beta(i,k) = pi + beta(i,k); end w(i,k) = 1 - abs(x(i,k) - x(1,k)/temp; endendr = c./(c + tan(beta./2);wr = w.*r;r1 = sum(wr(2:num,:),2)/(len - 1);灰色绝对关联度分析% P18 - The Study on the Grey Relational Degree and Its Application function r1 = gld_jd(x)s = size(x);len = s(2);n
5、um = s(1);for i = 1: num x(i,:) = x(i,:)./x(i,1);enddx(num,len-1) = 0;for i = 1 : num for j = 1 : len - 1 dx(i,j) = x(i,j+1) - x(i,j); endendr(1,1:len-1) = 1;for i = 2 : num for k = 1 : len - 1 r(i,k) = 1/(1 + abs(dx(1,k) - dx(i,k); endendr1 = sum(r(2:num,:),2)/(len - 1);灰色T型关联度分析% P19 - The Study o
6、n the Grey Relational Degree and Its Application function r1 = gld_t(x)s = size(x);len = s(2);num = s(1);dx(num,len-1) = 0;for i = 1 : num for j = 1 : len - 1 dx(i,j) = abs(x(i,j+1) - x(i,j); end d_x = sum(dx(i,:),2)/(len - 1); x(i,:) = x(i,:)./d_x;enddx(num,len-1) = 0;for i = 1 : num for j = 1 : le
7、n - 1 dx(i,j) = x(i,j+1) - x(i,j); endendr(1,1:len-1) = 1;for i = 2 : num for k = 1 : len - 1 if dx(1,k)*dx(i,k) = 0 r(i,k) = sign(dx(1,k)*dx(i,k); else r(i,k) = sign(dx(1,k)*dx(i,k)*min(abs(dx(1,k),abs(dx(i,k) / max(abs(dx(1,k),abs(dx(i,k); end endendr1 = sum(r(2:num,:),2)/(len - 1);灰色斜率关联度分析% P20
8、- The Study on the Grey Relational Degree and Its Application function r1 = gld_xl(x)s = size(x);len = s(2);num = s(1);for i = 1: num x(i,:) = x(i,:)./x(i,1);enddx(num,len-1) = 0;for i = 1 : num for j = 1 : len - 1 dx(i,j) = x(i,j+1) - x(i,j); endendr(1,1:len-1) = 1;for i = 2 : num for k = 1 : len - 1 r(i,k) = 1/(1 + abs(dx(1,k)/x(1,k+1) - dx(i,k)/x(i,k+1); endendr1 = sum(r(2:num,:),2)/(len - 1);