Error clustering to k mean

1 回表示 (過去 30 日間)
Lev Mihailov
Lev Mihailov 2019 年 8 月 8 日
コメント済み: Lev Mihailov 2019 年 8 月 8 日
A= [X1;X2];
[IDX,C,sumd,D] = kmeans(A,2,'display','iter'); %%% Error using kmeans (line 269)
%X must have more rows than the number of clusters.
%Error in Untitled (line 2)
[IDX,C,sumd,D] = kmeans(A,4,'display','iter');
figure(1)
subplot(2,1,1)
plot(A(:,1),A(:,2),'.')
subplot(2,1,2)
plot(A(IDX==1,1),A(IDX==1,2),'r.','MarkerSize',12);
hold on
plot(A(IDX==2,1),A(IDX==2,2),'b.','MarkerSize',12);
hold on
plot(A(IDX==3,1),A(IDX==3,2),'g.','MarkerSize',12);
hold on
plot(C(1,1),C(1,2),'x','color','k','LineWidth',6)
hold on
plot(C(2,1),C(2,2),'x','color','k','LineWidth',6)
hold on
plot(C(2,1),C(2,2),'x','color','k','LineWidth',6)
Hello! I have two signals and I want to cluster them k average, when setting 2 clusters everything is fine, but when I want to put 3 or more errors get out, help me fix it ps my signal is a pure signal X1 and a signal with noise X2
  1 件のコメント
Lev Mihailov
Lev Mihailov 2019 年 8 月 8 日
idx = kmeans(X1,2);
% Plot results
hold on
plot(X(idx==1,1), X(idx==1,2), 'r.')
plot(X(idx==2,1), X(idx==2,2), 'g.')
plot(X(idx==3,1), X(idx==3,2), 'b.')
X must have more rows than the number of clusters.
Error in Untitled (line 2)
idx = kmeans(E1,2);
tried in this way to make all the mistake ps I have a 2x1000 matrix

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by