如何在 MATLAB 中使用不规则间隔的数据绘制冲浪图?

发布于 2024-09-02 00:03:28 字数 254 浏览 2 评论 0原文

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

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) 的数据。有没有一种简单的方法来绘制图形,以类似于冲浪的方式在点之间生成曲面?

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);

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

青柠芒果 2024-09-09 00:03:28

抱歉,经过一番搜寻,我设法回答了我自己的问题:

您可以使用 trisurf 函数:

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

如果您有密集的数据,您将需要进行 shading interp (或其他值) ,检查doc shading),这样就不会因为网格而出现黑色斑点。

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

You can use the trisurf function:

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

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.

负佳期 2024-09-09 00:03:28

看来您已经通过使用 DELAUNAY 和 TRISURF 生成并绘制三角剖分表面。

作为替代方案,您还可以将规则间隔的网格适合不均匀间隔的点,以生成可以使用 SURF 命令。我讨论如何使用 TriScatteredInterp< /strong> class (或已弃用的函数 GRIDDATA )在我的答案关于SO的另一个问题。

It looks like you've found your answer by using DELAUNAY and TRISURF to generate and plot a triangulated surface.

As an alternative, you could also fit a regularly-spaced grid to your nonuniformly-spaced points in order to generate a surface that can be plotted with the SURF command. I discuss how this can be done using the TriScatteredInterp class (or the deprecated function GRIDDATA) in my answer to this other question on SO.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文