I want to find out how to draw a 3D volumetric color-intensity plot of spherical data. I have read a number of posts about this, but none give any working solution.
Basically, I have a 3D matrix V that contains the values of the function f(r,theta,phi) I am interested in. Each of these points in space has spherical coordinates (r,theta,phi). The following code serves as a quick example (where I just used a simple function for V):
r = 0:0.5:120; thet = 0:1:180; phi = 0:1:360;
V = zeros(numel(r),numel(thet),numel(phi));
for i=1:numel(r) rval = r(i); for j=1:numel(thet) tval = thet(j); for k=1:numel(phi) pval = phi(k); V(i,j,k) = rval + sin(tval)*cos(pval); end end end
I can easiy use slice to see what the function looks like throughout this volume with
[Rmesh,Tmesh,Pmesh] = meshgrid(thet,r,phi); sh = slice(Rmesh,Tmesh,Pmesh,V,,,); set(sh,'edgecolor','none');
However, I want this volume to appear spherical instead of square. How can I achieve this?
I tried using sph2cart, but the slice function complains that: X, Y and Z must be matrices produced by MESHGRID. Use TriScatteredInterp instead of INTERP3 for scattered data.