automatic circles that enclose clusters of similar data something like lineCoeff = polyfit(x, y, n) (regression line)
조회 수: 4 (최근 30일)
이전 댓글 표시
hello, I have generated a pca plot and there are obvious clusters of the data but to make it more evident I would like to draw centroids (or similar shape fitting the same purpose) around the similar data in the pca plot. Is there a way to do this in matlab? I did try John D'Errico's function: incircle(): but I don't think its quite what I am looking for. i kind of want regression centroids around the clusters of similar data.
Update: John says that won't work so to be more specific, I would like a regression line to go into 3D plot.
Thank you for your response. I have included an example of what i am looking for below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1290865/image.png)
답변 (1개)
John D'Errico
2023년 2월 9일
incircle has nothing to do with your problem. Sorry.
You would first want to use some sort of clustering algorithm on your data. k-means is the go-to tool for that.
Once you have the data clustered into groups, I would then just use the centroids from k-means itself as the center of the circles.
Alternatively, you could use my circumcircles tool to compute the circles, but the k-means centroids seem to make sense.
Finally, once you decide on the center of the circles, the radii are easy to generate as the distance to the farthest point in that cluster.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!