Transform spherical to Cartesian coordinates
[x,y,z]=cart2pol(r,theta,phi)
radius
elevation angle
azimuth angle
x,y,z coordinates
cart2pol(r,theta,phi) transforms corresponding elements of data stored in spherical coordinates (radius r, elevation angle theta, azimuth angle phi) to Cartesian coordinates X,Y,Z. phi and theta are in radians. The arrays r,theta and phi must be the same size (or any of them can be scalar).
add sample pgm