The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Slice of 3D spherical volume
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  

Posts: 8
Registered: 9/12/11
Slice of 3D spherical volume
Posted: Jan 15, 2013 9:33 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi there!

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);

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,[100],[80],[150]);

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.

Any help will be much appreciated!!


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.