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

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

问题描述

香港专业教育学院创建了一个三维矩阵在MATLAB。矩阵的值是在一个矩形截面该点的速度。我想用颜色显示在每个位置值的情节,这可能吗?

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.

推荐答案

这个问题是非常相似的<一href="http://stackoverflow.com/questions/9302484/plotting-3-d-matrix-values-in-matlab/9302690#9302690"标题=这个问题>这个问题。您可能要检查出来。

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 映射到一个颜色,在它的三维坐标。首先产生的坐标:

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天全站免登陆