Matlab 3D 矩阵图 [英] Matlab 3D Matrix Plot

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

问题描述

我在 MATLAB 中创建了一个 3d 矩阵.矩阵的值是矩形截面中该点的速度.我想要一个用颜色显示每个位置的值的图,这可能吗?

Ive created a 3d matrix in MATLAB. The values of the matrix are the velocity at that point in a rectangular section. I would like a plot with colours showing the values at each position, is this possible?

换句话说,我有一个大小为 100x100x200 的矩阵.我就像一个有 100x100x200 个点的图,每个点的颜色与其值有关.

Phrasing this another way, I have a matrix of size 100x100x200. Id like a graph that has 100x100x200 points and the colour of each of those points is related to its value.

推荐答案

这个问题和这个问题.你可能想看看.

This question is very similar to this question. You might want to check it out.

更新:

假设您有一个 3D 矩阵 A:

Suppose you have a 3D matrix A:

A = rand(100,100,200);

您想绘制 A 的每个条目映射到其 3D 坐标处的颜色.首先生成坐标:

You want to plot each entry of A mapped to a color at its 3D coordinates. First generate the coordinates:

[x,y,z] = meshgrid(1:100,1:100,1:200);

现在您可以使用 scatter3:

scatter3(x(:),y(:),z(:),5,A(:))

这里的 : 索引按列向量化坐标.

Here the : indexing vectorizes the coordinates column-wise.

希望这会有所帮助.

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

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