# UWB Positioning Algorithm Based on Fuzzy Inference and Adaptive Anti-NLOS Kalman Filtering
## 3 Adaptive Anti-NLOS Error KF Algorithm  
### KF Algorithm  
Assuming that the distance between the tag node and the base station node changes uniformly in a short period, the motion state of the tag node could be expressed as \(x(k)=\left[d(k)\quad v(k)\right]^{T}\), where \(d(k)\) represents the distance between the tag node and the base station at the moment \(k\), and \(v(k)\) refers to the speed of the tag node at the moment \(k\). Moreover, \(\mathbf{w}(k-1)=\left[w_{d}(k-1)\quad w_{v}(k-1)\right]^{T}\) was applied to indicate that the tag is inevitably disrupted by the process noise during the motion, where \(w_{d}(k-1)\) stands for the process noise of range at the moment \(k-1\), and \(w_{v}(k-1)\) is the process noise of speed at the moment \(k-1\). Then, the system state can be expressed by Equation (4):  
\[\left\{ \begin{array}{l}d(k)=d(k-1)+v(k-1)\times T+w_{d}(k-1)\\ v(k)=v(k-1)+w_{v}(k-1)\end{array} \right. \tag{4}\]  
where \(T\) is the sampling time. In this way, the KF model of the ranging data filtering was obtained, and Equations (5) and (6) stood for the state equation and the observation equation, respectively:  
\[\mathbf{x}_{k}=\mathbf{F}_{k}\mathbf{x}_{k-1}+\mathbf{w}_{k-1} \tag{5}\]  
\[\mathbf{z}_{k}=\mathbf{H}_{k}\mathbf{x}_{k}+\mathbf{v}_{k} \tag{6}\]  
where \(\mathbf{F}_{k}\) is the state transition matrix, and \(\mathbf{w}_{k-1}\) means the process noise at the moment \(k-1\), obeying the Gaussian distribution with a mean value of 0 and a variance matrix of \(\mathbf{Q}_{k-1}\). In addition, \(\mathbf{H}_{k}\) refers to the observation matrix, and \(\mathbf{v}_{k}\) represents the observation noise at the moment \(k\), which complies with the Gaussian distribution with a mean value of 0 and a variance matrix of \(\mathbf{R}_{k}\). \begin{table}
\begin{tabular}{c c c c c} \hline  & **RSSI** & **FPPL** & **RT** & **Range Error** \\ \hline
8 & large & large & extremely small & small \\ \hline
9 & large & large & very small & small \\ \hline
10 & large & medium & small & small \\ \hline
11 & large & extremely small & small & small \\ \hline
12 & large & very small & small & small \\ \hline
13 & large & very small & medium & medium \\ \hline
14 & large & medium & extremely small & medium \\ \hline
15 & large & medium & very small & medium \\ \hline
16 & medium & small & small & medium \\ \hline
17 & medium & small & medium & medium \\ \hline
18 & very large & medium & small & large \\ \hline
19 & very large & small & small & large \\ \hline
20 & large & small & small & large \\ \hline
21 & medium & very small & medium & large \\ \hline
22 & small & small & small & large \\ \hline
23 & small & small & large &Assuming that the estimated state of KF at the moment \(k-1\) is \(\overset{\alpha}{\textbf{x}}_{k-1}\), and the observed value of KF at the moment \(k\) is \(\textbf{z}_{k}\), the estimated state \(\overset{\alpha}{\textbf{x}}_{k}\) calculation processes of KF at the moment \(k\) are as follows:  
(1) One-step prediction  
The estimated state \(\overset{\alpha}{\textbf{x}}_{k-1}\) of KF at the moment \(k-1\) was used to predict the state at the moment \(k\). In other words, the observed value \(\textbf{z}_{k-1}\) at the moment \(k-1\) was applied to estimate the linear minimum variance of the actual state \(\textbf{x}_{k}\). Furthermore, the least mean square error at the moment \(k-1\) was estimated via \(\overset{\alpha}{\textbf{x}}_{k-1}=E\{\textbf{x}_{k-1}/\textbf{z}_{k-1}\}\), and \(\textbf{w}_{k-1}\) only affected the value of \(\textbf{x}_{k}\).