# Tracking Extended Targets: Novel TPMB Filter Driven by Model and Data Collaboration
## 4 IMM-TPMB Filter Driven by Model and Data Collaboration
### Update  
Calculate the updated state mean and the square root of the state covariance:  
\[\left\{ \begin{array}{ll}{\hat{x}}_{k|k}={\hat{x}}_{k|k-1}+\text{K}_{k}\Big{(} z_{k}-{\hat{z}}_{k|k-1}\Big{)}\\ \\ {S}_{k|k}=\text{T}ria\Big{(}\Big{[}X_{k|k-1}-\text{K}_{k}Z_{k|k-1},\text{K}_{ k}\sqrt{R_{k}}\Big{]}\Big{)}\end{array} \right. \tag{66}\]  
During the model update, calculate the probability of the \(\xi^{th}\) model:  
\[ \begin{array}{ll}{\Lambda}_{k}^{\xi}&=P\Big{(}Z_{k}\Big{|}M_{k}^{\xi},Z^{k-1 }\Big{)}\\ \\ &=N\Big{[}{\gamma}_{k}^{j}:0,S_{zz,k|k-1}\Big{]}\\ \\ &=\frac{1}{\sqrt{\left|2\pi S_{zz,k|k-1}\right|}}\exp\left[-\frac{1}{2}\Big{(} \gamma_{k}^{\xi}\Big{)}^{\text{T}}\Big{(}S_{zz,k|k-1}\Big{)}^{-1}\Big{(} \gamma_{k}^{\xi}\Big{)}\right]\end{array}  \tag{67}\]  
Calculate the conditional probability:  
\[\mu_{k}^{\xi}=P\Big{(}M_{k}^{\xi}\Big{|}Z^{k}\Big{)}=\frac{1}{c}\Lambda_{k}^{ \xi}\overline{c}^{\xi} \tag{68}\]  
As known from Equations (61) and (66), \(Q_{k}\) and \(R_{k}\) significantly influence the values of \(S_{k|k-1}\) and \(S_{k|k}\). However, in the target tracking process, the noise data change over time. Any mismatch between the actual noise affecting the system and the noise assumed in the SCKF can degrade the performance of the SCKF, as it may also diverge. Therefore, it is necessary to precisely estimate the matrices \(Q_{k}\) and \(R_{k}\). The posterior density function can be calculated as follows:  
\[\Pi^{*}=p(X_{k},Q_{k},R_{k}|Z_{k})=\frac{P(Z_{k}|X_{k},Q_{k},R_{k})P(X_{k}|Q_{ k},R_{k})p(Q_{k},R_{k})}{P(Z_{k})} \tag{69}\]  
where \(p(Q_{k},R_{k})\) is considered a constant dependent on prior information, and \(P(Z_{k})\) does not involve an optimization problem; hence, Equation (69) is equivalent to the following:  
\[\Pi=P(Z_{k}|X_{k},Q_{k},R_{k})P(X_{k}|Q_{k},R_{k})p(Q_{k},R_{k}) \tag{70}\]  
where \(P(X_{k}|Q_{k},R_{k})\) can be calculated using the conditional probability multiplication theorem as follows:\[ \begin{array}{ll}p(X_{k}|Q_{k},R_{k})&=P(x_{0})\int\limits_{\Omega}^{\frac{k}{2}}P (x_{m}|x_{m-1},Q_{k})\\ &=\frac{1}{\left(2\pi\right)^{n/2}\left|P_{00}\right|^{1/2}}\exp\left(-\frac{1} {2}\|x_{0}-x_{0}\|_{P_{00}^{-1}}^{2}\right)\times\prod\limits_{j=1}^{k}\frac{ 1}{\left(2\pi\right)^{n/2}\left|Q_{k}\right|^{1/2}}\exp\left(-\frac{1}{2}\|x_{ m}-f(x_{m-1})\|_{Q_{k}^{-1}}^{2}\right)\\ &=M_{1}|Q_{k}|^{-1/2}\exp\left\{-\frac{1}{2}\left[\|x_{0}-x_{0}\|_{P_{00}^{-1} }^{2}+\frac{k}{\mu-1}\|x_{m}-f(x_{m-1})\|_{Q_{k}^{-1}}^{2}\right]\right\}\end{array}  \tag{71}\]  
where \(M_{1}=\frac{1}{\left(2\pi\right)^{n/2}\left|P_{00}\right|^{1/2}}\) is a constant, \(n\) represents the dimension of process noise, and \(P(Z_{k}|X_{k},Q_{k},R_{k})\) can be expressed as follows:  
\[ \begin{array}{ll}P(Z_{k}|X_{k},Q_{k},R_{k})&=\prod\limits_{j=1}^{k}P(z_{m}|x _{m},R_{k})\\ &=\prod\limits_{j=1}^{k}\frac{1}{\left(2\pi\right)^{q/2}\left|R_{k}\right|^{1/ 2}}\exp\left(-\frac{1}{2}\|z_{m}-h(z_{m})\|_{R_{k}^{-1}}^{2}\right)\\ &=M_{2}|R_{k}|^{-k/2}\exp\left(-\frac{1}{2}\sum\limits_{j=1}^{k}\|z_{m}-h(z_{m })\|_{R_{k}^{-1}}^{2}\right)\end{array}  \tag{72}\]  
where \(q\) represents the dimension of measurement noise and \(M_{2}=\frac{1}{\left(2\pi\right)^{q/2}}\) is a constant. By substituting Equations (71) and (72) into Equation (70), \(\Pi\) can be calculated:  
\[\begin{array}{ll}\Pi&=M_{1}M_{2}|P_{0}|^{-1/2}|Q_{k}|^{-k/2}p(Q_{k},R_{k}) \times\exp\left\{-\frac{1}{2}\left[ \begin{array}{l}\|x_{0}-x_{0}\|_{P_{00}^ {-1}}^{2}+\sum\limits_{m=1}^{k}\|x_{m}-f(x_{m-1})\|_{Q_{k}^{-1}}^{2}\\ +\sum\limits_{m=1}^{k}\|z_{m}-h(z_{m})\|_{R_{k}^{-1}}^{2}\end{array} \right] \right\}\\ &=C|Q_{k}|^{-k/2}|R_{k}|^{-k/2}\exp\left\{-\frac{1}{2}\left[ \begin{array}{l }\sum\limits_{m=1}^{k}\|x_{m}-f(x_{m-1})\|_{Q_{k}^{-1}}^{2}\\ +\sum\limits_{m=1}^{k}\|z_{m}-h(z_{m})\|_{R_{k}^{-1}}^{2}\end{array} \right] \right\}\\ &\text{where }C=M_{1}M_{2}\left|P_{00}\right|^{-1/2}p(Q_{k},R_{k})\exp\left\{- \frac{1}{2}\|x_{0}-x_{0}\|_{P_{00}^{-1}}^{2}\right\}\text{.