Transform Cartesian coordinates to spherical

`[azimuth,elevation,r] = cart2sph(X,Y,Z)`

`[azimuth,elevation,r] = cart2sph(X,Y,Z)`

transforms
Cartesian coordinates stored in corresponding elements of arrays `X`

, `Y`

,
and `Z`

into spherical coordinates. `azimuth`

and `elevation`

are
angular displacements in radians. `azimuth`

is the
counterclockwise angle in the *x*-*y* plane
measured from the positive *x*-axis. `elevation`

is
the elevation angle from the *x*-*y* plane. `r`

is
the distance from the origin to a point.

Arrays `X`

, `Y`

, and `Z`

must
be the same size (or any of them can be scalar).

Was this topic helpful?