High-Order Extended Kalman Filter for State Estimation of Nonlinear Systems

: In general, the extended Kalman filter (EKF) has a wide range of applications, aiming to minimize symmetric loss function (mean square error) and improve the accuracy and efficiency of state estimation. As the nonlinear model complexity increases, rounding errors gradually amplify, leading to performance degradation. After multiple iterations, divergence may occur. The traditional extended Kalman filter cannot accurately estimate the nonlinear model, and these errors still have an impact on the accuracy. To improve the filtering performance of the extended Kalman filter (EKF), this paper proposes a new extended Kalman filter (REKF) method that utilizes the statistical properties of the rounding error to enhance the estimation accuracy. After establishing the state model and measurement model, the residual term is used to replace the higher-order term in the Taylor expansion, and the least squares method is applied to identify the residual term step by step. Then, the iterative process of updating the extended Kalman filter is carried out. Within the Kalman filter framework, a higher-order rounding error-based extended Kalman filter (REKF) is designed for the joint estimation of rounding error and random variables, and the solution method for the rounding error is considered for the multilevel approximation of the original function. Through numerical simulations on a general nonlinear model, the higher-order rounding error-based extended Kalman filter (REKF) achieves better estimation results than the extended Kalman filter (EKF) and improves the filtering accuracy by utilizing the higher-order rounding error information, which also proves the effectiveness of the proposed method.


Introduction
The Kalman filter (KF) is a popular state estimation algorithm used in a variety of applications, including localization, navigation, sensor networks, and battery management [1].The Kalman filter estimates the state for a linear system and obtains an optimal estimate in the presence of stochastic disturbances; therefore, the KF method is also known as the optimal linear estimation method [2].The KF is based on the minimum mean square error for state estimation, and the state estimation process can be regarded as a filtering process because the state and the observed data are usually affected by system noise [3].The KF is a recursive estimation algorithm that iteratively obtains updated state values and predicted values.It provides a powerful tool to deal with the state estimation problem of linear systems [4].However, many engineering systems cannot be described by simple linear systems.For example, the autopilot system of a car and the target tracking system of a drone are complex nonlinear systems.If we only use the Kalman filter (KF) for state estimation, it cannot reach the accuracy we need.When the drone performs tracking tasks or the car turns on the autopilot system, it may cause serious accidents.In 2023, in San Francisco, United States, more than 700 cases of car accidents occurred involving automated vehicles that failed to slow down, resulting in hundreds of deaths.Most of these autopilot Symmetry 2024, 16, 617 2 of 18 incidents were the result of insufficient accuracy.For this reason, improving the accuracy of the algorithm is a very important task.In order to solve the problem of nonlinear systems, they need to be converted into linear systems to be solved.Usually, the extended Kalman filter (EKF) is used to deal with nonlinear systems.The EKF algorithm is an algorithm adapted to a variety of complex systems [5].Currently, the extended Kalman filter (EKF) has successfully become the most widely used state observer for nonlinear systems [6].The EKF is used in systems with zero-mean Gaussian process uncertainty and measurement noise [7].The EKF is an extension of the KF for nonlinear dynamical systems in that it provides a more accurate estimate of the state when the modeling of the dynamical system exactly matches the dynamics it describes.The system is linearized around the predicted state estimates [8].The state estimation process can also be viewed as a filtering process since the state and the observed data are usually affected by system noise.The traditional extended Kalman filter (EKF) has been successfully applied to many systems.The EKF uses a Taylor expansion of the nonlinear part of the model at the estimates, and linearization is achieved by a first-order approximation, which transforms the nonlinear problem into a linear KF problem [9].However, when the linearization error is large and the model is uncertain, the performance of the EKF will be greatly reduced, and even divergence phenomena can be observed [10,11].This paper proposes a method to utilize the rounding error to solve the EKF problem.In this paper, we propose a new extended Kalman filter (EKF) method designed to enhance estimation accuracy by leveraging the statistical properties of the rounding error [12,13].This approach involves approximating the rounding error using a multilevel approximation of the original function and substituting the rounded higher-order term with the residual term in the traditional extended Kalman filter.This modification aims to address nonlinear equations more accurately and stably, making it particularly suitable for engineering systems [14].
The first section introduces KF and EKF's importance in applied systems, shows that EKF falls short in certain complex systems' requirements, and proposes a new REKF method to improve precision.The second part mainly explains the principles and calculations of EKF and REKF, compares their performances, and analyzes their theoretical advantages and disadvantages in accuracy and stability.In the third part, MATLAB simulations are conducted to verify the stability and accuracy of the REKF method.Lastly, the article summarizes REKF's advantages and looks toward the future.

Principle of EKF Algorithm
The mathematical structure of the extended Kalman filter (EKF) is very simple and uses a recursive approach, where the a posteriori estimate obtained from the last computation is used as the a priori estimate for the next computation [15], and each time, the current state estimate is computed recursively from only the measured variables from the previous computation, which is able to give optimal estimates for the system variables, and the second-order and higher terms are omitted from the Taylor expansion to obtain an approximately linear model [16].
A class of systems exists where the equations of state are nonlinear and the observation equations are linear: in this paper, the rounding error rounded off after Taylor expansion is considered, where ξ(k) represents the rounding error of the Taylor expansion of a higher order.Definition 1.Consider the following time-invariant stochastic differential equation.
where f (•) and h(•) represent the state equation and measurement equation, respectively, Symmetry 2024, 16, 617 3 of 18 state vector, y(k + 1) ∈ R m is the m dimensional measurement vector, and w(k) and v(k + 1) are the state modeling error noise vector and measurement error noise vector, respectively.f (x(k)) is a nonlinear functional model of the state, with x(k), w(k), k as the common actions.For the state, there are x(k) with order derivatives continuous up to r, and order derivatives exist at r + 1. h(x(k + 1)) is a nonlinear functional model of the state with x(k + 1), v(k + 1), k + 1.The vectors w ∼ N(0, Q) and v ∼ N(0, R) are independent and obey Gaussian distributions.The Gaussian random variables denote the process noise and the measurement noise, respectively, whose corresponding covariance matrices are Q and R, and they also satisfy the following statistical properties: The filtered estimate at time k is regarded as x(k|k).The nonlinear function f (x(k)) of the state equation in Equation ( 1) is Taylor-expanded at x(k|k).
By omitting the second-order and its higher-order term, the following is obtained: In Equation ( 5), let: The equation of the state with noise x(k + 1) is as follows: The nonlinear part h(x(k + 1)) in Formula (2) is expanded by the Taylor formula in the estimate x(k + 1|k).

of 18
The measurement equation can be approximately represented as: where x(k + 1|k) is the state prediction value of the Kalman filter, y(k + 1) is the measurement observation of the Kalman filter, A(k + 1|k) and H(k + 1) are the first-order Jacobi matrices of the nonlinear model of the system where the state equation and the observation equation are derived at x(k|k) and x(k + 1|k), and △ f ( x(k|k)) and △h( x(k + 1|k)) are known terms of the Taylor expansion of the equations of state and observation and can be regarded as a constant term.
Extending the prediction and update process of the Kalman filter: The prediction estimates and prediction error values for the state equations in the model can be obtained according to Equation (8): Projected estimates: Predicted error value: The measurement estimates and measurement estimation errors of the measurement equations in the model can be obtained according to Equation ( 13): Measurement estimate: Measurement estimation error: Predicted error covariance: The filter values for the Kalman observer with time-varying gain are as follows: According to the orthogonality principle E x(k + 1|k + 1)y T (k + 1) = 0, the Kalman gain K(k + 1) is solved for: The state x(k + 1) estimation error covariance was calculated: According to the standard extended Kalman filter, the statistical properties of the initial state x(0) are known: , where x(k + 1|k) is the estimation error, ŷ(k + 1|k) is the prediction observation, y(k + 1|k) is the error, P xx (k + 1|k) and P xx (k + 1|k + 1) represent the prediction error covariance and estimation error covariance, K(k + 1) represents the Kalman gain, and x(k + 1|k + 1) represents the filtered value of the extended Kalman.

Extended Kalman Filter with Residuals (REKF)
Based on the extended Kalman filter (EKF), the consideration of higher-order terms in the Taylor expansion of the state equation can further improve the model's accuracy by introducing residuals to replace the higher-order terms.By applying the least squares method step by step to identify the higher-order terms replaced by residuals, the residual extended Kalman filter (REKF) enhances the utilization of the effects of higher-order terms compared to the EKF.This can reflect the real dynamics of the system more accurately so as to improve the filtering accuracy.This method is particularly suitable for systems with strong nonlinearity and can effectively enhance the accuracy of state estimation.

Extended Kalman Filtering Using Residual Terms Instead of Higher-Order Terms
Assumption 1.In Equation ( 1), the equation of state x(k + 1) has continuity up to the order derivative of r, and the order derivative of r + 1 exists.
The nonlinear function f (x(k)) in the model when Assumption 1 holds is given by the x(k|k) Taylor expansion: Replace the second-order term and its higher-order term with the residual term of the equation of state: Among these, ξ(k) = ξ 1 (k), ξ(k) represents the second order of the Taylor expansion and its higher-order terms.
The residual term in the equation of state is first identified by the least squares method.The identification process is as follows: Replace the second-order term of the Taylor expansion with a residual term in the equation for which the Taylor expansion is performed at x(k|k): Bring Equation (24) into the observation equation: Reduce ( 25) to (26): Among these, y (1) (k + 1) and v (1) (k + 1).The parameters are as follows: Symmetry 2024, 16, 617 6 of 18 Based on the least squares method, ξ 1 (k), ξ 1 (k) in ( 26) is identified as a Gaussian distribution with ξ1 (k|k) as the variance and P ξ (1) (k|k) as the variance, ξ 1 (k) ∼ [ ξ1 (k|k), P ξ (1) (k|k)].The identification process is as follows: Judge whether to meet the system accuracy requirements: By setting the threshold λ, determine whether the paradigm ∥ ξ1 (k|k) ∥ < λ of the estimate of the residual term is valid.If it is valid, then it means that the Taylor expansion only needs to be expanded to the second order to reach the accuracy needed.If it is not valid, then the Taylor expansion needs to continue (the specific parameters are in Appendix A).
It can be recursively proved up to order 2 and r − 1: Appendix B.
Definition 2. According to the mathematical induction method, it can be deduced to the order of r + 1.Assuming that the system accuracy requirement is satisfied when the Taylor expansion is carried out to the order of r + 1, the residual term ξ r (k|k) is used to replace the order term of r + 1 after the Taylor expansion, ξr (k|k) is the valid information extracted from ξ r−1 (k|k), and ξ r−1 (k|k) is attributed to ξ r (k|k) after the feature extraction.Moreover, Bring Equation (29) into the observation equation: Organize (30) as: The parameter is y (r) (k + 1).The equation is: The parameter is v (r) (k + 1).The equation is: Using the least squares method, the identification parameters ξ r (k), ξ r (k) conform to a Gaussian distribution, with ξr (k|k) as the mean and P ξ (r) (k|k) as the variance: In nonlinear models, when the Taylor expansion is carried out up to the nth order, the approximation is valid, satisfying the required system accuracy, and the parameter identification for all the higher-order terms is complete, with the residual term replacing the higher-order terms (the specific parameters are in Appendix C).
REKF algorithm flow chart (Figure 1): In nonlinear models, when the Taylor expansion is carried out up to the nth order, the approximation is valid, satisfying the required system accuracy, and the parameter identification for all the higher-order terms is complete, with the residual term replacing the higher-order terms (the specific parameters are in Appendix C).

REKF Implementation Projections and Updates
The nonlinear observation equations and nonlinear state equations have been linearized, allowing the prediction and update steps to be performed in accordance with the Kalman filtering process.This approach streamlines and optimizes the overall filtering procedure.The process is shown in figure1, and the steps are as follows: The state and observation equations for a class of nonlinear system models are:

REKF Implementation Projections and Updates
The nonlinear observation equations and nonlinear state equations have been linearized, allowing the prediction and update steps to be performed in accordance with the Kalman filtering process.This approach streamlines and optimizes the overall filtering procedure.The process is shown in Figure 1, and the steps are as follows: The state and observation equations for a class of nonlinear system models are: (1) REKF prediction steps: The predicted estimate of the state equation: The prediction error of the state equation: In this context, ξ(k) represents the prediction error of the residual term in the state equation, while ξ(k) denotes the predicted estimate of the residual term in the state equation.
According to the solution formula of Kalman filtering, it can be seen that the estimation error covariance P(k + 1|k) is as follows: In this context, P(k|k) = x(k|k) x(k|k) T represents the estimated error covariance at time k.
The predicted estimate of the measurement equation: Predictive estimation errors in the measurement equations: (2) Update steps: Kalman gain Kk(k + 1): Expanded-Kalman-filtered value of the state equation at k + 1 time: Find the estimation error covariance at the time of k + 1: The extended Kalman prediction and update solution for the remaining substitutions is complete.

REKF Performance Analysis
(1) Predictive stage performance analysis During the prediction stage, the REKF state equation performs better than the EKF in feature extraction.It utilizes a multi-level approximation method for rounding error calculation to improve the estimation accuracy.And the error exists only in the highestorder residual term.
In terms of performance, the smaller the error covariance, the closer the filtered value in the system is to the true value.During the prediction stage, a (r + 1)th order x r+1 (k + 1) in the Taylor expansion is considered the true value, and the error exists only in the highest-order residual term.Refer to Appendix D for details.
The following content focuses solely on presenting the results.
Taylor expansion to an r + 1 order of error covariance: Taylor expansion to an order of error covariance: Estimated error covariance in the Taylor expansion to the first order: T are all greater than or equal to 0, and ξ(1) (k) ξ(1) (k) T is equal to 0 only if the matrix is orthogonal to ξ(1) (k) ξ(1) (k) T .Similarly, ξ(r) (k|k) ξ(r) (k|k) T is equal to 0 only if the matrix is orthogonal to ξ(r) (k|k) ξ(r) (k|k) T .

of 18
Expand to the r + 1 order error covariance minimum: 2) (k|k) T p (1)  xx (k Upon comparison, it becomes evident that the (r + 1)th order Taylor expansion exhibits the smallest error covariance and the highest accuracy.In the prediction stage, REKF extracts more information, leading to a reduced prediction error covariance matrix.Consequently, the prediction accuracy of REKF is superior to that of the traditional EKF.
(2) Analysis of performance indicators in the update phase Our REKF accuracy is greater than EKF in the prediction phase and in the update phase: Available by comparison: By analyzing the performance of EKF and REKF, it becomes evident that the new extended Kalman filter leverages the statistical properties of the rounding error to enhance the estimation accuracy.A higher-order extended Kalman filter (REKF) was established for the joint estimation of rounding errors and random variables.The method of solving rounding errors, considering the multilevel approximation of the original function, offers higher accuracy compared to the traditional EKF approach.

Simulation Experiments
Simulation experiments can be conducted to verify the enhanced performance of the REKF compared to the EKF.These experiments can be carried out using MATLABR 2021b software.
Simulation experiment I: Consider a system where the measurement equation is linear and the equation of state is nonlinear.
T w k , and v k+1 are independent white noises obeying normal distribution in the system, w k ∼ N(0, Q) and v k+1 ∼ N(0, R), and satisfy the conditions in Equation ( 3).w k and v k+1 are mutually uncorrelated white noise, Q = diag{0.7,1.3} and R = 1, assuming that the initial true value of the original state model is the initial value of the original model state, x0 = [1, 1] T , and the initial estimation error covariance matrix is P 0 = I ∈ R 2×2 .The estimation of the target states x 1 and x 2 are compared to the target states using the extended Kalman filter (EKF) with the Kalman filter with high-precision residual term substitution (REKF).
Figure 2 shows that the method proposed in this paper is more accurate.Table 1 shows that: In X1, the precision of the high-order REKF with residual substitution was improved by about 6.92% compared to the traditional EKF, and the precision of the high-order REKF with residual substitution was improved by about 5.62% compared to the first-order REKF with residual substitution.In the scenario where the state equation exhibited weak nonlinearity and the observation equation was linear, the REKF demonstrated superior performance compared to the EKF in terms of error reduction and stability improvement.
Table 2 shows that: In X2, the precision of the high-order REKF with residual substitution was improved by about 7.28% compared to the traditional EKF, and the precision of the high-order REKF with residual substitution was improved by about 5.95% compared to the first-order REKF with residual substitution.Table 1 shows that: In X1, the precision of the high-order REKF with residual substitution was improved by about 6.92% compared to the traditional EKF, and the precision of the high-order REKF with residual substitution was improved by about 5.62% compared to the first-order REKF with residual substitution.In the scenario where the state equation exhibited weak nonlinearity and the observation equation was linear, the REKF demonstrated superior performance compared to the EKF in terms of error reduction and stability improvement.
Table 2 shows that: In X2, the precision of the high-order REKF with residual substitution was improved by about 7.28% compared to the traditional EKF, and the precision of the high-order REKF with residual substitution was improved by about 5.95% compared to the first-order REKF with residual substitution.A simulation experiment was conducted using MATLAB, with the data in the table representing the root mean square error obtained by averaging the results from 50 iterations of the Kalman filter experiment.In scenarios where the state equation exhibited weak nonlinearity and the measurement was linear, with relatively large random noise in the function model, the figure clearly shows that the REKF outperformed the EKF in terms of accuracy.Furthermore, in the case of an under-measured nonlinear model, the enhancement of the first-order REKF with residual term replacement was smaller, while the enhancement of the higher-order REKF with residual term replacement was larger.This observation is also validated in the table, where it can be seen that the accuracy of the higher-order REKF with residual term replacement was about 3% higher than that of the first order REKF with residual term replacement.Additionally, the accuracy of the higher-order REKF with residual term replacement was about 6% higher than that of the traditional EKF.The REKF with residual term replacement performed better than the traditional EKF method in practical applications.
Simulation Experiment II: Consider systems where both the measurement equation and the equation of state are weakly nonlinear. where w k and v k+1 are mutually uncorrelated white noise.Q = diag{0.01,0.01}, R = 0.5, w k , and v k+1 are independent white noises in the system obeying normal distribution, w k ∼ N(0, Q) and v k+1 ∼ N(0, R), and satisfy the condition in Equation (3).The initial true value of the model is assumed to be the initial value of the original model state, x0 = [0.1,0.1] T , and the initial estimation error covariance matrix is P 0 = I ∈ R 2×2 .Figure 3 shows that the method proposed in this paper is more accurate.Table 3 shows that: In X1, the precision of the high-order REKF with residual substitution was improved by about 5.06% compared to the traditional EKF, and the precision of the high-order REKF with residual substitution was improved by about 3.07% compared to the first-order REKF with residual substitution., and the initial estimation error covariance matrix is  Table 3 shows that: In X1, the precision of the high-order REKF with residual substitution was improved by about 5.06% compared to the traditional EKF, and the precision of the high-order REKF with residual substitution was improved by about 3.07% compared to the first-order REKF with residual substitution.
Table 4 shows that: In X2, the precision of the high-order REKF with residual substitution was improved by about 6.71% compared to the traditional EKF, and the precision of the high-order REKF with residual substitution was improved by about 4.88% compared to the first order REKF with residual substitution.MATLAB was used to carry out the simulation experiment.Since the measurement equation and the state equation are nonlinear functions of the model, a comparison was made between the traditional EKF and the REKF methods mentioned in this paper.The data in the figures are the average values after running the code 50 times.The figure showing the comparison curves of the root mean square errors shows that the residual term Table 4 shows that: In X2, the precision of the high-order REKF with residual substitution was improved by about 6.71% compared to the traditional EKF, and the precision of the high-order REKF with residual substitution was improved by about 4.88% compared to the first order REKF with residual substitution.MATLAB was used to carry out the simulation experiment.Since the measurement equation and the state equation are nonlinear functions of the model, a comparison was made between the traditional EKF and the REKF methods mentioned in this paper.The data in the figures are the average values after running the code 50 times.The figure showing the comparison curves of the root mean square errors shows that the residual term increased the accuracy of the traditional EKF method by about 2% compared to the firstorder REKF method.Additionally, the higher-order residual term improved the accuracy by about 6% compared to the first-order REKF method and was more accurate than the traditional EKF method.In order to improve the accuracy, the higher-order residual term should be used instead of the extended Kalman filter (REKF).REKF uses Taylor expansion to round off higher-order terms in the model and extract higher-order items of information, which results in better filtering performance compared to the EKF.

Figure 1 .
Figure 1.The flow chart represents the relationship between the nonlinear system and the Kalman filter, and the updating process of the REKF.

Figure 1 .
Figure 1.The flow chart represents the relationship between the nonlinear system and the Kalman filter, and the updating process of the REKF.

Figure 2 .
Figure 2. Comparison of EKF with residual term and conventional EKF.(a) The X axis represents the number of tests, and the Y axis represents the state estimate for X1.(b) The X axis represents the number of tests, and the Y axis represents the state estimate for X2.(c) The X axis represents the number of tests, and the Y axis represents the root mean square error of X1.(d) The X axis represents the number of tests, and the Y axis represents the root mean square error of X2.

Figure 2 .
Figure 2. Comparison of EKF with residual term and conventional EKF.(a) The X axis represents the number of tests, and the Y axis represents the state estimate for X1.(b) The X axis represents the number of tests, and the Y axis represents the state estimate for X2.(c) The X axis represents the number of tests, and the Y axis represents the root mean square error of X1.(d) The X axis represents the number of tests, and the Y axis represents the root mean square error of X2.

1 k
+ are independent white noises in the system obeying normal distribution, the condition in Equation (3).The initial true value of the model is assumed to be the initial value of the original model state, that the method proposed in this paper is more accurate.(a) X1 state estimate.(b) X2 state estimate.True EKF EKF first EKF Second Symmetry 2024, 16, x FOR PEER REVIEW 13 of 20 (c) X1 root mean square error.(d) X2 root mean square error.

Figure 3 .
Figure 3.Comparison of EKF with residual term and conventional EKF.(a) The X axis represents the number of tests, and the Y axis represents the state estimate for X1.(b) The X axis represents the number of tests, and the Y axis represents the state estimate for X2.(c) The X axis represents the number of tests, and the Y axis represents the root mean square error of X1.(d) The X axis represents the number of tests, and the Y axis represents the root mean square error of X2.

Figure 3 .
Figure 3.Comparison of EKF with residual term and conventional EKF.(a) The X axis represents the number of tests, and the Y axis represents the state estimate for X1.(b) The X axis represents the number of tests, and the Y axis represents the state estimate for X2.(c) The X axis represents the number of tests, and the Y axis represents the root mean square error of X1.(d) The X axis represents the number of tests, and the Y axis represents the root mean square error of X2.

Table 3 .
Comparison of the performance of the EKF with the first-order EKF remainder substitution and the higher-order EKF remainder substitution for X1.

Table 3 .
Comparison of the performance of the EKF with the first-order EKF remainder substitution and the higher-order EKF remainder substitution for X1.

Table 4 .
Comparison of the root mean square error of the first-order EKF residual replacement and the higher-order EKF residual replacement for X2.

Table 4 .
Comparison of the root mean square error of the first-order EKF residual replacement and the higher-order EKF residual replacement for X2.