# Indoor Carrier Phase Positioning Technology Based on OFDM System
## 3 Positioning Algorithm
### Extended Kalman Filter
\right],E[\mathbf{W}_{z}]=\mathbf{0} \tag{33}\]  
\(\mathbf{Z}(k+1)\) is the SD measurement vector, \(\mathbf{W_{Z}}(k+1)\) is the measurement noises, \(\mathbf{R_{T}}\) and \(\mathbf{R_{P}}\) represent, respectively, the convince matrix of the measurement noises \(\mathbf{W_{T}}\) and \(\mathbf{W_{P}}\). \(\mathbf{R_{T}}\) is non-diagonal matrixes due to DD operation on the measurements as shown in Equation (24). \(\mathbf{R_{P}}\) can be obtained similarly. \(\mathbf{h}(x(k+1))\)is a nonlinear function that describes the relationship between the state vector and the measurement vector:  
\[\mathbf{h}(\mathbf{x}(k+1))=\left[ \begin{array}{c}\mathbf{h}(\mathbf{x}(k+1 ))_{T}\\ \mathbf{h}(\mathbf{x}(k+1))_{P}\end{array} \right]\]  
\[\mathbf{h}(\mathbf{x}(k+1))_{T}=\left[ \begin{array}{c}h_{T}^{1j}\\ \vdots\\ h_{T}^{(j-1)j}\\ h_{T}^{(j+1)j}\\ \vdots\\ h_{T}^{mj}\end{array} \right],\mathbf{h}(\mathbf{x}(k+1))_{P}=\left[ \begin{array} []{c}h_{P}^{1j}\\ \vdots\\ h_{P}^{(j-1)j}\\ h_{P}^{(j+1)j}\\ \vdots\\ h_{P}^{mj}\end{array} \right] \tag{34}\]  
\[h_{T}^{ij}=h_{T}^{i}-h_{T}^{i},(i=1,\ldots,m;i\
eq j)\]  
\[h_{P}^{ij}=h_{P}^{i}-h_{P}^{i},(i=1,\ldots,m;i\
eq j)\]  
\[h_{T}^{i}=\sqrt{\left(x(k+1|k)-x_{i}\right)^{2}+\left(y(k+1|k)-y_{i}\right)^{2 }};(i=1,\ldots,m)\]  
\[h_{P}^{i}=\frac{\sqrt{\left(x(k+1|k)-x_{i}\right)^{2}+\left(y(k+1|k)-y_{i} \right)^{2}}}{\lambda}-N_{ru}^{i};(i=1,\ldots,m)\]  
There is a need to linearize the measurement Equation (30) around the estimated UE location to use the EKF algorithm. The Jacobian matrix \(\mathbf{H}\) can be obtained as:  
\[\mathbf{H}(\mathbf{x}(k+1|k))=\frac{\partial\mathbf{h}}{\partial\mathbf{x}}|_ {\mathbf{x}(k+1|k)}=\left[ \begin{array}{cc}\frac{\partial\mathbf{h}_{T}}{ \partial\mathbf{x}}|_{\mathbf{x}(k+1|k)}\\ \frac{\partial\mathbf{h}_{P}}{\partial\mathbf{x}}|_{\mathbf{x}(k+1|k)}\end{array} \right] \tag{35}\]  
\[\frac{\partial\mathbf{h}_{T}}{\partial\mathbf{x}}|_{\mathbf{x}(k+1|k)}=\left[ \begin{array}{cc}\frac{\partial\mathbf{h}_{T}^{1j}}{\partial\mathbf{x}}|_{ \mathbf{x}(k+1|k)}&\frac{\partial\mathbf{h}_{T}^{1j}}{\partial\mathbf{y}}|_{ \mathbf{y}(k+1|k)}\\ \vdots&\vdots\\ \frac{\partial\mathbf{h}_{T}^{(j-1)j}}{\partial\mathbf{x}}|_{\mathbf{x}(k+1|k)} &\frac{\partial\mathbf{h}_{T}^{(j-1)j}}{\partial\mathbf{y}}|_{\mathbf{y}(k+1| k)}&\mathbf{0}(m-1\times 2)&\mathbf{0}(m-1\times m-1)\\ \frac{\partial\mathbf{h}_{T}^{(j+1)j}}{\partial\mathbf{x}}|_{\mathbf{x}(k+1|k) }&\frac{\partial\mathbf{h}_{T}^{(j+1)j}}{\partial\mathbf{y}}|_{\mathbf{y}(k+1| k)}\\ \vdots&\vdots\\ \frac{\partial\mathbf{h}_{T}^{(j+1)j}}{\partial\mathbf{x}}|_{\mathbf{x}(k+1|k) }&\frac{\partial\mathbf{h}_{T}^{(j+1)j}}{\partial\mathbf{y}}|_{\mathbf{y}(k+1| k)}\end{array} \right] \tag{36}\]\[\frac{\partial\mathbf{h}_{p}}{\partial\mathbf{x}}|_{\mathbf{x}(k+1|k)}=\left[ \begin{array}{cc}\frac{\partial\mathbf{h}_{p}^{ij}}{\partial\mathbf{x}}|_{x(k+ 1|k)}&\frac{\partial\mathbf{h}_{p}^{ij}}{\partial\mathbf{y}}|_{y(k+1|k)}\\ \vdots&\vdots\\ \frac{\partial\mathbf{h}_{p}^{ij}}{\partial\mathbf{x}}|_{x(k+1|k)}&\frac{ \partial\mathbf{h}_{p}^{ij}}{\partial\mathbf{y}}|_{y(k+1|k)}\end{array}