I have a function expressed in spherical coordinates:
f(r,theta,phi) = 4*exp(-r)*cos(theta)*sin(phi)
I’d like to plot this in MATLAB in these ways:
- R3
- R2 Contour Plot (x-y plane or x-z plane or y-z plane)
Is there a straightforward way to do this?
Just do the conversion and plot in Cartesian coordiantes:
I like
isosurfaceto visualize 3D data like this. For the 2D slice through Z=0 you could useimagesc(fvals(:,:,N))orcontour(fvals(:,:,N))