Plotting multi-radius spherical mesh
Show older comments
I'm attempting to plot a mesh which represents a sphere sectioned into 12 logitudinal and 22 latitudinal segments. The difficultly is that each of the segments has a different radius to show it's importance. I have used the code below to draw the sphere but can not work out how to impose the importance onto the mesh points. The commented code if used with phi and theta of lengths 12, and 22 respectively gives me points, I however, wanted the whole segment surface.
out=double(int32(rand(22,12)*9));
% phi=linspace(0,pi,12);
% theta=linspace(0,2*pi,22);
phi=linspace(0,pi,13);
theta=linspace(0,2*pi,23);
[phi,theta]=meshgrid(phi,theta);
for i = 1:22
for j=1:12
% x=out.*sin(phi).*cos(theta);
% y=out.*sin(phi).*sin(theta);
% z=out.*cos(phi);
x=out.*sin(phi).*cos(theta);
y=out.*sin(phi).*sin(theta);
z=out.*cos(phi);
end
end
mesh(x,y,z)
Accepted Answer
More Answers (1)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!