What are the outputs of Sphere?
1 view (last 30 days)
Show older comments
Hello,
I am trying to learn matlab and am looking to get a sphere of points and plot them (i actually want a semisphere). I am trying to model some data that I will be getting and hoping to have it as a series of points.
So I just assumed that the matrices that were outputted simply reflected a corresponding series of points that were connected by the surf function. I tried to re-order the points to put it into a 3x441 vector, so each row would be a coordinate on the sphere. When I tried to plot this it did not turn into a sphere. What do these matrices mean? is it possible to get a cloud of points out of them and have it work with surf and other functions like surfnorm?
Thanks
Code:
n0 = 20; [xo,yo,zo] = sphere(n0); surf(xo,yo,zo)
0 Comments
Answers (1)
Azzi Abdelmalek
on 6 May 2013
Edited: Azzi Abdelmalek
on 6 May 2013
[n,m]=size(zo)
n2=1:ceil(n/2)
surf(xo(n2,:),yo(n2,:),zo(n2,:))
%or
surf(xo(n2,:),yo(n2,:),-zo(n2,:))
1 Comment
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!