# Sage-Husa Algorithm Based on Adaptive Double Forgetting Factors
## 3 Simulation and Analysis  
In order to verify the effectiveness of the improved algorithm, the EKF algorithm, the traditional Sage-Husa algorithm, and the improved Sage-Husa algorithm proposed in this paper are used to conduct state estimation research on Examples 1 and 2, which are the classic cases, and different values of forgetting factors are set in the traditional  
Figure 1: Flow chart of the improved Sage–Husa algorithm. Sage-Husa algorithm. In order to represent the new algorithm proposed in this paper more conveniently, it is represented by AEKF below. The mean absolute error (\(MAE\)) and root mean square error (\(RMSE\)) are used as the comparison criteria in the simulation, which are defined as follows:  
\[MAE=\frac{1}{N}\sum_{k=1}^{N}\left|x_{k}-\hat{x}_{k}\right| \tag{26}\]  
\[RMSE=\left[\frac{1}{N}\sum_{k=1}^{N}\left(x_{k}-\hat{x}_{k}\right)^{2}\right] ^{1/2}, \tag{27}\]  
where \(N\) denotes the length of the data samples. **Example 1**. : _Consider the following one-dimensional nonlinear discrete dynamic system:_  
\[x_{k}=0.5x_{k-1}+\frac{0.2x_{k-1}}{1+{x_{k-1}}^{2}}+8\cos(1.2(k-1))+W_{k-1} \tag{28}\]  
\[z_{k}=\frac{{x_{k}}^{2}}{20}+V_{k}. \tag{29}\]  
\(W_{k}\) _and \(V_{k}\)  are independent Zero-mean Gaussian white noise sequences. The corresponding noise statistics are \(Q=0.6\)  and \(R=0.15\). In the simulation, the simulation time is 200 s, the sampling interval is 1 s, and 10 Monte Carlo simulations are performed, which means the length of the data samples \(N=200\), the statistical characteristics of the noise are unknown or inaccurate, and the initial values are selected as \(Q_{0}=0.06\) and \(R_{0}=0.1\). Suppose the theoretical initial value of the system state is \(x_{0}=2\). The initial values of the error covariance matrix is \(P_{0}=0.01\)._  
Simulations of Example 1 were carried out using the EKF algorithm, Sage-Husa algorithm, and AEKF algorithm, and the results of state estimation were output and compared simultaneously by setting different values of the forgetting factor in the Sage-Husa algorithm, as shown in Figure 2. In order to observe the effectiveness of the improved algorithm more clearly, Equations (26) and (27) were used to calculate the mean absolute error and root mean square error of the above algorithms and output the images, as shown in Figures 3 and 4. In order to obtain general conclusions, Example 1 was run 10 times with the above algorithms, and the mean absolute error and root mean square error of each run were recorded, and the average of the 10 mean absolute errors and root mean square errors were calculated, as shown in Table 1.  
Figure 2: Estimation curve. There is no obvious difference between the different algorithms shown in Figure 2. However, as illustrated in Figures 3 and 4, the MAE and RMSE of each algorithm reveal that within 200 iterations, the MAE and RMSE of the EKF algorithm are the largest, while the MAE and RMSE of the AEKF algorithm are the smallest. The forgetting factor exerts a negligible influence on the Sage-Husa algorithm when it assumes different fixed values. These are evidenced by the minimal discrepancies between the mean absolute errors and root mean square errors of the three Sage-Husa algorithms and the MAE and RMSE curves of the three algorithms, which are situated between those of the EKF and AEKF algorithms. The filtering accuracy of the Sage-Husa algorithm is superior to that of the EKF algorithm and inferior to that of the AEKF algorithm.