灰色关联分析 |
|
clear;clc;
%% 数据处理
%取数据
[~,~,rawdata] = xlsread(‘详细数据.xlsx’,1,’C2:L481′);%读取数据
rawdata = cell2mat(rawdata);
power = rawdata(:,1);
% windspeed = rawdata(:,2);
% airpressure = rawdata(:,3);
% winddirection = rawdata(:,4);
% tempreture = rawdata(:,5);
% humidity = rawdata(:,6);
% windspeedground = rawdata(:,7);
% %总辐射(GHI,Global Horizontal Irradiance)
% GHI = rawdata(:,8);
% %DNI,Direct Normal Irradiance
% DNI = rawdata(:,9);
% %散射辐射(DHI,Diffuse Horizontal Irradiance)
% DHI = rawdata(:,10);
r = size(rawdata,1);
c = size(rawdata,2);
X0 = rawdata(:,2:c);
Y = power’;
X = X0′;
%数据关联度
%归一化
[Y1,FSY] = mapminmax(Y,0,1);
[X1,FSX] = mapminmax(X,0,1);
Y1 = Y1′; X1 = X1′;
Y11 = repmat(Y1,1,c-1);
absY11_X1 = abs(Y11 – X1);
minmin = min(min(absY11_X1));
maxmax = max(max(absY11_X1));
ro = 0.5;
gamma = mean((minmin + ro * maxmax)./(absY11_X1 + ro * maxmax));
disp(‘相关系数为:’);
gamma
[gammasorted, I] = sort(gamma);
for i=1:size(I,2)
X0sorted(:,i) = X0(:,I(i));
end
数据链接(无需积分付费)
https://download.csdn.net/download/m0_46218732/85845932