FUNCTION REFERENCE

cart2sph

Cartesian to spherical coordinates.

Cartesian to spherical coordinates.

Syntax

[azimuth, elevation, r] = cart2sph(x, y, z)

azimuth is atan2(y,x), elevation is atan2(z,hypot(x,y)) and r is the distance from the origin. Inputs must have the same size, or be scalar.

Example

[az, el, r] = cart2sph(1, 1, 1); [az el r]   % [0.7854 0.6155 1.7321]

Differences from MATLAB: Real double inputs only; complex, character, logical and cell input stop with an error.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.