How to find the center of mass of each cluster
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Pedro Nunes
le 7 Fév 2021
Réponse apportée : Srivardhan Gadila
le 14 Fév 2021
Hi guys, I have an excel file 168x65, where I want to divide the data into 6 clusters, and then I need to find the center of mass for each of cluster. I have already used the kmeans function to divide the data into clusters, but I can´t find the center of mass of each cluster.
The information in the file is temperatures, and when I use the kmeans function in that way
[idx c]=kmeans(data(:),6);
the variable C stays with the average temperatures of each cluster, and not the position of the centroides of each cluster.
I need help
0 commentaires
Réponse acceptée
Srivardhan Gadila
le 14 Fév 2021
From the above information I'm assuming that data is a matrix of size 168x65. So data(:) returns a new array of size 10920x1 (all elements concatenated to a single column vector) and you are performing kmeans clustering on this new array and not on the actual data matrix.
Hence the kmeans is performed on the 10920 data points with each data point having dimension 1 forming 6 clusters and hence the cluster centers will be of dimension 1 as well.
If you are looking for your cluster center to be of dimension 65 then use the kmeans function as follows:
[idx c]=kmeans(data,6);
If this is not your issue, can you provide more information with relevant code and examples.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Cluster Analysis and Anomaly Detection dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!