## 6 Denoising Processing of Positioning Data Based on Particle Filter
### Denoising Processing of Sampling Data Based on Particle Filter  
Particle propagation was achieved by sampling the ZigBee-GPS/BDS multi-sensor state-transition model \(q(\mathbf{x}(k)\,\mathbf{x}(k-1),\ z(k))\) and generating new particle states \(x_{i}(k)\). In order to reduce the interference of environmental noise on the positioning data, BPF was used to filter and denoise the multi-sensor positioning data [26], and the latest data collected by sensors was substituted into the observation equation to establish a new particle filter observation equation, which improves the reliability of multi-sensor data samples. The specific steps were as follows:  
Step 1 The filtering model of the multi-sensor of the unmanned ship was established, and the state and measurement model of the multi-sensor system was defined as follows:  
\[\left\{\begin{array}{l}\mathbf{x}(k)=f(\mathbf{x}(k-1))+\lambda(k-1)\\ \mathbf{z}(k)=h(\mathbf{x}^{\text{ZGB}}(k),\widetilde{\mathbf{x}}(k))+\
u(k)\end{array}\right. \tag{42}\]  
where \(\mathbf{x}(k)\) is the system state, \(\mathbf{z}(k)\) is the sensor recursive positioning data, \(f(\cdot)\) is the state transition function, \(h(\cdot)\) is the measurement function, \(\mathbf{x}(k-1)\) is the system state at the last moment, \(\mathbf{x}^{\text{ZGB}}(k)\) is the sensor positioning data at time \(k\), \(\widetilde{\mathbf{x}}(k)\) is the sensor positioning data weighted by the variance at time \(k\), \(\lambda(k-1)\) is the estimation noise, and \(\
u(k)\) is the measurement noise.  
Step 2 initialization: the prior density \(p(\mathbf{x}_{0})\) was randomly sampled and the initialization particle set \(\mathbf{x}(0)\) was generated.  
Step 3 importance sampling.  
(a) Randomly select \(n\) particle samples that satisfy the following distribution from the importance density function:  
\[x_{i}(k)\,\sim q(\mathbf{x}(k)|\mathbf{x}(k-1),\ z(k))=p(\mathbf{x}(k)|\mathbf{x}(k-1)) \tag{43}\]  
(b) Calculate the weights of the sampled particles and update them as follows:  
\[\omega_{i}(k)=\omega_{i}(k-1)(p(\mathbf{z}(k)|x_{i}(k))p(x_{i}(k)|x_{i}(k-1))/q(x_{ i}(k)|x_{i}(k-1),\mathbf{z}(k)) \tag{44}\]  
where \(\omega_{i}(k)\) is the \(i\)th particle weight at time \(k\).  
(c) Normalized the importance weights.  
\[\widetilde{\omega}_{i}(k)=\omega_{i}(k)[\sum\limits_{i=1}^{n}\omega_{i}(k)]^{-1} \tag{45}\]  
Step 4 Resampling.  
Calculate the effective particle number \(N_{\textit{eff}}=(\sum\limits_{i=1}^{n}\ (\omega_{i}(k))^{2})^{-1}\). If \(N_{\textit{eff}}\) is less than the threshold value \(N_{\textit{th}}\), the particle set \(\{x_{i}(k)\), \(\widetilde{\omega}_{i}(k)\}\) is resampled; otherwise, no resampling is required.  
Step 5 Output the local estimation and covariance matrix of the filtered multi-sensor positioning data:  
\[\hat{x}_{i}(k)=\sum\limits_{i=1}^{n}\widetilde{\omega}_{i}(k)x_{i}(k)\ P_{i}(k)=\sum \widetilde{\omega}_{i}(k)[x_{i}(k)-\hat{x}_{i}(k)][x_{i}(k)-\hat{x}_{i}(k)]^{T} \tag{46}\]  
where \(\hat{x}_{i}(k)\) is the local estimation of particle information, and \(P_{i}(k)\) is the covariance matrix, \(k=1,2,\ldots,T\), \(i=1,2,\ldots,n\).