Matlab 3D Matrix Plot [duplicate]

时间秒杀一切 提交于 2019-11-30 20:09:05
upperBound

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!