Main Content

cart2sphvec

Convert vector from Cartesian components to spherical representation

Description

vs = cart2sphvec(vr,az,el) converts the components of a vector or set of vectors, vr, from their representation in a local Cartesian coordinate system to a spherical basis representation contained in vs. A spherical basis representation is the set of components of a vector projected into a basis given by (e^az,e^el,e^R). The orientation of a spherical basis depends upon its location on the sphere as determined by azimuth, az, and elevation, el.

example

Examples

collapse all

Start with a vector in Cartesian coordinates pointing along the z-direction and located at 45° azimuth, 45° elevation. Compute its components with respect to the spherical basis at that point.

vr = [0;0;1];
vs = cart2sphvec(vr,45,45)
vs = 3×1

         0
    0.7071
    0.7071

Input Arguments

collapse all

Vector in Cartesian basis representation specified as a 3-by-1 column vector or 3-by-N matrix. Each column of vr contains the three components of a vector in the right-handed Cartesian basis x,y,x.

Example: [4.0; -3.5; 6.3]

Data Types: double
Complex Number Support: Yes

Azimuth angle in degrees, specified as a scalar in the closed range [–180, 180]. To define the azimuth angle of a point on a sphere, construct a vector from the origin to the point. The azimuth angle is the angle in the xy-plane from the positive x-axis to the vector's orthogonal projection into the xy-plane. As examples, zero azimuth angle and zero elevation angle specify a point on the x-axis while an azimuth angle of 90° and an elevation angle of zero specify a point on the y-axis.

Example: 45

Data Types: double

Elevation angle in degrees, specified as a scalar in the closed range [–90, 90]. To define the elevation of a point on the sphere, construct a vector from the origin to the point. The elevation angle is the angle from its orthogonal projection into the xy-plane to the vector itself. As examples, zero elevation angle defines the equator of the sphere and ±90° elevation define the north and south poles, respectively.

Example: 30

Data Types: double

Output Arguments

collapse all

Spherical representation of a vector returned as a 3-by-1 column vector or 3-by-N matrix having the same dimensions as vs. Each column of vs contains the three components of the vector in the right-handed (e^az,e^el,e^R) basis.

More About

collapse all

Extended Capabilities

expand all

Version History

Introduced in R2020a

See Also