Skip to Main Content Skip to Search
Product Documentation

sph2cart - Transform spherical coordinates to Cartesian

Syntax

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

Description

[x,y,z] = sph2cart(azimuth,elevation,r) transforms the corresponding elements of spherical coordinate arrays to Cartesian, or xyz, coordinates. azimuth, elevation, and r must all be the same size (or any of them can be scalar). azimuth and elevation are angular displacements in radians from the positive x-axis and from the x-y plane, respectively.

Algorithms

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

x = r .* cos(elevation) .* cos(azimuth)
y = r .* cos(elevation) .* sin(azimuth)
z = r .* sin(elevation)

See Also

cart2pol | cart2sph | pol2cart

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS