Calculate Earth magnetic field and secular variation using International Geomagnetic Reference Field
the Earth magnetic field and the secular variation at a specific location
and time using different generations of the International Geomagnetic
Calculate the magnetic model 1000 meters over Natick, Massachusetts on July 4, 2015 using IGRF-12.
[mag_field_vector,hor_intensity,declinatioon,inclination,total_intensity] ... = igrfmagm(1000,42.283,-71.35,decyear(2015,7,4),12)
mag_field_vector = 1.0e+04 * 1.9460 -0.5091 4.8179 hor_intensity = 2.0115e+04 declinatioon = -14.6612 inclination = 67.3387 total_intensity = 5.2209e+04
Distance, in meters, from the surface of the Earth, specified as a scalar.
latitude— Geodetic latitude
Geodetic latitude, in degrees, specified as a scalar. North latitude is positive, and south latitude is negative.
longitude— Geodetic longitude
Geodetic longitude, in degrees, specified as a scalar. East longitude is positive, and west longitude is negative.
Year, in decimal format, specified as a decimal. This value is the desired year, including any fraction of the year that has already passed.
generation— Generation version of International Geomagnetic Reference Field
Generation version of the International Geomagnetic Reference
Field, specified as
magFieldVector— Magnetic field vector
Magnetic field vector, in nanotesla (nT), returned as a vector. Z is the vertical component (+ve down).
horIntensity— Horizontal intensity
Horizontal intensity, in nanotesla (nT), returned as a scalar.
Declination, in degrees (+ve east), returned as a scalar.
Inclination, in degrees (+ve down), returned as a scalar.
totalIntensity— Total intensity
Total intensity, in nanotesla (nT), returned as a scalar.
magFieldSecVariation— Secular variation in magnetic field vector
Secular variation in magnetic field vector, in nT/year, returned as a vector. Z is the vertical component (+ve down).
secVariationHorizontal— Secular variation in horizontal intensity
Secular variation in horizontal intensity, in nT/year, returned as a scalar.
secVariationDeclination— Secular variation in declination
Secular variation in declination, in minutes/year (+ve east), returned as a scalar.
secVariationInclination— Secular variation in inclination
Secular variation in inclination, in minutes/year (+ve down), returned as a scalar.
secVariationTotal— Secular variation in total intensity
Secular variation in total intensity, in nT/year, returned as a scalar.
This function is valid between the heights of –1000 meters to 600,000 meters.
The 11th generation is valid between the years of 1900 and 2015, and 12th generation is valid between the years of 1900 and 2020.
This function has the limitations of the International Geomagnetic Reference Field (IGRF). For
more information, see the IGRF website,
 Blakely, R. J. Potential Theory in Gravity & Magnetic Applications. Cambridge, UK: Cambridge University Press, 1996.
 Lowes, F. J. “The International Geomagnetic Reference Field: A 'Health' Warning.” January, 2010. https://www.ngdc.noaa.gov/IAGA/vmod/igrfhw.html.