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 vectors $$({\widehat{e}}_{R},{\widehat{e}}_{az},{\widehat{e}}_{el})$$ at
the point *(az,el)* can be expressed in terms of
the Cartesian unit vectors by

$$\begin{array}{ll}{\widehat{e}}_{R}\hfill & =\mathrm{cos}(el)\mathrm{cos}(az)\widehat{i}+\mathrm{cos}(el)\mathrm{sin}(az)\widehat{j}+\mathrm{sin}(el)\widehat{k}\hfill \\ {\widehat{e}}_{az}\hfill & =-\mathrm{sin}(az)\widehat{i}+\mathrm{cos}(az)\widehat{j}\hfill \\ {\widehat{e}}_{el}\hfill & =-\mathrm{sin}(el)\mathrm{cos}(az)\widehat{i}-\mathrm{sin}(el)\mathrm{sin}(az)\widehat{j}+\mathrm{cos}(el)\widehat{k}\hfill \end{array}.$$

This set of basis vectors
can be derived from the local Cartesian basis by two consecutive rotations:
first by rotating the Cartesian vectors around the *y*-axis
by the negative elevation angle, *-el*, followed
by a rotation around the *z*-axis by the azimuth
angle, *az*. Symbolically, we can write

$$\begin{array}{ll}{\widehat{e}}_{R}\hfill & ={R}_{z}(az){R}_{y}(-el)\left[\begin{array}{c}1\\ 0\\ 0\end{array}\right]\hfill \\ {\widehat{e}}_{az}\hfill & ={R}_{z}(az){R}_{y}(-el)\left[\begin{array}{c}0\\ 1\\ 0\end{array}\right]\hfill \\ {\widehat{e}}_{el}\hfill & ={R}_{z}(az){R}_{y}(-el)\left[\begin{array}{c}0\\ 0\\ 1\end{array}\right]\hfill \end{array}$$

The following figure
shows the relationship between the spherical basis and the local Cartesian
unit vectors.

MATLAB^{®} computes the matrix `A`

from
the equations