如何使用不规则间隔的数据在 MATLAB 中制作冲浪图? [英] How do I make a surf plot in MATLAB with irregularly spaced data?

查看:20
本文介绍了如何使用不规则间隔的数据在 MATLAB 中制作冲浪图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以通过以下方式在 MATLAB 中创建 3D 曲面图:

I know I can create a 3D surface plot in MATLAB by doing:

x = linspace(1,10,100);
y = linspace(10,20,100);

[X Y] = meshgrid(x,y);

Z = X * Y;

surf(X,Y,Z);

但这要求生成的高度图的所有节点都排成一行.我有一组具有任意点 (x,y) 和高度 (z) 的数据.有没有一种简单的方法来绘制一个图形,该图形将以类似于 surf 的方式在点之间生成一个曲面?

But this requires that all the nodes for the height map generated line up. I have a set of data which has arbitrary points (x,y) and a height (z). Is there a simple way to plot a graph which will generate a surface between the points in a similar fashion to surf?

推荐答案

Appologies,经过一番寻找,我设法回答了我自己的问题:

Appologies, after some hunting I managed to answer my own question:

您可以使用trisurf函数:

tri = delaunay(x,y);
trisurf(tri,x,y,z);

如果你有密集的数据,你会想要做 shading interp(或其他值,检查 doc shading),这样你就不会因为网格.

If you have dense data you will want to do shading interp (or another value, check doc shading) so you don't get a black blob due to the grid.

这篇关于如何使用不规则间隔的数据在 MATLAB 中制作冲浪图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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