# Earth magnetic field vector in ECEF

I've this problem... I want to express the earth magnetic field vector in ECEF reference frame. As now I've just found some models for computing these values related to the earth magnetic field:

• D: declination (+ve east)
• I: inclination (+ve down)
• H: horizontal intensity
• X: north component
• Y: east component
• Z: vertical component (+ve down)
• F: total intensity unit: degree or nT

Since I think that XYZ aren't already in ECEF representation, I would like to ask you how can I pass from these parameters to a vector in ECEF reference frame. Thanks in advance!

• Why would you think that XYZ aren't in ECEF? That is the natural frame for expressing the Earth's magnetic field. Jan 19 '21 at 15:50
• I've voted leave open instead of supporting the close vote. This question could sit equally here, as a pre-requisite for a magnetorquer system, or in Earth Sciences. Jan 19 '21 at 22:34
• I know that these coordinates are in NED
– nico
Jan 20 '21 at 9:06

Magnetic field models, such as IGRF2000, often provide the output as a vector in a World Reference Frame, ENU (East, North, Up) or NED (North, East, Down). The components X, Y and Z from the question correspond to NED (X -> N, Y -> E, Z -> D).

If you have a position vector $$\vec{p}$$ of the location where the magnetic field vector is taken in some reference frame $$F$$, you can find a rotation matrix that will convert your magnetic field vector to that frame $$F$$. If you have the position vector in ECEF, just follow the procedure explained below. In case the vector is in ECI, either convert it to ECEF first or you can convert the resulting magnetic field vector in ECI to ECEF. Some hints on how to do this conversion can be found here: Transform ECI to ECEF

## NED to $$F$$ conversion

I apologize for quite bad axes alignment job on the picture, it was my first time using Blender. On the picture there is a big coordinate system, representing the $$F$$ reference frame, located at the center of a sphere representing Earth. Red axis is $$\hat{x}$$, blue is $$\hat{y}$$ and green is $$\hat{z}$$. Small coordinate system is the NED reference frame, with the red axis being North $$\hat{n}$$, blue is East $$\hat{e}$$ and green is Down $$\hat{d}$$. The yellow line is a vector $$\vec{p}$$ going from the Earth center to the location of the magnetic field vector measurement.

Two things should be noticed from the picture. First is that the vector $$\vec{p}$$ and $$\hat{d}$$ are coincident. Second is that $$\vec{z}$$, $$\hat{d}$$ and $$\hat{n}$$ are always in the same plane. For the NED, $$\hat{n}$$ is always pointing straight to the Earth's north, where the $$\hat{z}$$ is located, $$\hat{d}$$ straight to the Earth's center, while the $$\hat{e}$$ is only generally in the East direction, completing the orthogonal right handed axes triad.

The goal is to find all three axes of the NED frame in the $$F$$ frame.

Vector $$\hat{d}$$ can be obtained by unitizing $$\vec{p}$$ and negating it.

• $$\hat{d} = - |\vec{p}|$$

Vector $$\hat{e}$$ is normal to the plane within which lie $$\hat{n}$$, $$\hat{d}$$ and $$\hat{z}$$. Cross product of any of the two vectors from this plane will produce $$\hat{e}$$. We calculated $$\hat{d}$$ already and we know $$\hat{z} = [0 \; 0 \; 1]^T$$.

• $$\hat{e} = \hat{d} \times \hat{z}$$

Finally, $$\hat{n}$$ vector is normal to both $$\hat{d}$$ and $$\hat{e}$$, thus:

• $$\hat{n} = \hat{e} \times \hat{d}$$

The final rotation matrix can be obtained by taking transpose of the matrix constructed with these three vectors:

• $$R = [\hat{n} \; \hat{e} \; \hat{d}]^T$$