How to find the center of mass of each cluster

8 ビュー (過去 30 日間)
Pedro Nunes
Pedro Nunes 2021 年 2 月 7 日
回答済み: Srivardhan Gadila 2021 年 2 月 14 日
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

採用された回答

Srivardhan Gadila
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);
For more information refer to colon, : & kmeans.
If this is not your issue, can you provide more information with relevant code and examples.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCluster Analysis and Anomaly Detection についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by