The EKF-based dynamic magnetic field calibration algorithm uses gyroscope data to calibrate magnetic field data. The magnetic field data can be well calibrated to the surface of the magnetic field sphere, which is superior to the traditional ellipsoid fitting algorithm.