% 3D Scatter plot

[r,phi,theta] = ndgrid(3:6,linspace(0,2*pi,20),linspace(0,pi,10));


x = r .* sin(theta) .* cos(phi);
y = r .* sin(theta) .* sin(phi);
z = r .* cos(theta);

scatter3(x(:),y(:),z(:),3,r(:));
