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
Z into spherical coordinates.
angular displacements in radians.
azimuth is the
counterclockwise angle in the x-y plane
measured from the positive x-axis.
the elevation angle from the x-y plane.
the distance from the origin to a point.
be the same size (or any of them can be scalar).
The mapping from three-dimensional Cartesian coordinates to spherical coordinates is
azimuth = atan2(y,x) elevation = atan2(z,sqrt(x.^2 + y.^2)) r = sqrt(x.^2 + y.^2 + z.^2)
The notation for spherical coordinates is not standard. For
measured from the x-y plane. Notice that if
elevation = 0,
the point is in the x-y plane. If
= pi/2, then the point is on the positive z-axis.