# Dynamic Indoor Localization Using Maximum Likelihood Particle Filtering
## 4 Proposed Algorithm  
In the particle filtering algorithm described in Section 3, at time \(t\), we use the approximation (9) of the updated distribution \(p(x_{t-1}|Z_{t-1})\), together with the state-transition Equation (1), to generate the approximation (8) of the predicted distribution \(p(x_{t}|Z_{t-1})\). The latter is then used in combination with the likelihood function \(p(x_{t}|x_{t})\) to approximate the new updated distribution \(p(x_{t}|Z_{t})\). This is done by weighting the \(i\)-th particle \(x_{t|t}^{i}\) by a weight \(\varpi_{t|t}^{i}\) proportional to the particle's likelihood \(p(y_{t}|x_{t}^{i})\). As mentioned in Section 1, a drawback of this approach is that this weighting wastes many particles. In order to avoid this, we combine the prediction and update steps into a single one. More precisely, particles for approximating the updated distribution \(p(x_{t}|Z_{t})\) are directly drawn using the knowledge of the particle approximation of the previous updated distribution \(p(x_{t-1}|Z_{t-1})\), without drawing particles to represent the predicted distribution \(p(x_{t}|Z_{t-1})\). We describe below how this is done. **Notation 1**. : _In order to simplify the notation we remove the dependence of \(Q\) on \(u_{t}\), i.e., we use \(Q\) instead of \(Q(u_{t})\)._  
**Notation 2**. : _Let_  
\[f_{t-1}^{i}(w) =f\Big{(}x_{t-1|t-1}^{i},u_{t-1},w\Big{)},\] \[g_{t-1}^{i}(e) =g\Big{(}y_{t-1|t-1}^{i},\theta_{t-1|t-1}^{i},u_{t-1},e\Big{)},\]  
_and, for \(\xi=h,a,b\),_  
\[\xi_{t-1}^{i}(e)=\xi\Big{(}y_{t-1|t-1}^{i},u_{t-1},e\Big{)}.\]  
We assume that at time \(t\) we know the following approximation  
\[p(x_{t-1}|Z_{t-1})\simeq\sum_{i=1}^{l}\varpi_{t-1|t-1}^{i}\delta\Big{(}x_{t-1 }-x_{t-1|t-1}^{i}\Big{)}. \tag{10}\]  
Our goal is to use the above to build an approximation of the form  
\[p(x_{t}|Z_{t})\simeq\sum_{i=1}^{l}\varpi_{t|t}^{i}\delta\Big{(}x_{t}-x_{t|t}^ {i}\Big{)}. \tag{11}\]  
Our first step is to derive a convenient decomposition of \(p(x_{t}|Z_{t})\). This is done in the following lemma. **Lemma 1**. : _The following equality holds in the system given by (1), (2) and (4)_  
\[p(x_{t}|Z_{t})=p(\theta_{t}|y_{t},Z_{t})p(y_{t}|Z_{t}), \tag{12}\]  
_where_  
\[p(y_{t}|Z_{t})\propto p(z_{t}|y_{t})p(y_{t}|Z_{t-1}), \tag{13}\] \[p(\theta_{t}|y_{t},Z_{t})\propto p(\theta_{t}|y_{t},Z_{t-1}). \tag{14}\]  
It follows from Lemma 1 that, in order to find an expression of \(p(x_{t}|Z_{t})\) we need expressions of \(p(y_{t}|Z_{t-1})\) and \(p(\theta_{t}|y_{t},Z_{t})\). Under the approximation (10), the desired expressions are given in the following lemma. **Lemma 2**. : _If (10) holds, then_  
\[p(y_{t}|Z_{t-1}) \stackrel{{\sim}}{{\propto}}\sum_{i=1}^{l}\psi_{t}^{i} (y_{t}), \tag{15}\] \[p(\theta_{t}|y_{t},Z_{t-1}) \stackrel{{\sim}}{{\propto}}\sum_{i=1}^{l}\psi_{t}^ {i}(y_{t})\mathcal{N}\Big{(}\theta_{t};\mu_{t}^{i}(y_{t}),\rho_{t}^{i}(y_{t}) \Big{)}. \tag{16}\]  
_where to simplify the notation we use \(g_{t-1}^{-i}=\big{(}g_{t-1}^{i}\big{)}^{-1}\), and \(\widetilde{\alpha}\) denotes the approximately proportional sign. Also_  
\[g_{t-1}^{i}(e) =g\Big{(}y_{t-1|t-1}^{i},\theta_{t-1|t-1}^{i},u_{t-1},e\Big{)},\]0  
_where \(\mathbf{J}\) denoted the Jacobian operator,_  
\[g_{t-1}^{i}(e) =g\Big{(}y_{t-1|t-1}^{i},\theta_{t-1|t-1}^{i},u_{t-1},e\Big{)},\]1 \[g_{t-1}^{i}(e) =g\Big{(}y_{t-1|t-1}^{i},\theta_{t-1|t-1}^{i},u_{t-1},e\Big{)},\]2 \[g_{t-1}^{i}(e) =g\Big{(}y_{t-1|t-1}^{i},\theta_{t-1|t-1}^{i},u_{t-1},e\Big{)},\]3 \[g_{t-1}^{i}(e) =g\Big{(}y_{t-1|t-1}^{i},\theta_{t-1|t-1}^{i},u_{t-1},e\Big{)},\]4  
_and_  
\[\upsilon_{t}^{i}(y_{t}) =\left[ \begin{array}{c}g_{t-1}^{-i}(y_{t})\\ \frac{-b_{t-1}^{i}\circ g_{t-1}^{-i}(y_{t})-d_{t-1}^{-i}\circ g_{t-1}^{-i}(y_{ t})\theta_{t-1}}{b_{t-1}^{i}\circ g_{t-1}^{-i}(y_{t})}\end{array} \right],\] \[\varsigma_{t}^{i}(y_{t}) =\left[ \begin{array}{c}0\\ 0\\ \frac{1}{b_{t-1}^{i}\circ g_{t-1}^{-i}(y_{t})}\end{array} \right].\]  
In order to build an approximation of the form (11) we need a method for drawing samples from \(p(x_{t}|Z_{t})\).