sph2cart
- :
[x, y, z] =sph2cart(theta, phi, r)¶ - :
P =sph2cart(theta, phi, r)¶ Convert spherical coordinates to Cartesian coordinates.
theta is the azimuth (angle in the xy-plane from the positive x axis), phi the elevation (angle above the xy-plane) and r the radius, so that
x = r .* cos (phi) .* cos (theta) y = r .* cos (phi) .* sin (theta) z = r .* sin (phi)
The inputs must be real floating point arrays of the same size, or scalars. With a single output the result is the N-by-3 matrix
[x(:), y(:), z(:)].A single N-by-3 matrix argument (columns theta, phi, r) is also accepted.