# Kalman Filter Using a Third-Order Tensorial Decomposition of the Impulse Response
## 2 System Identification and TOT Decomposition
### Conventional Kalman Filter  
In the context of Kalman filtering, the model from (1) represents the so-called state equation. In this framework, the observation equation is defined as the output of the system, related to the reference (or desired) signal, \(d(n)\). It contains the convolution product between the samples of the input signal, \(x(n)\), and the coefficients of the impulse response, \(\mathbf{h}(n)\), and is corrupted by an additive noise, \(v(n)\). It is considered that this noise is white and Gaussian, with variance \(\sigma_{v}^{2}=E\big{[}\varphi^{2}(n)\big{]}\), where \(E[\cdot]\) represents mathematical expectation. Consequently,  
\[d(n)=\mathbf{h}^{T}(n)\mathbf{x}(n)+v(n), \tag{2}\]  
where the vector \(\mathbf{x}(n)=\left[\begin{array}{cccc}x(n)&x(n-1)&\cdots&x(n-L+1)\end{array} \right]^{T}\) contains the \(L\) most recent time samples of the input signal. Next, considering an estimate of the impulse response at time index \(n\), denoted by \(\widehat{\mathbf{h}}(n)=\left[\begin{array}{cccc}\widehat{h}_{0}(n)& \widehat{h}_{1}(n)&\cdots&\widehat{h}_{L-1}(n)\end{array}\right]^{T}\), the a priori estimation error results in  
\[e(n)=d(n)-\widehat{\mathbf{h}}^{T}(n-1)\mathbf{x}(n), \tag{3}\]  
while the a posteriori error is defined as  
\[\varepsilon(n)=d(n)-\widehat{\mathbf{h}}^{T}(n)\mathbf{x}(n). \tag{4}\]  
Related to these estimates, we can also define the a priori and a posteriori misalignments, i.e.,  
\[\mathbf{m}(n) =\mathbf{h}(n)-\widehat{\mathbf{h}}(n-1), \tag{5}\] \[\widehat{\mathbf{m}}(n) =\mathbf{h}(n)-\widehat{\mathbf{h}}(n), \tag{6}\]  
which are also known as the system mismatches [48] or state estimation errors. Based on (1), it can be easily checked that \(\mathbf{m}(n)=\widehat{\mathbf{m}}(n-1)+\mathbf{w}(n)\). Also, using (3) and (4), we have \(\varepsilon(n)=\widehat{\mathbf{m}}^{T}(n)\mathbf{x}(n)+v(n)\).  
At this point, the Kalman filter can be obtained based on the linear sequential Bayesian approach, which states that the optimal estimate of the state vector is [49]  
\[\widehat{\mathbf{h}}(n)=\widehat{\mathbf{h}}(n-1)+\mathbf{k}(n)e(n), \tag{7}\]where \(\mathbf{k}(n)\) is the Kalman gain vector [1]. This results by minimizing the cost function  
\[J[\mathbf{k}(n)]=\frac{1}{L}\text{tr}[\mathbf{R}_{\widetilde{\mathbf{m}}}(n)], \tag{8}\]  
where \(\text{tr}(\cdot)\) represents the trace of a square matrix and \(\mathbf{R}_{\widetilde{\mathbf{m}}}(n)=E\big{[}\widetilde{\mathbf{m}}(n) \widetilde{\mathbf{m}}^{T}(n)\big{]}\) is the covariance matrix of the a posteriori misalignment from (6). From this optimization criterion, as shown in [49], two important results are obtained, as follows:  
\[\mathbf{k}(n) =\frac{\mathbf{R}_{\mathbf{m}}(n)\mathbf{x}(n)}{\mathbf{x}^{T}(n )\mathbf{R}_{\mathbf{m}}(n)\mathbf{x}(n)+\sigma_{v}^{2}}, \tag{9}\] \[\mathbf{R}_{\widetilde{\mathbf{m}}}(n) =\Big{[}\mathbf{I}_{L}-\mathbf{k}(n)\mathbf{x}^{T}(n)\Big{]} \mathbf{R}_{\mathbf{m}}(n), \tag{10}\]  
where \(\mathbf{R}_{\mathbf{m}}(n)=E\big{[}\mathbf{m}(n)\mathbf{m}^{T}(n)\big{]}\) is the covariance matrix of the a priori misalignment from (5), with  
\[\mathbf{R}_{\mathbf{m}}(n)=\mathbf{R}_{\widetilde{\mathbf{m}}}(n-1)+\sigma_{ w}^{2}(n)\mathbf{I}_{L}. \tag{11}\]  
The initialization of the Kalman filter is \(\widehat{\mathbf{h}}(n)=\mathbf{0}_{L}\) and \(\mathbf{R}_{\widetilde{\mathbf{m}}}(0)=e\mathbf{I}_{L}\), where \(\mathbf{0}_{L}\) denotes an all-zeros vector of length \(L\) and \(\epsilon\) is a positive constant. Then, in each iteration, the algorithm starts by computing the a priori error \(e(n)\) from (3) and evaluating the matrix \(\mathbf{R}_{\mathbf{m}}(n)\) from (11). Next, the Kalman gain vector \(\mathbf{k}(n)\) and the matrix \(\mathbf{R}_{\widetilde{\mathbf{m}}}(n)\) are computed using (9) and (10), respectively. Finally, the filter is updated based on (7). The specific parameters \(\sigma_{w}^{2}(n)\) and \(\sigma_{v}^{2}\) can be a priori provided or estimated within the algorithm, as indicated in [7].