# Primary User Localization Algorithm Based on Compressive Sensing in Cognitive Radio Networks
## 5 Simulation and Analysis of Localization Performance  
The localization performance of the proposed PU-CSL scheme has been simulated and compared with RR-WCL scheme using MATLAB ([13] has proved that the localization performance of RR-WCL is much better than W-Centroid, RR-WCL is then chosen as comparison). Here is the simulation environment. There is one source signal node, \(N=40\). SUs are randomly distributed in a quadrate sensing localization area of 100 m \(\times\) 100 m. The parameters of the signal model are respectively set as \(P_{t}=40\) dBm, \(\eta=2\), \(d_{0}=1\) m. After balancing spectrum efficiency and observation times, the death rate \(\alpha\) and birth rate \(\beta\) in the PU activity model [17] are both set as 1. The mean and standard deviation value of shadow fading factor \(X_{\sigma}\) are respectively 0 and 4. The energy fingerprints of nodes are obtained based on signal loss model Equation (2), the correlation coefficients are reconstructed by CS using BP algorithm. Figure 5 displays the comparative result of PU-CSL and RR-WCL concerning the root mean square error of location error (we recall the definition of root mean square error as RMSE = \(\|X-\widehat{X}\|\), where \(X\) is the original observation and \(\widehat{X}\) is the reconstructed signal) and MLE (the maximum location error is the maximum distance between the actual position and the predicted position of the node). The signal-to-noise ratio (SNR) is 0 dB\(\sim\)20 dB and the amount of SUs \(N\) in spectrum sensing is 40. Several points can be found from the curves. Firstly, the root mean square error and maximum location error of both algorithms continually decrease as SNR increases. This is because the energy fingerprints of the SUs and the source signal node become more similar when SNR is lower, which leads to better localization performance. Secondly, as SNR changed between 0 dB and 20 dB, the root mean square error and maximum location error of the PU-CSL respectively improved by 33.38%\(\sim\)65.66% and 28.20%\(\sim\)71.04% compared to the PR-WCL, which means that PU-CSL exhibits better anti-noise performance. Besides, under the condition of same SNR, both of the root mean square error and maximum location error of PU-CSL are smaller than RR-WCL. Therefore, PU-CSL shows higher localization accuracy. Since RR-WCL merely concerns the degree of correlation between nodes and the source node, the proposed PU-CSL algorithm integrally explores the correlation between source signal and SUs using CS. Hence, the source signal node is preferably described by SUs with correlation property. However, PU-CSL achieves higher localization accuracy. Figure 4: The example for the validity of the algorithm. Figure 6 shows the localization performance with respect to the change of root mean square error and maximum location error as the number of SUs \(N\) changes, where \(\text{SNR}=10\) dB. There are two aspects that can be inferred from Figure 6. Firstly, the root mean square error and maximum location error of both algorithms decrease with the increase of the amount of SUs. In other words, the more nodes getting involved in CSS, the higher localization accuracy of the source signal node is obtained. However, in actual CRN, as the number of SUs increases, the information sent to IPC also increases and request for IPC\({}^{{}^{\prime}}\) data processing ability gets higher. Thus, in practice, we should choose a suitable number of cognitive nodes for the localization of source signal node, comprehensively considering the hardware cost and localization performance of the network in the meantime. Secondly, as the number of SUs changes between 20 and 60, the root mean square error and maximum location error of the PU-CSL algorithm respectively improved by 36.10%\(\sim\)69.46% and 37.92%\(\sim\)61.08% compared to the PR-WCL, which means that the PU-CSL exhibits better localization performance. Besides, with the same number of cognitive nodes, the PU-CSL outperforms the RR-WCL in localization performance.