# Temperature Drift Compensation for High-G MEMS Accelerometer Based on RBF NN Improved Method
## 3 Model and Algorithm
### RBF NN Based on GA with KF  
The Kalman filtering algorithm can be divided into two information update processes: time update and measurement update process; these processes are recursive. The KF process is shown in Figure 7.  
During the time update process, two updates are completed. Firstly, the state transition matrix is used to combine the \(k-1\) time information to complete the prediction of the value of \(k\) time. Secondly, the calculation of the one-step prediction mean square error is completed, and the quality of the prediction is quantitatively described. In summary, the transition from \(k-1\) to \(k\) is completed by using information related to system dynamics.  
Figure 6: The process of RBF NN based on GA (RBF NN + GA).  
During the measurement update process, the remaining three formulas are utilized, which can make full use of the measured values and residuals. Finally, the optimal value of the estimator and the smaller estimation error is obtained.  
One-step prediction of state:  
\[\hat{X}_{k/k-1}=\Phi_{k,k-1}\hat{X}_{k-1} \tag{7}\]  
State estimate:  
\[\hat{X}_{k}=\hat{X}_{k/k-1}+K_{k}(Z_{k}-H_{k}\hat{X}_{k/k-1}) \tag{8}\]  
Filter gain:  
\[K_{k}=P_{k/k-1}H_{k}^{T}{(H_{k}P_{k/k-1}H_{k}^{T}+R)}^{-1} \tag{9}\]  
One-step prediction of mean square error:  
\[P_{k/k-1}=\Phi_{k,k-1}P_{k-1}\Phi_{k,k-1}^{T}+\Gamma_{k-1}Q\Gamma_{k-1}^{T} \tag{10}\]  
Estimated mean square error:  
\[P_{k}=(I-K_{k}H_{k})P_{k/k-1} \tag{11}\]  
where \(H_{k}\) is a measurement matrix, \(P_{k/k-1}\) is a matrix of prior estimate error covariance; \(K_{k}\) is a filter gain matrix; \(P_{k}\) is a matrix of estimation error variance; \(R\) is the covariance of measurement noise covariance; \(Q\) is the covariance of process noise. According to the above formula, it can be found that if the initial value of \(\hat{X}_{0}\) and \(P_{0}\) are determined, the state estimation of \(\hat{X}_{k}(k=1,2,\cdots)\) at \(k\) moment can be calculated by the measurement vector of \(Z_{k}\) at k moment.  
In this section, the three algorithms of KF, RBF NN and GA are merged, and the RBF NN + GA + KF fusion algorithm is established. The algorithm is online in real-time and also has certain learning abilities. Combined with the temperature drift model, the RBF NN + GA + KF temperature compensation model fusion algorithm is determined. The flow chart of the fusion algorithm is shown in Figure 8.  
Figure 7: The Kalman filter (KF) process.  
The steps of RBF NN + GA + KF temperature compensation model fusion algorithm are as follows:  
(1) Initial (original) data is generated in the temperature experiment.  
(2) Using the neural network method to establish the temperature drift model, the temperature, temperature variation rate and temperature product term are taken as the input of the model.  
(3) The output data based on RBF NN + GA + KF is corrected by the output data of the temperature drift model, and then the temperature compensation model fusion algorithm is established.  
(4) Temperature compensation model fusion algorithm based on RBF NN + GA + KF is established as shown in Figure 8.  
(5) Output the data processed by the RBF NN + GA + KF temperature compensation model fusion algorithm.