**Algorithm 1** Particle Filter

$$\mathbf{1: } \mathbf{for} \, k = 1, \cdot, \dots, T \, \mathbf{do}$$

$$
\text{2:} \qquad \textbf{for} \; i = 1, \dots, N \; \textbf{do} \; \textbf{o}
$$

$$\begin{array}{ll} \text{3:} & \text{Sample } \tilde{X}\_{k}^{(i)} \sim p\left(\cdot \middle| \mathcal{X}\_{k-1}^{(i)}, Z\_{k}\right); \\ \text{4:} & \text{Set } \tilde{\omega}\_{k}^{(i)} = \omega\_{k-1}^{(i)} \frac{\mathcal{S}\_{k}\left(\mathcal{Z}\_{k}^{(i)}\right) f\_{k|k-1}\left(\mathcal{X}\_{k}^{(i)} \middle| \mathcal{X}\_{k-1}^{(i)}\right)}{p\_{k|k-1}\left(\mathcal{X}\_{k}^{(i)} \middle| \mathcal{X}\_{1:k-1}^{(i)}, Z\_{1:k}\right)}; \\ \text{5:} & \text{Normalise weights } \omega\_{k}^{(i)} = \frac{\omega\_{k}^{(i)}}{\sum\_{j=1}^{N} \omega\_{k}^{(j)}}, \text{here } \sum\_{i=1}^{N} \omega\_{k}^{(i)} = \mathbf{1}; \end{array}$$


$$\begin{aligned} \text{s.t. } &\text{Resample } \left\{ \boldsymbol{\omega}\_k^{(i)}, \boldsymbol{X}\_k^{(i)} \right\}\_{i=1}^N \text{ and } \text{get } \left\{ \boldsymbol{\omega}\_k^{(i)}, \boldsymbol{X}\_k^{(i)} \right\}\_{i=1}^N; \\ \text{9: Set } &\boldsymbol{\pi}\_k = \sum\_{i=1}^N \boldsymbol{\omega}\_k^{(i)} \boldsymbol{\delta}\_{\boldsymbol{X}\_k^{(i)}} \text{ as the estimated posterior probability density;} \end{aligned}$$
