将相似的属性聚合在一起
clc, clear; % a = load('E:a-建模《数学建模算法与应用》课件资源数学建模算法与应用程序及数据10第10章gj.txt'); a = xlsread('E:a-建模第六轮结果附件2.汽泵前置泵部分监测数据.xls', 2,'J3:P3602'); % a = xlsread('E:a-建模第六轮结果附件3.汽轮机本体部分监测数据.xlsx', 2,'A17:X5937'); % a = xlsread('E:a-建模第六轮结果附件4.一次风机部分监测数据.xls', 2,'L21:P3411'); b = zscore(a); %标准化 r = corrcoef(b); %计算相关系数矩阵 d = pdist(b', 'correlation'); %计算相关系数导出距离方法 z=linkage(d,'average'); %按类平均法聚类 h = dendrogram(z); %画聚类图 set(h,'Color','k','LineWidth',1.3) %把聚类图线的颜色改成黑色,线宽加粗 xlabel('类别'); % title('气泵前置部分'); % title('汽轮机本体部分'); title('一次风机部分'); ff = 4; %分成类的数量,先用总数运行观察有几类,在来修改这个值 T = cluster(z, 'maxclust', ff); for i = 1:ff tm=find(T==i); %求第i类的对象 tm=reshape(tm,1,length(tm)); %变成行向量 fprintf('第%d类的有%s ',i,int2str(tm)); %显示分类结果 end