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代碼.
總結
以上是生活随笔為你收集整理的matlab中muw,matlab – 获取属于凸包的点的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 9.6 模拟试题
- 下一篇: matlab人脸追踪,求大神帮助我这个菜