How to slice a 3D vector field(defined in spherical coordinates) scattered data?
Show older comments
I have the following code:
[r,theta,phi] = meshgrid(0:1:10,0:pi/10:pi, 0:pi/10:2*pi);
li=3;
mi=3;
b=10*mi*ksr(li,mi,theta).*BT(li,r);
x=r.*sin(theta).*cos(phi);
y=r.*sin(theta).*sin(phi);
z=r.*cos(theta);
b is a function that gives me values for each point in mesh grid.
After this when I call scatter3 function as below I get the below figure.
scatter3(x(:),y(:),z(:),[],f(:));

Now I wish to slice it using the slice function as below:
xslice =[1];
yslice = [];
zslice = [];
slice(x,y,z,b,xslice,yslice,zslice);
When I'm running this, I'm getting the following error:
Error using interp3 (line 148)
Input grid is not a valid MESHGRID.
Error in slice (line 104)
vi = interp3(x,y,z,v,xi,yi,zi,method);
Error in wqp (line 12)
slice(x,y,z,b,xslice,yslice,zslice);
Can anyone please explain what's happening. Your help will be appreciated.
Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!