层次聚类之后如何得到新的中心点图。
Show older comments
各位大神,怎么做能将图中上面两个类各自只显示中心点。也就是红色的累两个点合成为一个点
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)

Accepted Answer
More Answers (0)
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!