![]() |
在MATLAB中围绕数据点组绘制多边形
我有一组数据点,每个数据点都属于某个群集(组)。我需要在每个群集周围绘制一个多边形。有谁知道该怎么做?
我是否使用实际的数据点绘制多边形都没有关系。我只需要将它们包裹在多边形中即可。 [B]回答:[/B] 尝试使用[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/convhull.html"]convhull[/URL]函数。它从数据集中定义凸包的点返回索引。您必须对绘制的每个群集执行此操作。 例如: 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 这将为您提供一个多边形,其索引与聚类的离群值重合。 [url=https://stackoverflow.com/questions/2814336]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 01:05。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.