Next Article in Journal
Conditional Optimal Sets and the Quantization Coefficients for Some Uniform Distributions
Previous Article in Journal
On the Number of Spherical Circles Needed to Cover a Spherical Convex Domain
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Offline Magnetometer Calibration Using Enhanced Particle Swarm Optimization

1
National Key Laboratory of Transient Physics, Nanjing University of Science and Technology, Nanjing 210094, China
2
School of Automation, Jiangsu University of Science and Technology, Zhenjiang 212100, China
*
Author to whom correspondence should be addressed.
Mathematics 2025, 13(15), 2349; https://doi.org/10.3390/math13152349
Submission received: 22 June 2025 / Revised: 11 July 2025 / Accepted: 21 July 2025 / Published: 23 July 2025

Abstract

To address the decline in measurement accuracy of magnetometers due to process errors and environmental interference, as well as the insufficient robustness of traditional calibration algorithms under strong interference conditions, this paper proposes an ellipsoid fitting algorithm based on Dynamic Adaptive Elite Particle Swarm Optimization (DAEPSO). The proposed algorithm integrates three enhancement mechanisms: dynamic stratified elite guidance, adaptive inertia weight adjustment, and inferior particle relearning via Lévy flight, aiming to improve convergence speed, solution accuracy, and noise resistance. First, a magnetometer calibration model is established. Second, the DAEPSO algorithm is employed to fit the ellipsoid parameters. Finally, error calibration is performed based on the optimized ellipsoid parameters. Our simulation experiments demonstrate that compared with the traditional Least Squares Method (LSM) the proposed method reduces the standard deviation of the total magnetic field intensity by 54.73%, effectively improving calibration precision in the presence of outliers. Furthermore, when compared to PSO, TSLPSO, MPSO, and AWPSO, the sum of the absolute distances from the simulation data to the fitted ellipsoidal surface decreases by 53.60%, 41.96%, 53.01%, and 27.40%, respectively. The results from 60 independent experiments show that DAEPSO achieves lower median errors and smaller interquartile ranges than comparative algorithms. In summary, the DAEPSO-based ellipsoid fitting algorithm exhibits high fitting accuracy and strong robustness in environments with intense interference noise, providing reliable theoretical support for practical engineering applications.

1. Introduction

In modern warfare, offensive weapons face stringent demands for precision strikes and rapid response. Guided munitions, with their high-accuracy target engagement and tactical flexibility, have become indispensable assets [1,2]. Their precision strike capability relies on accurate projectile attitude acquisition, where geomagnetic measurement—as a passive, all-weather, and globally applicable technology—is widely adopted for projectile navigation and attitude determination. As the core sensor, the magnetometer’s accuracy directly impacts attitude solution reliability and guidance stability. However, in practical applications, magnetometer readings are susceptible to various systematic errors caused by sensor manufacturing imperfections and environmental interference. Specifically, these errors can be categorized into (1) fabrication-induced errors such as sensitivity deviations, non-orthogonality, and zero-offset bias, and (2) environmental interference errors caused by hard-iron and soft-iron effects [3]. Thus, pre-launch calibration is essential to enhance measurement accuracy and ensure reliable attitude data.
Traditional calibration methods such as the Least Squares Method (LSM) and ellipsoid fitting have been widely adopted. For instance, Fang Xu et al. [4], Zhi Zuwei et al. [5], and Peng Jiabao et al. [6] all constructed models based on LSM to solve error parameters. However, LSM exhibits high sensitivity to outliers. Larger residuals become significantly amplified during squaring operations, causing model deviation from actual conditions. Moreover, such methods typically rely on matrix inversion or pseudo-inverse operations, resulting in poor numerical stability. Li Zhimin et al. [7] proposed an improved least squares ellipsoid fitting method based on Random Sample Consensus (RANSAC). Although this approach enhances robustness against abnormal data, RANSAC’s random sampling mechanism remains vulnerable to noise interference. Overall, traditional methods demonstrate insufficient noise resistance, failing to ensure calibration accuracy and stability.
To overcome these limitations, researchers have turned to intelligent optimization algorithms for magnetometer error calibration. For example, algorithms such as the artificial fish swarm algorithm [8], the dragonfly algorithm [9], the beetle swarm antenna search algorithm [10], the genetic algorithm [11], differential evolution [12], improved Particle Swarm Optimization (PSO) [13,14], the gray wolf optimizer algorithm [15,16], the dung beetle optimizer [17], and the moth–flame algorithm [18] have been applied to enhance accuracy and robustness. While these methods perform well in specific scenarios, they still exhibit robustness and efficiency shortcomings in complex environments. Consequently, developing high-precision, robust, and efficient calibration algorithms remains a critical research priority.
To address these challenges, this paper proposes a Dynamic Adaptive Elite Particle Swarm Optimization (DAEPSO)-based ellipsoid fitting algorithm, targeting high-precision triaxial magnetometer calibration in complex magnetic interference environments. Specifically, DAEPSO first performs ellipsoid fitting on raw magnetometer measurements. Then, an error compensation model is constructed using the optimized ellipsoid parameters, and, finally, the raw geomagnetic data is corrected via the calibrated model. The proposed method aims to enhance calibration accuracy, robustness, and convergence efficiency compared to the existing methods.

2. Calibration Model and Ellipsoid Fitting Method

2.1. Magnetometer Calibration Model

For triaxial magnetometer errors caused by manufacturing imperfections and environmental interference, the relationship between measured values and true values is expressed by Equation (1) [19]:
H m = K s i K n K s H r + H h + H 0
where H m is the actual measured value, H r is the ideal output value, K s i is the sensitivity error matrix, K n is the non-orthogonal error matrix, K s is the soft-iron error matrix, H h is the hard-iron error vector, and H 0 is the zero-offset error vector. Equation (1) can be further simplified as
H m = K H r + H
where K = K s i K n K s , H = K s i K n H h + H 0 . Based on Equation (2), the magnetometer error compensation model is derived as
H r = K 1 H m H
Under ideal conditions, the total geomagnetic field intensity measured by a triaxial magnetometer is constant | | H b | | , with measurements distributed on a sphere of radius | | H b | | . Based on Equation (3), the total intensity is
H b 2 = H r T H r = H m H T K 1 T K 1 H m H ;
that is
H m H T K 1 T K 1 H b 2 H m H = 1

2.2. Ellipsoid Fitting Method

In practical measurements, influenced by measurement errors, triaxial magnetometer output data typically distributes on an ellipsoidal surface with an off-origin center. A well-defined mathematical correspondence exists between this ellipsoid’s parameters and the magnetometer error model coefficients. Consequently, geomagnetic error calibration parameters can be obtained by solving ellipsoidal parameters [20].
As a specific type of quadric surface, the standard ellipsoid equation is expressed as
F ξ , z = ξ T z = a x 2 + b y 2 + c z 2 + 2 d x y + 2 e x z + 2 f y z + 2 p x + 2 q y + 2 r z + g = 0
where z = x 2 , y 2 , z 2 , 2 x y , 2 x z , 2 y z , 2 x , 2 y , 2 z , 1 T is the combined vector formed by the measured triaxial geomagnetic data, while ξ = a , b , c , d , e , f , p , q , r , g T is the ellipsoidal parameter vector.
An ellipsoid fitting model is established based on the least squares criterion [21]:
min ξ F ( ξ , z ) 2 = min ξ ξ T D T D ξ
where D is the measurement data matrix, defined as
D = x 1 2 y 1 2 z 1 2 2 x 1 y 1 2 x 1 z 1 2 y 1 z 1 2 x 1 2 y 1 2 z 1 1 x 2 2 y 2 2 z 2 2 2 x 2 y 2 2 x 2 z 2 2 y 2 z 2 2 x 2 2 y 2 2 z 2 1 x n 2 y n 2 z n 2 2 x n y n 2 x n z n 2 y n z n 2 x n 2 y n 2 z n 1
We rewrite the ellipsoid Equation (6) in vector form:
X X 0 T A X X 0 = 1
where A = a d e d b f e f c is the ellipsoid shape parameter matrix, while X 0 = A 1 p q r is the ellipsoid center coordinates.
Combining Equations (5) and (9), the parameter transformation relationship is derived:
( K 1 ) T K 1 H b 2 = G T G = A H = X 0
where G and K 1 can be obtained by the following equation [22]:
K 1 = | | H b | | G G = V D V 1
where G is a diagonal matrix whose elements are the square roots of the eigenvalues of A, and where V is the matrix composed of the eigenvectors of A. After determining the error correction K 1 and bias vector H, magnetometer calibration is performed using Equation (3).

3. DAEPSO-Based Ellipsoid Fitting Algorithm

3.1. Standard PSO

The Particle Swarm Optimization (PSO) algorithm is a metaheuristic technique inspired by collective biological behavior, drawing on the collaborative exploration observed in bird flock foraging. In PSO, each particle represents a candidate solution in the search space, characterized by a position vector x and velocity vector v. Particles iteratively adjust their velocities by leveraging their personal best position p b e s t and the swarm’s global best position g b e s t , guiding the search toward optimal regions [23]. The velocity and position update equations in standard PSO are expressed as follows:
v i t + 1 = ω · v i t + c 1 · r 1 ( p b e s t i t x i t ) + c 2 · r 2 ( g b e s t t x i t ) x i t + 1 = x i t + v i t + 1
where v i t and x i t denote the velocity vector and position vector of particle i at iteration t, w is the inertia weight controlling particle momentum retention, c 1 and c 2 are acceleration factors weighting individual and social cognition, p b e s t i t represents the historical best position of particle i at iteration t, g b e s t t indicates the global best position of the swarm through iteration t, and r 1 , r 2 denotes uniformly distributed random variables.

3.2. Improvement Strategies of DAEPSO Algorithm

During particle swarm optimization, balancing “exploration” of the solution space and “exploitation” of potential high-quality solutions is critical for enhancing global optimization capability. To efficiently search for global optima, the algorithm must dynamically balance exploration and exploitation across different phases: maintaining sufficient population diversity to broaden the search scope in the early stages, while focusing on promising regions to improve convergence precision in later phases. However, traditional PSO often lacks adaptive control mechanisms for this balance when handling complex problems, leading to local optima entrapment and limited search performance. To address this, this paper proposes a Dynamic Adaptive Elite Particle Swarm Optimization (DAEPSO) algorithm, which significantly enhances optimization through three core mechanisms:
(1)
Dynamic stratified elite guidance: Dynamically divides particles into elite and ordinary layers based on individual fitness and crowding distance, utilizing elite particles’ search experience to guide ordinary particles’ exploration direction.
(2)
Dynamic inertia weight adjustment: Adaptively adjusts inertia weight according to iteration progress.
(3)
Lévy flight-based relearning for inferior particles: Implements Lévy flight for resampling particles trapped in low-quality regions, guiding escape from local optima.

3.2.1. Dynamic Stratified Elite Guidance Mechanism

(1)
Elite Measurement and Dynamic Stratification
In each iteration, the algorithm evaluates particles based on fitness values and crowding distance. The particles are sorted in descending order by the product of these two metrics, with the top E r · N P particles forming the elite layer and the remainder forming the ordinary layer, as shown in Equation (13):
X = s o r t f · d E p = x i X | i = 1 , 2 , , E r · N P N p = x i X | i = E r · N P , , N P
where X denotes the set of particles sorted according to the product of fitness value and crowding distance, N P denotes the population size of the particle swarm, E p denotes the elite particle set, N p represents the ordinary particle set, E r indicates the elite proportion, argmax sorts particles by fitness-crowding distance product, f is the fitness value, and d is the crowding distance, calculated as
d i = f i + 1 f i 1 f m i n f m a x
where f m a x and f m i n refer to the maximum and minimum fitness values in the current iteration, respectively. Subsequently, the elite proportion is dynamically adjusted based on the swarm’s average crowding distance to balance exploration and exploitation needs throughout the search. The adjustment function is designed as
E r = r m i n + ( r m a x r m i n ) d m e a n d m i n d m a x d m i n
where r m i n and r m a x are the lower/upper bounds of the elite proportion, d m i n and d m a x are the lower/upper bounds of the crowding distance, and d m e a n is the average crowding distance at the current iteration.
(2)
Differentiated Updates for Elite and Ordinary Layers
During particle updates, the algorithm applies distinct update strategies based on particle stratification.
Elite Layer:
Elite particles locate in promising regions, primarily performing local exploitation. Their updates follow standard PSO (Equation (12)), but with the individual learning factor c 1 e = 2.0 and the social learning factor c 2 e = 1.5 to intensify historical best utilization for refined searching.
Ordinary Layer:
As exploration agents, ordinary particles incorporate elite guidance to enhance convergence toward high-quality regions. Their update formula is
v i t + 1 = w · v i t + c 1 n · r 1 ( p b e s t i t x i t ) + c 2 n · r 2 ( g b e s t i t x i t ) + c 3 n · r 3 · e g u i d e x i t + 1 = x i t + v i t + 1
where c 1 n , c 2 n , c 3 n denote the learning factors for personal best, global best, and elite guidance, with values of 1.5, 2.0, and 0.2, respectively, while e g u i d e is the elite guidance term defined as the mean positional difference between the current particle and the randomly selected elites:
e g u i d e = 1 k j ε k x j x i
where ε k represents a random subset (20% of elite particles) from E p .

3.2.2. Dynamic Inertia Weight Adjustment Mechanism

Inertia weight is a key parameter in PSO that balances particle search scope and convergence speed. This paper employs a dynamic adjustment method based on a cosine annealing strategy. This approach enables smooth decay of inertia weight, enhancing global search capability in the early stages while gradually transitioning to local exploitation later, effectively avoiding premature convergence and improving final precision. The adjustment formula is
w = w m i n + 1 2 w m i n w m a x 1 + c o s π · t T m i n
where w m i n and w m a x denote the minimum and maximum inertia weights, t represents the current iteration count, and T indicates the maximum iteration count.

3.2.3. Lévy Flight-Based Relearning for Inferior Particles

To further enhance global exploration in complex search spaces, this paper introduces a Lévy flight-based relearning mechanism for inferior particles based on dynamic stratified elite guidance, directing disadvantaged individuals to escape local optima.
The specific procedure is as follows: First, sort particles by fitness and select the bottom 10% as the inferior particle set. Unlike random re-initialization or undirected perturbation, this mechanism incorporates precomputed elite guidance with Lévy flight disturbance during updates:
x n e w t + 1 = e g u i d e + L e v y
This mechanism combines a Lévy flight’s long-jump capability with elite-guided directional constraints, enhancing escape from local optima while increasing perturbation effectiveness and reducing futile exploration, thereby strengthening algorithm robustness and diversity.
Figure 1 illustrates the complete DAEPSO algorithm workflow.
The detailed process of the proposed DAEPSO algorithm is illustrated in Algorithm 1 as pseudocode.
Algorithm 1: Pseudocode of DAEPSO.
Mathematics 13 02349 i001

3.3. DAEPSO-Based Ellipsoid Fitting Algorithm

Traditional ellipsoid fitting methods use least squares to fit data points to an ellipsoidal model, but their sensitivity to noise and outliers often causes fitting deviations. To address this, this paper proposes a DAEPSO-based ellipsoid fitting algorithm that leverages a particle swarm cooperative search for global optimization to achieve high-precision ellipsoid parameter estimation.

3.3.1. Fitness Function

The core objective is to accurately fit optimal ellipsoid parameters ξ , using DAEPSO. To evaluate the fitting quality, the sum of the squared distances from the data points to the ellipsoidal surface is adopted as the fitness function, given by Equation (20):
L ξ = i = 1 N f x i , y i , z i 2
where N denotes the total number of sampling points,
f ( x , y , z ) = a x 2 + b y 2 + c z 2 + 2 d x y + 2 e x z + 2 f y z + 2 p x + 2 q y + 2 r z + g

3.3.2. DAEPSO Parameter Initialization

The initial parameters for DAEPSO are listed in Table 1. These values are set based on preliminary experiments and common practices in the literature to ensure a balance between convergence speed and solution quality.

4. Simulation Experiment Verification

4.1. Simulated Data Generation and Experimental Setup

To validate the effectiveness and robustness of the proposed DAEPSO-based ellipsoid fitting algorithm under complex magnetic interference, a numerical simulation environment was constructed based on the attitude resolution model of triaxial magnetometers [24]. The simulation experiments were conducted on a personal computer equipped with an AMD Ryzen 7 8845H processor, 24 GB of RAM, and MATLAB R2022b. One thousand sets of randomly generated ideal triaxial geomagnetic data were used, with the total geomagnetic field intensity set to 50 µT. To simulate practical error interference, five typical errors were introduced: hard-iron, soft-iron, sensitivity, non-orthogonal, and zero-offset errors. The parameter settings for each error are listed in Table 2 [25].
Based on this data, multiple comparative experiments were designed to comprehensively evaluate DAEPSO’s performance. First, geomagnetic data correction was performed, using both DAEPSO-based ellipsoid fitting and LSM-based ellipsoid fitting algorithms, with detailed comparative analysis. Second, to further demonstrate DAEPSO’s superiority, standard PSO [26], Two-Swarm Learning Particle Swarm Optimization (TSLPSO) [27], Modified Particle Swarm Optimization (MPSO) using adaptive strategy [28], and a novel sigmoid-function-based Adaptive Weighted Particle Swarm Optimizer (AWPSO) [29] were integrated with ellipsoid fitting. Systematic analysis of the algorithmic differences was conducted by comparing the optimization results.

4.2. Comparison with LSM

To verify the robustness of DAEPSO in handling outlier-contaminated data, 2% outlier noise was introduced to the standard dataset to simulate extreme measurement errors. Comparative experiments with LSM-based ellipsoid fitting were conducted to evaluate fitting stability under outlier interference.
Figure 2 and Figure 3 display geomagnetic data distributions before and after calibration for both algorithms with outliers. Our observations show that LSM’s sensitivity to outliers causes corrected results to significantly deviate from ideal spherical topology in 3D space. In contrast, DAEPSO maintains smooth geometric structure and distribution despite outlier noise, demonstrating notable robustness.
For quantitative assessment of the fitting effects, Figure 4 shows variations in the total magnetic field intensity before and after correction. Before correction, affected by errors, the total intensity exhibited significant fluctuations; excluding the outlier data, its standard deviation reached 11.70 µT. After calibration by LSM-based ellipsoid fitting, the standard deviation decreased to 1.48 µT, yet the results still deviated from the ideal values. In contrast, the DAEPSO-based ellipsoid fitting substantially improved the calibration accuracy, with the corrected total intensity converging closer to the theoretical values and the standard deviation further reduced to 0.67 µT, achieving a 54.73% reduction compared to the LSM.
These results confirm DAEPSO’s stronger anti-interference capability with outlier-contaminated data. Compared to the LSM, DAEPSO effectively suppresses outlier impact, delivering more stable and reliable fitting models.

4.3. Comparison with PSO Variants

To further verify the performance advantages of DAEPSO, comparative analysis was conducted against traditional PSO, TSLPSO, MPSO, and AWPSO. The key parameters for each algorithm are listed in Table 3.
For the quantitative fitting performance analysis (excluding outliers), the sum of the absolute distances from the data points to the fitted ellipsoidal surface served as the evaluation metric. Figure 5 shows the performance differences under this metric. The results indicate that DAEPSO achieved the sum of 700.91 µT—reducing by 53.60% versus traditional PSO (1510.66 µT). Superiority remained significant against variants: 41.96% reduction versus TSLPSO (1207.58 µT), 53.01% versus MPSO (1491.66 µT), and 27.40% versus AWPSO (965.42 µT). This confirms DAEPSO’s enhanced search capability.
Figure 6 illustrates the fitness convergence curves of different algorithms during the optimization process, enabling a comparative analysis of their convergence performance. As shown in the figure, the proposed DAEPSO algorithm exhibited a faster reduction in fitness values during the early iterations and achieved convergence with fewer iterations compared to the benchmark algorithms, including PSO, TSLPSO, MPSO, and AWPSO. These results confirm the superior global search efficiency of DAEPSO.
To further evaluate stability, 60 independent trials per algorithm were executed. The Mean Absolute Error (MAE) between the simulated data and the fitted ellipsoid was statistically analyzed via boxplots (Figure 7). DAEPSO yielded a median error of 0.84 µT, significantly lower than PSO (1.86 µT), TSLPSO (1.77 µT), MPSO (1.95 µT), and AWPSO (1.00 µT). Its Interquartile Range (IQR) of 0.21 µT also outperformed the others: PSO (0.45 µT), TSLPSO (0.54 µT), MPSO (0.34 µT), AWPSO (0.22 µT).
In summary, DAEPSO not only surpassed the existing PSO variants in optimal solution accuracy but also maintained higher consistency and smaller fluctuation ranges across repeated trials, robustly validating its reliability in complex environments.

5. Conclusions

This paper proposes an enhanced Particle Swarm Optimization algorithm (DAEPSO) that integrates dynamic stratified elite guidance, adaptive inertia weight adjustment, and Lévy flight-based relearning for inferior particles, aimed at high-precision triaxial magnetometer calibration. Applied to ellipsoid fitting, the method effectively addresses the limitations of conventional approaches under strong interference and outlier conditions. Comparative analysis with the LSM, traditional PSO, TSLPSO, MPSO, and AWPSO validates the method’s effectiveness, yielding the following key conclusions:
(1)
Compared to the LSM, DAEPSO-based ellipsoid fitting demonstrates superior anti-interference capability and higher precision when processing outlier-contaminated data, effectively mitigating outlier impact while maintaining stability.
(2)
Compared to traditional PSO, TSLPSO, MPSO, and AWPSO, DAEPSO more efficiently locates global optima in ellipsoid fitting and exhibits enhanced reliability and consistency across repeated trials.
In summary, the proposed DAEPSO-based ellipsoid fitting algorithm shows advantages in interference resistance, convergence efficiency, and robustness, offering a promising and scalable calibration solution for magnetometers and potentially other sensors.
Future research will focus on two main directions: First, the development of a real-time dynamic calibration method based on DAEPSO to address the variations and interferences encountered by magnetometers in practical applications, ensuring precise calibration in rapidly changing environments. Second, further optimization of the DAEPSO algorithm will be pursued to enhance its convergence speed and global search capability, exploring more efficient heuristic strategies and adaptive adjustment mechanisms. These improvements will enhance the real-time performance and robustness of DAEPSO, expanding its applicability in real-world engineering scenarios.

Author Contributions

Conceptualization, L.H.; project administration, Z.C., J.G., J.H. and W.Y. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the National Natural Science Foundation of China (Grant numbers: 62203191), the Basic Science (Natural Science) Research Projects in Higher Education Institutions (Grant numbers: 22KJB590001), the National Defence Key Laboratory of Science and Technology (Grant numbers: 2022JCJQLB06105), the Postdoctoral Fellowship Program (Grade B) of China Postdoctoral Science Foundation (Grant numbers: GZB20240980), and the China Postdoctoral Science Foundation (Grant numbers: 2024M754148).

Data Availability Statement

The data is contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Ding, Y.; Yue, X.; Chen, G.; Si, J. Review of control and guidance technology on hypersonic vehicle. Chin. J. Aeronaut. 2022, 35, 1–18. [Google Scholar] [CrossRef]
  2. Gao, Z.; Yi, W. Integrated guidance and control design based on optimized sparrow search algorithm for sliding mode pid controller parameters. Int. J. Aeronaut. Space Sci. 2025, prepublish. [Google Scholar] [CrossRef]
  3. Long, D.; Zhang, X.; Wei, X.; Luo, Z.; Cao, J. A fast calibration and compensation method for magnetometers in strap-down spinning projectiles. Sensors 2018, 18, 4157. [Google Scholar] [CrossRef] [PubMed]
  4. Li, X.; Li, L.; Tang, K.; Wang, Y.; Cheng, J.; Yan, Q.; Huang, Z. Numerical simulation of the sensor output on macau science satellite-1. Earth Planet. Phys. 2023, 7, 136–143. [Google Scholar] [CrossRef]
  5. Fang, J.; Sun, H.; Cao, J.; Zhang, X.; Tao, Y. A novel calibration method of magnetic compass based on ellipsoid fitting. IEEE Trans. Instrum. Meas. 2011, 60, 2053–2061. [Google Scholar] [CrossRef]
  6. Wang, M.; Wang, Y.; Peng, L.; Ye, C. Measurement of triaxial magnetocardiography using high sensitivity tunnel magnetoresistance sensor. IEEE Sens. J. 2019, 19, 9610–9615. [Google Scholar] [CrossRef]
  7. Li, Z.; Lai, J.; Lyu, P.; Zhang, Q. Experimental design for rapid calibration of three-axis magnetic sensors based on ellipsoidal fitting. Exp. Technol. Manag. 2023, 40, 42–47. [Google Scholar]
  8. Gong, X.; Song, Z.; Xi, X. Error calibration of three axis magnetometer based on global artificial fish swarm algorithm. In Proceedings of the 2013 IEEE International Conference of IEEE Region 10 (TENCON 2013), Xi’an, China, 22–25 October 2013; pp. 1–4. [Google Scholar]
  9. Yang, L.; Li, C.; Zhang, S.; Xu, C.; Chen, H.; Xiao, S.; Tang, X.; Li, Y. Correction method of three-axis magnetic sensor based on da–lm. Metals 2022, 12, 428. [Google Scholar] [CrossRef]
  10. Li, X.; Yan, S.; Liu, J.; Sun, Y.; Yan, Y. Partition beetles antennae search algorithm for magnetic sensor calibration optimization. IEEE Sens. J. 2021, 21, 5967–5974. [Google Scholar] [CrossRef]
  11. Hu, M.; Li, J.; Dong, Y.; Zhang, Z.; Liu, W.; Zhang, P.; Ping, Y.; Jiang, L.; Yu, Z. Mixed-ggnas: Mixed search-space nas based on genetic algorithm combined with gradient descent for medical image segmentation. Expert Syst. Appl. 2025, 289, 128338. [Google Scholar] [CrossRef]
  12. Pang, H.; Zhang, Q.; Wang, W.; Wang, J.; Li, J.; Luo, S.; Wan, C.; Chen, D.; Pan, M.; Luo, F. Calibration of three-axis magnetometers with differential evolution algorithm. J. Magn. Magn. Mater. 2013, 346, 5–10. [Google Scholar] [CrossRef]
  13. Huang, H.; Wang, P.; Shen, H. Magnetometer error compensation algorithm based on immune adaptation particle swarm optimization algorithm. In Proceedings of the 2021 International Conference on Sensing, Measurement & Data Analytics in the era of Artificial Intelligence (ICSMD), Xi’an, China, 21–23 October 2021; pp. 1–5. [Google Scholar]
  14. Wu, Z.; Wu, Y.; Hu, X.; Wu, M. Calibration of three-axis magnetometer using stretching particle swarm optimization algorithm. IEEE Trans. Instrum. Meas. 2013, 62, 281–292. [Google Scholar] [CrossRef]
  15. Lei, X.; Zhang, X.; Hao, Y. An intelligent ellipsoid calibration method based on the grey wolf algorithm for magnetic compass. J. Bionic Eng. 2021, 18, 453–461. [Google Scholar] [CrossRef]
  16. Shaikh, M.S.; Hua, C.; Jatoi, M.A.; Ansari, M.M.; Qader, A.A. Application of grey wolf optimisation algorithm in parameter calculation of overhead transmission line system. IET Sci. Meas. Technol. 2021, 15, 218–231. [Google Scholar] [CrossRef]
  17. Gao, Z.; Yi, W. Optimizing projectile aerodynamic parameter identification of kernel extreme learning machine based on improved dung beetle optimizer algorithm. Measurement 2025, 239, 115473. [Google Scholar] [CrossRef]
  18. Shaikh, M.S.; Raj, S.; Babu, R.; Kumar, S.; Sagrolikar, K. A hybrid moth–flame algorithm with particle swarm optimization with application in power transmission and distribution. Decis. Anal. J. 2023, 6, 100182. [Google Scholar] [CrossRef]
  19. Klingbeil, L.; Eling, C.; Zimmermann, F.; Kuhlmann, H. Magnetic field sensor calibration for attitude determination. J. Appl. Geod. 2014, 8, 97–108. [Google Scholar] [CrossRef]
  20. Hu, F.; Wu, Y.; Yu, Y.; Nie, J.; Li, W.; Gao, Q. An improved method for the magnetometer calibration based on ellipsoid fitting. In Proceedings of the 2019 12th International Congress on Image and Signal Processing, BioMedical Engineering and Informatics (CISP-BMEI), Huaqiao, China, 19–21 October 2019; pp. 1–5. [Google Scholar]
  21. Pang, H.; Pan, M.; Chen, J.; Li, J.; Zhang, Q.; Luo, S. Integrated calibration and magnetic disturbance compensation of three-axis magnetometers. Measurement 2016, 93, 409–413. [Google Scholar] [CrossRef]
  22. Cui, S.; Cui, L.; Du, Y.; Chai, S.; Zhang, B. Calibration of mems accelerometer using kaiser filter and the ellipsoid fitting method. In Proceedings of the 2018 37th Chinese Control Conference (CCC), Wuhan, China, 25–27 July 2018; pp. 4679–4684. [Google Scholar]
  23. Jain, M.; Saihjpal, V.; Singh, N.; Singh, S.B. An overview of variants and advancements of pso algorithm. Appl. Sci. 2022, 12, 8392. [Google Scholar] [CrossRef]
  24. Zhao, H.; Su, Z.; Liu, F.; Li, C.; Li, Q. Magnetometer-based phase shifting ratio method for high spinning projectile’s attitude measurement. IEEE Access 2019, 7, 22509–22522. [Google Scholar] [CrossRef]
  25. Guan, J.; Chen, Z.; Jiang, G. Research on calibration method of triaxial magnetometer based on improved pso-ellipsoid fitting algorithm. Electronics 2025, 14, 1778. [Google Scholar] [CrossRef]
  26. Gad, A.G. Particle swarm optimization algorithm and its applications: A systematic review. Arch. Comput. Methods Eng. 2022, 29, 2531–2561. [Google Scholar] [CrossRef]
  27. Li, X.; Zhang, Y.; Hu, W. Ensemble learning training strategy based on multi-objective particle swarm optimization and chasing method. Expert Syst. Appl. 2025, 281, 127777. [Google Scholar] [CrossRef]
  28. Liu, H.; Zhang, X.W.; Tu, L.P. A modified particle swarm optimization using adaptive strategy. Expert Syst. Appl. 2020, 152, 113353. [Google Scholar] [CrossRef]
  29. Liu, W.; Wang, Z.; Yuan, Y.; Zeng, N.; Hone, K.; Liu, X. A novel sigmoid-function-based adaptive weighted particle swarm optimizer. IEEE Trans. Cybern. 2021, 51, 1085–1093. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Workflow of the DAEPSO algorithm.
Figure 1. Workflow of the DAEPSO algorithm.
Mathematics 13 02349 g001
Figure 2. Data distribution before and after calibration using LSM-based ellipsoid fitting.
Figure 2. Data distribution before and after calibration using LSM-based ellipsoid fitting.
Mathematics 13 02349 g002
Figure 3. Data distribution before and after calibration using DAEPSO-based ellipsoid fitting.
Figure 3. Data distribution before and after calibration using DAEPSO-based ellipsoid fitting.
Mathematics 13 02349 g003
Figure 4. Total magnetic field intensity comparison before/after calibration.
Figure 4. Total magnetic field intensity comparison before/after calibration.
Mathematics 13 02349 g004
Figure 5. Absolute distances from simulation data to ellipsoid surface.
Figure 5. Absolute distances from simulation data to ellipsoid surface.
Mathematics 13 02349 g005
Figure 6. Fitness convergence curves of different PSO algorithms.
Figure 6. Fitness convergence curves of different PSO algorithms.
Mathematics 13 02349 g006
Figure 7. MAE boxplots for 60 independent runs across algorithms.
Figure 7. MAE boxplots for 60 independent runs across algorithms.
Mathematics 13 02349 g007
Table 1. Initialization parameter settings for DAEPSO.
Table 1. Initialization parameter settings for DAEPSO.
ParameterSymbolValue/Range
Population size N P 100
Parameter dimension d i m 10
Maximum iterationsT500
Inertia weight ω m i n , ω m a x 0.5, 0.7
Table 2. Parameters for magnetometer simulation model.
Table 2. Parameters for magnetometer simulation model.
NameValue
Geomagnetic intensity/µT50
Magnetic declination/ 5.8
Magnetic inclination/ 49.0
Sensitivity coefficients [ 1.113 0.904 1.107 ]
Non-orthogonal angles [ 0.0028 0.0026 0.0035 ]
Zero-offset error/µT [ 2.0 3.0 4.0 ] T
Soft-iron error 0.84 0.053 0.026 0.082 0.72 0.012 0.016 0.034 0.83
Hard-iron error/µT [ 10.0 30.0 10.0 ] T
Table 3. Optimization algorithm parameters.
Table 3. Optimization algorithm parameters.
AlgorithmParameters
PSO c 1 = 1.5 , c 2 = 2.5 , w : 0.7 0.5
TSLPSO c 1 = c 2 = 1.5 , c 3 : 0.5 2.5 , w : 0.9 0.4
MPSO c 1 = c 2 = 2 , w : 0.9 0.4
AWPSO w : 0.9 0.5 , a = 0.000035 · m , b = 0.5 , c = 0 , d = 1.5
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Huang, L.; Chen, Z.; Guan, J.; Huang, J.; Yi, W. Offline Magnetometer Calibration Using Enhanced Particle Swarm Optimization. Mathematics 2025, 13, 2349. https://doi.org/10.3390/math13152349

AMA Style

Huang L, Chen Z, Guan J, Huang J, Yi W. Offline Magnetometer Calibration Using Enhanced Particle Swarm Optimization. Mathematics. 2025; 13(15):2349. https://doi.org/10.3390/math13152349

Chicago/Turabian Style

Huang, Lei, Zhihui Chen, Jun Guan, Jian Huang, and Wenjun Yi. 2025. "Offline Magnetometer Calibration Using Enhanced Particle Swarm Optimization" Mathematics 13, no. 15: 2349. https://doi.org/10.3390/math13152349

APA Style

Huang, L., Chen, Z., Guan, J., Huang, J., & Yi, W. (2025). Offline Magnetometer Calibration Using Enhanced Particle Swarm Optimization. Mathematics, 13(15), 2349. https://doi.org/10.3390/math13152349

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop