在matlab中绘制3D云的表面

时间:2017-12-12 10:59:15

标签: matlab 3d surface

我有3D云点。我需要将它们绘制成曲面。我尝试使用meshdrid,griddata,scatteredInterpolant,trisurf-delaunay。什么都行不通。我知道这个问题已经讨论了很多,但似乎我不了解一些重要的细节。我现在的代码:

load('coords.mat')
figure()
subplot(1,2,1)
plot3(x,y,z,'.')
axis off
view(3)

subplot(1,2,2)
C=gray(numel(x)); % unsuccessful attempt
[~,idx]=sort(z);  %      to have 
C=C(idx,:);       %    illumination
scatter3(x,y,z,50,C,'filled')
axis off
view(3)

生成以下图像: enter image description here

你能帮助我吗?

1)找到一种用表面函数绘制它的方法。

并且因为一些点可能在表面内(可能是我的问题)

2)如何删除'隐形'点吗

我需要针对不同情况的解决方案,图片和数据只是一个例子。

Mat文件可以下载here

P.S。

如果重要的话 - 我获得这些点的坐标作为随机贝塞尔曲线的旋转。

更新

如果上面的数据太大,我会生成另一个点数较少的集合:

enter image description here

坐标为here

1 个答案:

答案 0 :(得分:1)

你从哪里获得这些数据?它表示为向量,但如果将其重新整形为矩阵,则可以使用surf函数。试试这段代码:

z=reshape(z,100,100);
y=reshape(y,100,100);
x=reshape(x,100,100);
surf(x,y,z)
相关问题