how to change fuzzy sub cluster code to kmeans

4 views (last 30 days)
Maria Natalia
Maria Natalia on 18 Dec 2020
Answered: Anay on 19 Feb 2025
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)

Anay
Anay on 19 Feb 2025
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

Community Treasure Hunt

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

Start Hunting!