matlab-kmeans函数注释X=[randn(100,2)+ones(100,2);...randn(100,2)-ones(100,2)];产生100个样本点,行指向每个样本,列是维变量值。opts=statset('Display','final');[idx,ctrs]=kmeans(X,2,'Distance','city','Replicates',5,'Options',opts);%返回参数意义:[IDX,C,sumd,D]=kmeans()IDX:每个样本点所在的类别C:所聚类别的中心点坐标位置k*p,k是所聚类别sumd:每个类内各点到中心点的距离之和D:每个点到各类中心点的距离n*kMatlab聚类分析中kmeans函数运行结果,请教为什么?k=5;[IDX,C,sumd,D]=kmeans(SCORE(:,1:3),k);我想把主成份分析后的结果SCORE(:,1:3),大小为89*3,聚成5类,我的理解的运行结果应该是:IDX是1~5的整数,表示归到了那一类;C是每一类的质心位置,大小是5*3;sumd是每一类中各点到质心的距离和,大小是1*5;D是每个点到质心的位置,大小是89*1ExamplesThefollowingcreatestwoclustersfromseparatedrandomdata:X=[randn(100,2)+ones(100,2);...randn(100,2)-ones(100,2)];opts=statset('Display','final');[idx,ctrs]=kmeans(X,2,...'Distance','city',...'Replicates',5,...'Options',opts);5iterations,totalsumofdistances=284.6714iterations,totalsumofdistances=284.6714iterations,totalsumofdistances=284.6713iterations,totalsumofdistances=284.6713iterations,totalsumofdistances=284.671plot(X(idx==1,1),X(idx==1,2),'r.','MarkerSize',12)holdonplot(X(idx==2,1),X(idx==2,2),'b.','MarkerSize',12)plot(ctrs(:,1),ctrs(:,2),'kx',...'MarkerSize',12,'LineWidth',2)plot(ctrs(:,1),ctrs(:,2),'ko',...'MarkerSize',12,'LineWidth',2)legend('Cluster1','Cluster2','Centroids',...'Location','NW')