MATLAB Answers


Getting x and y arrays of surf(z)

Asked by Rafael Madrid on 8 Oct 2014
Latest activity Commented on by Rafael Madrid on 8 Oct 2014
This might be a hard to explain question; I have an intensity array that I use to get a surf(Z) of a hemisphere. Is there a way to get the equivalent x and y arrays of these intensities, ie, if I were to surf(x,y,z) of these 3 I would get the same result? Maybe a different way of asking would be, can I split surf(Z) into surf(x,y,z) and get the same result. Because I need to have these x and y arrays also to compare my hemisphere to a matlab generated sphere. Thanks.


Sign in to comment.

1 Answer

Answer by Guillaume
on 8 Oct 2014
 Accepted Answer

If you've just generated your surface with
[x, y] = meshgrid(1:size(z, 2), 1:size(z, 1));

  1 Comment

Perfect. It was so obvious, I can't believe I missed it. thank you/

Sign in to comment.