Convert vector from Cartesian components to spherical representation
vs = cart2sphvec(vr,az,el)
the components of a vector or set of vectors,
vs = cart2sphvec(
from their representation in a local Cartesian coordinate system to
a spherical basis representation contained
vs. A spherical basis representation is the
set of components of a vector projected into a basis given by .
The orientation of a spherical basis depends upon its location on
the sphere as determined by azimuth,
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 = 0 0.7071 0.7071
vr— Vector in Cartesian basis representation
Vector in Cartesian basis representation specified as a 3-by-1
column vector or 3-by-N matrix. Each column of
the three components of a vector in the right-handed Cartesian basis x,y,x.
[4.0; -3.5; 6.3]
Complex Number Support: Yes
vs— Vector in spherical basis
Spherical representation of a vector returned as a 3-by-1 column
vector or 3-by-N matrix having the same dimensions as
Each column of
vs contains the three components
of the vector in the right-handed basis.
Spherical basis vectors are a local set of basis vectors which point along the radial and angular directions at any point in space.
The spherical basis is a set of three mutually orthogonal unit vectors defined at a point on the sphere. The first unit vector points along lines of azimuth at constant radius and elevation. The second points along the lines of elevation at constant azimuth and radius. Both are tangent to the surface of the sphere. The third unit vector points radially outward.
The orientation of the basis changes from point to point on the sphere but is independent of R so as you move out along the radius, the basis orientation stays the same. The following figure illustrates the orientation of the spherical basis vectors as a function of azimuth and elevation:
For any point on the sphere specified by az and el, the basis vectors are given by:
Any vector can be written in terms of components in this basis as . The transformations between spherical basis components and Cartesian components take the form
Usage notes and limitations:
Does not support variable-size inputs.