matlab中muw,matlab – 获取属于凸包的点

[K, V] = convhull(granule);

granule2 = zeros(size(granule));

tmp = granule(K,:)==0; %// all points on the convex hull but not in the granule

tmp2 = tmp(:,1)==tmp(:,2); %// both indices of your granule are zero

granule2(tmp(tmp2)) = 2;

K是与凸包上的点对应的点的行数,V是该凸包所跨越的体积.因此,您可以使用此行索引在granule中查找零索引.

使用以下示例:

granule = rand(1e3,2);

[K, V] = convhull(granule);

granule2 = zeros(size(granule));

tmp = granule(K,:)<0.1; %// all points on the convex hull but not in the granule

tmp2 = tmp(:,1)==tmp(:,2); %// both indices of your granule are below 0.1

granule2(tmp(tmp2)) = 2;

得到总和(tmp2)= 11,因此在这种情况下有11个点在凸包上,并且两个指数都低于0.1(我不能使用== 0,因为我的数组中没有零).

您可能希望根据实际需要为tmp2切换条件.

不出所料,更多的人为此奋斗并实际为此编写代码,请参阅John D’Errico编写的MathWorks Central代码.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值