www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ClusteringIllustrationExample.m

    %% Clustering Illustration
%%
% Consider R.A. Fisher's famous iris data set. The input matrix
% contains four features (petal and sepal lengths and widths) measured on
% 50 irises, and the response is one of three iris species. For
% illustration, ignore the species, and the sepal lengths and widths.
%%
% Load the data set.

% Copyright 2015 The MathWorks, Inc.

load fisheriris
X = meas(:,3:4);
%%
% Plot the petal lengths and widths.
plot(X(:,1),X(:,2),'.');
xlabel('Petal length (cm)');
ylabel('Petal width (cm)');
title('{\bf Iris Petal Lengths and Widths}');
%%
% Does the plot suggest that there are grouped irises with respect to
% similar petal lengths and widths?  Clustering addresses this question.