## 5 Extended Kalman Filter Tracking
### First-Order Extended Kalman Filter  
In this section, we assume that the relative propagation delay \(\tau\) and time offset \(T\) between two nodes \(A\) and \(B\) follow a first-order Markov model. We model the progression of the state space parameters \(\mathbf{x}\) using Equation (25), where the state space variables \(\mathbf{x}\) and transition matrix \(\mathbf{F}\) at any arbitrary frame are \[\mathbf{x}= \begin{bmatrix}\tau\\ \tau\\ T\\ \end{bmatrix} ,\ \ \mathbf{F}(l)= \begin{bmatrix}1&l&0&0\\ 0&1&0&0\\ 0&0&1&l\\ 0&0&0&1\end{bmatrix} \,, \tag{34}\]  
and the process noise covariance matrix is simply modeled as  
\[\mathbf{Q}(l)=\text{diag}(\,\mathbf{Q}_{\tau}(l),\,\mathbf{Q}_{T}(l)\,), \tag{35}\]  
where \(\mathbf{Q}_{\tau}\) and \(\mathbf{Q}_{T}\) are the covariances the in delay and offset transition processes, respectively (implying that the two are uncorrelated). The delay covariance \(\mathbf{Q}_{\tau}=\text{cov}[\,\tau,\hat{\tau}\,]\) under a Gaussian velocity perturbation model is derived in [44] and is given by:  
\[\mathbf{Q}_{\tau}(l)= \begin{bmatrix}\frac{1}{2}\,\sigma_{\tau}^{2}\,l^{2}& \sigma_{\tau}^{2}\,l\\ \sigma_{\tau}^{2}\,l&\sigma_{\tau}^{2}\end{bmatrix} \,, \tag{36}\]  
where \(\sigma_{\tau}^{2}\) is the variance of the relative velocity and relies on the perturbations induced by environmental attributes such as wind currents. The offset covariance \(\mathbf{Q}_{T}=\text{cov}[\,T,\hat{T}\,]\) is the result of a two-state clock error model, which is derived in [45] and is given by:  
\[\mathbf{Q}_{T}(L_{A})= \begin{bmatrix}\sigma_{T}^{2}\,l+\frac{1}{3}\,\sigma_{T }^{2}\,l^{3}&\frac{1}{2}\,\sigma_{T}^{2}\,l^{2}\\ \frac{1}{2}\,\sigma_{T}^{2}\,l^{2}&\sigma_{T}^{2}\,l\end{bmatrix} \,, \tag{37}\]  
where \(\sigma_{T}^{2}\) and \(\sigma_{T}^{2}\) are the variances in estimating the relative clock and frequency offsets between the two radios, respectively. We previously defined the measurement transition in Equation (27) and now define and substitute the measurements \(\mathbf{z}\) and controls \(\mathbf{u}\) as:  
\[\mathbf{z}^{(n-1)}= \begin{bmatrix}t_{B,Rx}^{(n-1)}\\ t_{A,Rx}^{(n)}\end{bmatrix} \,,\quad\mathbf{u}^{(n-1)}= \begin{bmatrix}t_{A,Tx }^{(n-1)}\\ t_{B,Tx}^{(n)}\end{bmatrix} \,. \tag{38}\]  
The transition function is formulated by simply substituting the transition model defined in Equations (6) and (7) (the first-order Markov model), which is written as:  
\[\mathbf{h}\Big{(}\hat{\mathbf{x}}_{(-)}^{(n-1)}\Big{)}= \begin{bmatrix}\tau^{( n-1)}-T^{(n-1)}\\ \tau^{(n-1)}+\tau^{(n-1)}\,l_{A}^{(n-1)}+T^{(n-1)}+\dot{T}^{(n-1)}\,l_{A}^{(n-1 )}\end{bmatrix} \,, \tag{39}\]  
where the first-order frame length estimate is given by Equation (8), and the measurement covariance matrix can be computed using  
\[\mathbf{R}=\text{diag}\Big{(}\,\sigma_{t_{A,Rx}}^{2}\,,\,\sigma_{t_{B,Rx}}^{2 }\,\Big{)}, \tag{40}\]  
where the variances \(\sigma_{t_{A,Rx}}^{2}\) and \(\sigma_{t_{B,Rx}}^{2}\) are the variances of the ToA estimators that generate the measurements [51]. Following the definition presented in Equation (41), the measurement Jacobian may be written explicitly as:  
\[\mathbf{H}^{(n-1)}=\left. \begin{bmatrix}\frac{\partial\mathbf{h}(\hat{\mathbf{ x}})}{\partial\tau}&\frac{\partial\mathbf{h}(\hat{\mathbf{x}})}{\partial\tau}& \frac{\partial\mathbf{h}(\hat{\mathbf{x}})}{\partial T}&\frac{\partial\mathbf{ h}(\hat{\mathbf{x}})}{\partial\dot{T}}\end{bmatrix} \right|_{\hat{\mathbf{x}}_{(-)}^{(n-1)}}, \tag{41}\]  
where each partial derivative is included below for convenience:\[\frac{\partial\mathbf{h}(\hat{\mathbf{x}})}{\partial\tau}\bigg{|}_{ \hat{\mathbf{x}}_{(-)}^{(n-1)}}= \begin{bmatrix}1\\ 1\end{bmatrix} , \tag{42}\] \[\frac{\partial\mathbf{h}(\hat{\mathbf{x}})}{\partial\tau}\bigg{|}_ {\hat{\mathbf{x}}_{(-)}^{(n-1)}}= \begin{bmatrix}0\\ \frac{t_{B,Tx}^{(n)}-t_{A,Tx}^{(n-1)}+T^{(n-1)}}{1-\hat{T}^{(n-1)}}\end{bmatrix} ,\] (43) \[\frac{\partial\mathbf{h}(\hat{\mathbf{x}})}{\partial T}\bigg{|}_ {\hat{\mathbf{x}}_{(-)}^{(n-1)}}=