Is there an update for the function igrfmagm?
Ältere Kommentare anzeigen
When I call the function inside a for loop I get the Warning:
In
Warning: This generation of the International Geomagnetic Reference
Geomagnetic Reference Field for the latest supported generation.
1 Kommentar
Torsten
am 31 Mär. 2026
Answer from AI:
This warning occurs in MATLAB when using the IGRF (International Geomagnetic Reference Field) model with a date that exceeds the validity of the coefficient file currently in your MATLAB path. The IGRF model is updated every five years, and the 14th generation (IGRF-14) was released in late 2024.
To resolve this, you must update the IGRF coefficients file (igrfcoefs.mat).
How to Fix the Warning
Method 1: Update the "m_IGRF" File Exchange Toolbox (Recommended)
If you are using the popular m_IGRF package from the MATLAB Central File Exchange (by Drew Compston/William Brown), follow these steps to update to IGRF-14:
- Download Latest Version: Visit the GitHub repository wb-bgs/m_IGRF or the MATLAB File Exchange International Geomagnetic Reference Field (IGRF) Model.
- Replace .dat Files: Replace the old *grf*.dat files in the datfiles subfolder with the new ones provided in the updated download.
- Run getigrfcoefs: Run the getigrfcoefs.m script to generate a new igrfcoefs.mat file.
- Update Path: Ensure the updated igrfcoefs.mat is in your MATLAB path.
Method 2: Update Aerospace Toolbox (Simulink/MATLAB)
If you are using the built-in igrfmagm function from the Aerospace Toolbox:
- Update MATLAB: The IGRF block in Simulink and the igrfmagm function were updated to support IGRF-14 in R2025a.
- Specify Generation: In igrfmagm, you can explicitly set the generation to 14:matlab[XYZ, H, D, I, F] = igrfmagm(height, lat, lon, decyear, 14);
Why this happens
The IGRF model provides definitive coefficients up to 2020.0 and predictive data for 2020–2025 (IGRF-13) or 2025-2030 (IGRF-14). If your decimalYear input is, for example, 2026, and you are using IGRF-13, MATLAB warns you that the model is no longer current and is extrapolating.
Latest Generation: As of early 2025, IGRF-14 is the current generation.
Antworten (0)
Kategorien
Mehr zu Earth and Planetary Science finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!