树状图
clear all
close all
clc
% load data set
bb= xlsread('sj');
xx1 = bb(:,1);
xx = bb(:,2:8);
s = int2str(xx1);
% euclidean distance matrix
d = pdist(xx,'euclidean');
% squared euclidean distance matrix
dd = d.^2;
% cluster analysis with ward algorithm
w = linkage(dd,'ward');
% Dendrogram for the 20 bank notes after Ward algorithm
figure(2)
[H,T] = dendrogram(w,0,'colorthreshold','default','labels',s); set(H,'LineWidth',2)
title('Dendrogram for 38 stccks','FontSize',14)
ylabel('Squared Euclidean Distance','FontSize',12)
xlabel('Ward algorithm')
box on