cart2sph - Transform Cartesian coordinates to spherical

Syntax

[THETA,PHI,R] = cart2sph(X,Y,Z)

Description

[THETA,PHI,R] = cart2sph(X,Y,Z) transforms Cartesian coordinates stored in corresponding elements of arrays X, Y, and 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.

Arrays X, Y, and Z must be the same size (or any of them can be scalar).

Algorithm

The mapping from three-dimensional Cartesian coordinates to spherical coordinates is

The notation for spherical coordinates is not standard. For the cart2sph function, the angle PHI is measured from the x-y plane. Notice that if PHI = 0 then the point is in the x-y plane and if PHI = pi/2 then the point is on the positive z-axis.

See Also

cart2pol, pol2cart, sph2cart

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS