# A Mobile Anchor Node Assisted RSSI Localization Scheme in Underwater Wireless Sensor Networks
## 3 Detailed Description of the Proposed Localization Scheme
### Determining the Perpendicular Distance from a Node to the Trajectory
#### 3.3.2 Data Processing for Curves Used for Comparison  
Three steps of data processing are required before the measured RSSI curve is compared with each curve in the reference RSSI curve library. Firstly, the measured RSSI value contains noise which would cause a large error in the result of the curve matching. Since SVR has a strong ability [41], we use the predicted RSSI curve instead of the measured RSSI curve to perform curve matching. Secondly, the projection of a node on the trajectory is difficult to coincide with the midpoint of the trajectory, which causes the predicted RSSI curve to be offset from the reference RSSI curve. This offset causes us to extract only a part of the predicted RSSI curve to compare with the corresponding part of the reference RSSI curve. As shown in Figure 8, the projection of the node has three positional relationships with the midpoint of the trajectory: on the left (Figure 8a), coincident (Figure 8b), and on the right (Figure 8c). When the projection of the node is on the left of the midpoint, the predicted RSSI curve has a left offset relative to the reference RSSI curve. The predicted RSSI curve can be divided into four parts: S1, S2, S3, and S4. The reference RSSI curve can be divided into three parts: R1, R2, and R3. The S1 part of the predicted RSSI curve corresponds to the R1 part of the reference RSSI curve. However, the left offset of the curve causes the trajectory of the S1 part to exceed the actual travel range of the mobile anchor node, that is, the S1 part does not exist, and does not need to be compared with R1. The trajectory of the S4 part is within the range of actual travel of the mobile anchor node. However, the distance from the node to the point on the S4 part of the trajectory is too large, so that there is no part on the reference RSSI curve that can be compared with S4. Therefore, when the projection of the node is on the left of the midpoint, S2 + S3 of the predicted RSSI curve are compared with R2 + R3 of the reference RSSI curve. Similarly, when the node projection coincides with the midpoint, S1 + S2 of the predicted RSSI curve are compared with R1 + R2 of the reference RSSI curve. When the projection of the node is on the right of the midpoint, S2 + S3 of the predicted RSSI curve are compared with R1 + R2 of the reference RSSI curve. Thirdly, we need select feature points on the predicted RSSI curve to compare with the corresponding feature points on the reference RSSI curve. As shown in Figure 8a, when the projection of the node is on the left of the midpoint, assuming that the projection of the node on the trajectory is \(x_{pro}\), the midpoint of the trajectory is \(x_{mid}\). The offset of the predicted RSSI curve from the reference RSSI curve is  
\[L_{off}=\left|x_{mid}-x_{pro}\right| \tag{29}\]Starting from the projection, we select a feature point every \(\Delta L\) in the S2 part and the S3 part, respectively. The number of feature points in the S2 part, the S3 part, the S2 + S3 part are \(NL\), \(NR\), and \(NT\), respectively. They can be expressed as  
\[ \begin{cases}NL&=\left\lfloor(L/2-L_{off})/\Delta L\right\rfloor\\ NR&=\left\lfloor(L/2)/\Delta L\right\rfloor\\ NT&=NL+1+NR\end{cases}  \tag{30}\]  
The location of the leftmost feature point is  
\[\tilde{x}_{1}=x_{pro}-NL*\Delta L \tag{31}\]  
and the location of any feature point in S2 + S3 is  
\[\tilde{x}_{i}=\tilde{x}_{1}+(i-1)*NT*\Delta L \tag{32}\]  
where \(i=1,2...,NT\).