Repeating x and y vectors for use with scatter3()
Currently I have a working 3D mesh()
plot. Howev开发者_StackOverflow社区er, the vertical axis lends itself better to an angular representation, so I'm constructing a coordinate transform to cylindrical space, after which I'll plot everything with scatter3()
.
Currently I have one-dimensional vectors containing all of the possible x and y values; however, they do not repeat (and they need to, to work in scatter3()
). I have to flatten my two-dimensional z-matrix using z(:)
. Is there a quick method to repeat x
and y
to also be scatter3
-compatible?
Thanks...
Use meshgrid
and then flatten:
[X,Y] = meshgrid(x,y);
scatter3(X(:), Y(:), z(:));
精彩评论