Matlab中的Convhull [英] Convhull in Matlab

查看:176
本文介绍了Matlab中的Convhull的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个位置数据向量:xyz

I have 3 vectors of position data : x, y and z

x = [0.1524 0.1219 0.0610 0.0914 0.0610 0.1219 0.0305 0.0914 0.2134 0.0610 0.1219
0.0305 0.0610 0.1219 0.0914 0.1524 0.0610 0.1524 0.0610 0.0610 0.0610 0.0610
0.1524 0.0914 0.0610 0.1524 0.0610 0.2134 0.0610 0.0914 0.1524];

y = [0.1219 0.1524 0.0305 0.1219 0.1524 0.1524 0.0610 0.1219 0.1219 0.1524 0.1524
0.0610 0.0914 0.1524 0.1829 0.1829 0.0914 0.1829 0.2134 0.0914 0.2134 0.0914
0.1829 0.0610 0.0914 0.1829 0.0914 0.1829 0.2134 0.1219 0.1829];

z = [0.0305 0.0305 0.0610 0.0610 0.0610 0.0610 0.0914 0.0914 0.0914 0.0914 0.0914
0.1219 0.1219 0.1219 0.1219 0.1219 0.1524 0.1524 0.1524 0.1829 0.1829 0.2134
0.2134 0.2438 0.2438 0.2438 0.2743 0.2743 0.2743 0.3048 0.3048];

我想知道如何在此场景上应用凸包? Matlab没有 接受这种格式但规则排列的网格.

I was wondering how I could apply convex-hull on this set? Matlab doesn't accept this format but regularly spaced grid.

推荐答案

您可以使用 convhulln 计算尺寸大于2的凸包.如果要绘制结果,请使用

You can use convhulln to compute the convex hull for dimensions grater than 2. If you want to plot the results, use trisurf. See the sample code for your input below:

X = [x;y;z]'; %# involves a 3D point on each row  
K = convhulln(X);
trisurf(K,X(:,1),X(:,2),X(:,3))

这篇关于Matlab中的Convhull的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆