层次聚类之后如何得到新的中心点图。
이전 댓글 표시
各位大神,怎么做能将图中上面两个类各自只显示中心点。也就是红色的累两个点合成为一个点
clear,clc,close all
%导入数据
data = [1 0;2 0;3 5;4 8;5 15;6 0;7 0];
plot(data(:,1),data(:,2),'linestyle','none','marker','x')
%
close all
dis=pdist(data,'euclidean'); %用pdist函数计算变量之间的距离
SF =squareform(dis);
datalink = linkage(dis,'average'); %用 linkage函数定义变量之间的连接
%
% 绘制树状图
dendrogram(datalink);
%
T = cluster(datalink,'maxclust',3); %用cluster函数创建聚类
figure;
%绘制经过聚类的原始数据
gscatter(data(:,1),data(:,2),T)

채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!