# Recursive Optimal Finite Impulse Response Filter and Its Application to Adaptive Estimation
## 2 Recursive Optimal FIR Filter and Adaptive FIR Filter
### Recursive Optimal FIR Filter with Optimally Estimated Initial Conditions
\right], \tag{21}\]  
\[\hat{\Pi}_{i,k-1}=\hat{\mathcal{G}}_{i,k-1}\hat{\mathcal{G}}_{i-1,1}\hat{ \mathcal{G}}_{i,k-1}^{T}+\bar{R}_{i-1,1}, \tag{22}\]  
\[\hat{w}_{i,k-1}=\hat{\mathcal{C}}_{i,k-1}^{T}\hat{\Pi}_{i,k-1}^{-1}Y_{i-1,k-1}, \tag{23}\]  
\[\hat{P}_{i,k-1}=\hat{\mathcal{C}}_{i,k-1}\hat{\Pi}_{i,k-1}^{-1}\hat{\mathcal{C }}_{i,k-1}^{T}. \tag{24}\]  
Then, the optimal estimate of the horizon initial state \(\hat{x}_{k-N|k}\) in (16) and error covariance \(P_{k-N}\) in (19) can be rewritten as  
\[\hat{x}_{k-N|k}=P_{k-N}\Big{(}C_{k-N}^{T}R_{k-N}^{-1}y_{k-N}+\hat{w}_{N,k-1} \Big{)}, \tag{25}\]  
\[P_{k-N}=(C_{k-N}^{T}R_{k-N}^{-1}C_{k-N}+\hat{P}_{N,k-1})^{-1}. \tag{26}\]  
Although the optimal initial conditions are obtained, they have computationally inefficient batch forms. In order to obtain the recursive form of \(\hat{x}_{k-N|k}\) and \(P_{k-N}\) in (25) and (26), \(\hat{w}_{N,k-1}\) and \(\hat{P}_{N,k-1}\) should be calculated recursively. The recursive equations of \(\vartheta_{N,k-1}\) and \(\hat{P}_{N,k-1}\) can be obtained as follows:  
\[ \begin{array}{rcl}\hat{P}_{i+1,k-1}&=&\hat{C}_{i+1,k-1}^{T}\hat{\Pi}_{i+1,k-1}^{ -1}\hat{C}_{i+1,k-1}\\ &=&\hat{C}_{i+1,k-1}^{T}\Big{(}\hat{G}_{i+1,k-1}\hat{Q}_{i,i}\hat{C}_{i+1,k-1}^{ T}+\hat{R}_{i,1}\Big{)}^{-1}\hat{C}_{i+1,k-1}\\ &=&A_{k-i-1}^{T}\bigg{[}\begin{array}{c}\mathcal{C}_{k-i}\\ \mathcal{C}_{i,k-1}\end{array}\Big{]}^{T}\bigg{(}\begin{bmatrix}R_{k-i}&0\\ 0&\hat{\Pi}_{i,k-1}\end{bmatrix}+\begin{bmatrix}\mathcal{C}_{k-i}\\ \mathcal{C}_{i,k-1}\end{bmatrix}Q_{k-i}\bigg{[}\begin{array}{c}\mathcal{C}_{ k-i}\\ \mathcal{C}_{i,k-1}\end{array}\Big{]}^{T}\bigg{)}^{-1}\\ &&\times\bigg{[}\begin{array}{c}\mathcal{C}_{k-i}\\ \mathcal{C}_{i,k-1}\end{array}\Big{]}A_{k-i-1}\\ &=&A_{k-i-1}^{T}\hat{C}_{k-i}^{T}R_{k-1}^{-1}\mathcal{C}_{k-i}A_{k-i-1}+A_{k-i -1}^{T}\hat{P}_{i,k-1}^{T}A_{k-i-1}-A_{k-i-1}^{T}\\ &&\times\Big{(}\mathcal{C}_{k-i}^{T}R_{k-1}^{-1}\mathcal{C}_{k-i}+\hat{P}_{i,k- 1}\Big{)}\Big{[}Q_{k-i}^{-1}+A_{k-i-1}^{T}\Big{(}\mathcal{C}_{k-i}^{T}R_{k-1}^ {-1}\mathcal{C}_{k-i}+\hat{P}_{i,k-1}\Big{)}\] \[&\times A_{k-i-1}\Big{]}^{-1}\Big{(}\mathcal{C}_{k-i}^{T}R_{k-1}^ {-1}\mathcal{C}_{k-i}+\hat{P}_{i,k-1}\Big{)}A_{k-i-1},\] \[\vartheta_{i+1,k-1} = \mathcal{C}_{i+1,k-1}^{T}\hat{\Pi}_{i+1,k-1}^{-1}Y_{i,k-1},\] \[= A_{k-i-1}^{T}\bigg{[}\begin{array}{c}\mathcal{C}_{k-i}\\ \mathcal{C}_{i,k-1}\end{array}\bigg{]}^{T}\bigg{(}\begin{bmatrix}R_{k-i}&0\\ 0&\hat{\Pi}_{i,k-1}\end{bmatrix}+\begin{bmatrix}\mathcal{C}_{k-i}\\ \mathcal{C}_{i,k-1}\end{array} \bigg{]}Q_{k-i}\bigg{[} \begin{array}{c} \mathcal{C}_{k-i}\\ \mathcal{C}_{i,k-1}\end{array} \bigg{]}^{T}\bigg{)}^{-1}\] \[\times\bigg{[} \begin{array}{c}\mathcal{V}_{k-i}\\ Y_{i-1}\end{array} \bigg{]}\] \[= A_{k-i-1}^{T}\hat{C}_{k-i}^{T}R_{k-1}^{-1}y_{k-i}+A_{k-i-1}^{T} \vartheta_{i,k-1}-A_{k-i-1}^{T}\left(\mathcal{C}_{k-i}^{T}R_{k-1}^{-1}\mathcal{ C}_{k-i}+\hat{P}_{i,k-1}\right)\] \[\times\Big{[}Q_{k-i}^{-1}+A_{k-i-1}^{T}\Big{(}\mathcal{C}_{k-i}^{ T}R_{k-i}^{-1}\mathcal{C}_{k-i}+\hat{P}_{i,k-1}\Big{)}A_{k-i-1}\Big{]}^{-1}\] \[\times\Big{(}\mathcal{C}_{k-i}^{T}R_{k-i}^{-1}y_{k-i}+\vartheta_{ i,k-1}\Big{)},\]  
with \(\hat{P}_{1,k-1}=0\), \(\vartheta_{1,k-1}=0\), and \(1\leq i\leq N-1\). Finally, the ROFIR filter can be represented by applying the estimated horizon initial state (25) and its error covariance (26) to the one-step-ahead prediction dynamics of the Kalman filter, as follows:  
\[\hat{x}_{k-N+i+1|k} = A_{k-N+i}(I-K_{k-N+i}C_{k-N+i})\hat{x}_{k-N+i|k}+A_{k-N+i}K_{k-N+ i}y_{k-N+i}, \tag{29}\]  
where  
\[K_{k-N+i} = P_{k-N+i|k}\mathcal{C}_{k-N+i}^{T}(C_{k-N+i}P_{k-N+i|k}\mathcal{ C}_{k-N+i}^{T}+R_{k-N+i})^{-1}, \tag{30}\] \[P_{k-N+i+1|k} = A_{k-N+i}P_{k-N+i|k}A_{k-N+i}^{T}+Q_{k-N+i}-A_{k-N+i}K_{k-N+i}\] (31) \[\times(C_{k-N+i}P_{k-N+i|k}\mathcal{C}_{k-N+i}^{T}+R_{k-N+i})K_{k -N+i}^{T}A_{k-N+i}^{T}.\]