Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
我有一组数据点,每个数据点都属于某个群集(组)。我需要在每个群集周围绘制一个多边形。有谁知道该怎么做?
我是否使用实际的数据点绘制多边形都没有关系。我只需要将它们包裹在多边形中即可。 回答: 尝试使用convhull函数。它从数据集中定义凸包的点返回索引。您必须对绘制的每个群集执行此操作。 例如: x=rand(1,100); %#generate x and y data for your clusters y=rand(1,100); k=convhull(x,y); %#generate indices marking the outermost points hold on plot(x,y,'b.') %# plot your cluster points plot(x(k),y(k),'r-') %# plots only k indices, giving the convex hull 这将为您提供一个多边形,其索引与聚类的离群值重合。 更多&回答... |
![]() |
![]() |