How to find the center of mass of each cluster
7 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Srivardhan Gadila
2021-2-14
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!