MATLAB: Plot clean surface plots from scatter data

3d plotsscatterspherical coordinates

I'm trying to make some nice 3D plots of some surfaces being generated by my MATLAB program. I can't use surf() because I'm working in spherical coordinates, and thus each data point must be preserved as a triplet of points as one can't just convert from spherical triplets to the rectangular (ix1) x vector, (jx1) y vector, (ixj) z matrix that surf requires. Simply doing a 3D scatter plot is messy looking. I'd like a surface.
Now, I have already used the method detailed here: http://www.mathworks.com/matlabcentral/fileexchange/5105
But I have two problems with it.
1) The figures are hideous. The surfaces I'm plotting resemble slices off of a sphere. Peel a piece of onion skin off and that may help visualize the thin, curved shape I'm trying to make. I believe what is happening is the routine is trying to connect the points on the empty edges together, making a solid, but that ruins the figure. I also think the process of converting from spherical to cartesian coordinates has left me with unevenly spaced points which throws off the size of the triangles, contributing to the messy look.
2) I'd like the surface to be a solid color. It looks confusing with a color gradient, like I'm trying to add in extra data and meaning to what is simply a figure of a shape.
Does anyone know of a different way to plot a surface in this manner, or even better, a way to get MATLAB to handle spherical coordinates so I can plot my data directly and skip this step?

Best Answer

I'm not quite clear on the format of your data to start, since you say you can't convert from spherical to cartesian in your case. Keep in mind that surf doesn't require a rectilinear grid, so if you have gridded data in spherical coordinates (assuming I understand your data description, if your triplets don't lie on a grid, you should be able to triagulate rho onto a uniform theta/phi grid), you can just translate and plot:
n = 20;
theta = (-n:2:n)/n*pi;
phi = (-n:2:n)'/n*pi/2;
[theta,phi] = meshgrid(theta,phi);
rho = rand(size(theta)) + 5;
[x,y,z] = sph2cart(theta, phi, rho);
surf(x,y,z, ones(size(x)))