|MATLAB Function Reference|
Transform Cartesian coordinates to spherical
[THETA,PHI,R] = cart2sph(X,Y,Z)
transforms Cartesian coordinates stored in corresponding elements of arrays
Z into spherical coordinates. Azimuth
THETA and elevation
PHI are angular displacements in radians measured from the positive x-axis, and the x-y plane, respectively; and
R is the distance from the origin to a point.
Z must be the same size.
The mapping from three-dimensional Cartesian coordinates to spherical coordinates is