Error clustering to k mean

2 visualizzazioni (ultimi 30 giorni)
Lev Mihailov
Lev Mihailov il 8 Ago 2019
Commentato: Lev Mihailov il 8 Ago 2019
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 Commento
Lev Mihailov
Lev Mihailov il 8 Ago 2019
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

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by