Error clustering to k mean

2 次查看(过去 30 天)
Lev Mihailov
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 CenterFile Exchange 中查找有关 Statistics 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