matlab plot three dimensional matrix

原创
2013/02/20 22:04
阅读数 104

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

UPDATE:

Suppose you have a 3D matrix A:

A = rand(100,100,200);

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

Now you are ready to use scatter3:

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

Here the : indexing vectorizes the coordinates column-wise.

Hope this helps.

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部