# Study on Underwater Target Tracking Technology Based on an LSTM-Kalman Filtering Method
## 2 LSTM-Kalman Filtering Method  
LSTM networks have an outstanding prediction ability for time series and the array signals that are received in the active sonar system are time-series signals. Therefore, we combined an LSTM network with the Kalman filter to effectively improve the prediction ability of the Kalman filtering method in a nonlinear system. We took the filtering process parameters as the inputs of the LSTM network and the model could then output the predicted value that was closest to the real one.  
According to reference [24], the state equation and observation equation of the Kalman mathematical model are:  
\[\textbf{X}_{k+1}\textbf{=}\boldsymbol{\Phi}\textbf{X}_{k}\textbf{+}\textbf{TW}_ {k} \tag{1}\]  
\[\textbf{Y}_{k}=\textbf{H}\textbf{X}_{k}+\textbf{V}_{k} \tag{2}\]  
where \(\textbf{X}_{k}\) is the state information of the moving target at the time \(k\), \(\textbf{Y}_{k}\) is the observation signal of the corresponding state, \(\boldsymbol{\Phi}\) is the state transition matrix, \(\boldsymbol{\Gamma}\) is the noise driving matrix, **H** is the observation matrix, \(\textbf{W}_{k}\) is the process noise at the time \(k\), and \(\textbf{V}_{k}\) is the observation noise at the time \(k\), assuming that \(\textbf{W}_{k}\) and \(\textbf{V}_{k}\) are both uncorrelated white noise with a mean value of zero and that the variance matrices of \(\mathbf{Q}\), \(\mathbf{R}\), and \(\mathbf{X}_{0}\) are not related to \(\mathbf{W}_{k}\) or \(\mathbf{V}_{\mathbf{k}}\).  
The state update equation of the Kalman filtering method is:  
\[\overset{\boldsymbol{\alpha}}{\mathbf{X}}_{k+1,k+1}=\overset{\boldsymbol{ \alpha}}{\mathbf{X}}_{k+1,k}+\mathbf{K}_{k+1}\varepsilon_{k+1} \tag{3}\]  
\[\varepsilon_{k+1}=\mathbf{Y}_{k+1}-\overset{\boldsymbol{\alpha}}{\mathbf{H} \mathbf{X}}_{k+1,k} \tag{4}\]  
Substituting Formula (4) into Formula (3) can be simplified as:  
\[\overset{\boldsymbol{\alpha}}{\mathbf{X}}_{k+1,k+1}=\overset{\boldsymbol{ \alpha}}{\mathbf{X}}_{k+1,k}+\mathbf{K}_{k+1}\cdot\left(\mathbf{Y}_{k+1}- \overset{\boldsymbol{\alpha}}{\mathbf{H}\mathbf{X}}_{k+1,k}\right) \tag{5}\]  
where, \(\overset{\boldsymbol{\alpha}}{\mathbf{X}}_{k+1,k+1}\) is the prediction state at the time \(k+1\), \(\overset{\boldsymbol{\alpha}}{\mathbf{X}}_{k+1,k}\) is the expected prediction state, \(\mathbf{K}_{k+1}\) is the Kalman filter gain, and \(\varepsilon_{k+1}\) is the difference between the observed value and the expected prediction state.  
The above formulae show that the prediction state of a target at the following time is related to the expected prediction state \(\overset{\boldsymbol{\alpha}}{\mathbf{X}}_{k+1,k}\) at the current time, the Kalman gain \(\mathbf{K}_{k+1}\), and the difference \(\boldsymbol{\alpha}\) between the observed value and the expected prediction state, which can be expressed as:  
\[\boldsymbol{\alpha}=\mathbf{Y}_{k+1}-\overset{\boldsymbol{\alpha}}{\mathbf{H }\mathbf{X}}_{k+1,k} \tag{6}\]  
Therefore, the inputs of the Kalman filter correction model were the above three factors, the output was the actual state of the moving target \(\mathbf{Y}_{k+1}\), and the inputs and outputs formed a mapping set. The LSTM-NN model could be described as:  
\[\mathbf{Y}_{k+1}=f(\overset{\boldsymbol{\alpha}}{\mathbf{X}}_{k+1,k},\mathbf{ K}_{k+1},\boldsymbol{\alpha}) \tag{7}\]  
Figure 1 shows the schematic diagram of the Kalman filtering method when based on LSTM network correction.  
We processed the received data to obtain the position information of the target in unit time. Then, the process parameters of the data that were obtained per second were successively sent to the LSTM network through the Kalman filter. Figure 2 shows this structure.  
Figure 1: The schematic diagram of the LSTM–Kalman filtering method.