how to change fuzzy sub cluster code to kmeans

A=xlsread('APNORM.xlsx',5,'J12:M41');
B=xlsread('APNORM.xlsx',5,'P12:S41');
C=[A;B];
[Co,S,L] = pca(C);
S=S(:,1:2);
[C,b] = subclust(S,0.9);
scatter(S(1:30,1),S(1:30,2),'ob');
hold on
scatter(S(31:60,1),S(31:60,2),'or');
scatter(C(:,1),C(:,2),'dm');
xlabel('PC1');
ylabel('PC2');
legend('Normal','Hipoksemia','Titik Tengah Klaster');

Answers (1)

Hi Maria,
I understand that you are trying to use k-means clustering instead of subtractive clustering. To achieve this, you can use the “kmeans” function instead of the “subclust” function to use k-means algorithm for clustering.
Note that you need to specify number of clusters as input to the “kmeans” function.
You can refer to the documentation of the “kmeans” function by using the following command in the Command Window of MATLAB:
>>doc kmeans
Hope this helps!

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Tags

Asked:

on 18 Dec 2020

Answered:

on 19 Feb 2025

Community Treasure Hunt

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

Start Hunting!