# Cooperative Localization Using Distance Measurements for Mobile Nodes
## 5 Simulations  
Networks with randomly generated nodes were used to test the performance of the proposed algorithm. In all of the following simulations the position of the first node is fixed to \([0,0]\) and the positions of the other nodes are uniformly generated within \([-20,20]\). To validate the proposed approach that can address the ambiguity problem, we use the same noise-free scenarios as given in Figure 1 the results of which are shown in Figure 3. Unlike the results that are obtained from the MDS alone, as shown in Figure 1, when we compare the locations of the true and estimated nodes in Figure 3, we can see that, while using the method that is presented in Section 3, the rotation and flip ambiguities are solved correctly and, therefore, the positions of the nodes are successfully recovered. Figure 3: Estimation of the positions of nodes in noise-free scenarios. (**a**) Rotation only; and (**b**) Rotation and flip. Next, we consider the noisy scenario, as discussed in Section 4, in the noisy scenario the detection of whether flip has occurred is no longer straightforward and requires an appropriate choice of threshold. Firstly, to demonstrate the ability of the proposed algorithm to detect flip or no flip states, we tested two different network configurations: one with the number of nodes \(n=6\) and the other with \(n=10\). The noise is assumed to be Gaussian distributed with mean 0 and standard deviation, \(\sigma\), of 0.01. For each of the configurations, the outcomes of 50 simulations are shown in Figure 4. The results show that the proposed algorithm can correctly detect flip ambiguity in the noisy scenario. Having established that the proposed algorithm can successfully deal with the ambiguity problem, we now consider the performance of the algorithm in terms of the accuracy of the localization. For the sake of simplicity, we define the noise level, standard variance of the noise, as \(\delta=-20\log_{10}\sigma\), with \(\delta\) chosen to range from 20 to 50 in steps of five and \(\sigma\) calculated accordingly. For each noise level, the Root-Mean-Square Error (RMSE) from 2000 simulations is used to evaluate the performance of the localization. The RMSE is defined by  
\[\text{RMSE}=\frac{1}{n}\sum_{i=1}^{n}\sqrt{\sum_{j=1}^{m}\frac{(\hat{x}_{i,j}- x_{ij})^{2}+(\hat{y}_{i,j}-y_{i,j})^{2}}{m}} \tag{43}\]  
where \((x_{i,j},y_{i,j})\) and \((\hat{x}_{i,j},\hat{y}_{i,j})\) are the true and estimated location of \(i\)-th, \(i=1,\cdots,n\), node in \(j\)-th, \(j=1,\cdots,m\), Monte Carlo simulation. It is assumed that \((x_{i,j},y_{i,j})\) is generated within region \([-100,100]\times[-100,100]\) uniformly in each Monte Carlo simulation. In order to provide a comparison with the proposed algorithm, we implemented the nonlinear least squares estimator (NLSE) that is presented in [37], solving the nonlinear least square problem using an optimization method. Additionally, the proposed algorithm essentially takes advantage of the mobility of the node to create virtual anchors for localizing the unknown nodes. As a result, the alignment method of relative locations proposed in [30; 42] can be potentially applied in this scenario. As a comparison, the performance of this conventional method is also given. From the simulation results that are shown in Figure 5, it can be seen that the proposed algorithm has better performance in terms of the RMSE for different noise levels and numbers of nodes than the NLS estimator with the conventional method. The localization error are arise from two effects: 1. MDS localization error; 2. mis-alignment error, i.e., the error from inaccurately aligning the positions. Additionally, it should also be noted that the algorithm proposed in this paper can simultaneously estimate the positions of all of the nodes, which cannot be achieved using the algorithm that was presented in [37].