# Primary User Emulation Attacks: A Detection Technique Based on Kalman Filter
## 3 Experiments and Results  
To evaluate the performance of the proposed approach, a simulation of a primary user emulation attack scenario in a virtual cognitive radio network was performed using Matlab. The experiments were carried out on an Intel Core(TM) i7-6700 CPU @ 3.40 GHz 3.41 GHz, 16 GB RAM with a windows 10 64-bit Operating system. In the simulated scenario, we assume that there is a legitimate primary user, a PUE attacker, several secondary users along with some anchor nodes. We assume that the initial position of the primary user is known to the secondary users. Each anchor node gathers the measurements related to the primary user positions and share the results with the secondary users to track the movement of the primary user. These anchor nodes are positioned at specific positions while the secondary users are randomly deployed to simulate a real-world network scenario. Table 1 gives the simulation parameters used in this paper along with the positions of the anchor nodes, the initial position of the PU, and the position of the PUE attacker. Due to a number of random variables used in the proposed approach, including the noise affecting the acceleration, the measurement, and the signal, the Monte Carlo technique was used to handle the uncertainty in the simulation. The proposed approach was extensively tested and evaluated using several metrics including the probability of detection, the probability of false alarm, the probability of miss detection, and the error function. The results of the proposed approach were compared to those of the RSS-based localization technique. The probability of detection, \(P_{d}\), corresponds to the number of times where the primary user emulation attacker signal is correctly classified as an attack divided by the total number of attacks. It is given by  
\[P_{d}=\ \frac{Number\ of\ PUE\ detections}{Total\ number\ of\ attacks} \tag{18}\]  
The probability of false alarm, \(P_{fa}\), corresponds to the number of times where the legitimate primary user signal is wrongly classified as an attack divided by the total number of legitimate signals. It is expressed as \begin{table}
\begin{tabular}{c c} \hline
**Parameter** & **Value/Range** \\ \hline Transmission power & 150 W \\ \hline Transmitter antenna gain & 12 dB \\ \hline Receiver antenna gain & 4 dB \\ \hline Frequency & 2400 MHz \\ \hline Path loss exponent & 2 \\ \hline SNR & Range [ –20, 20] \\ \hline Initial position (\(x(k),\ y(k)\)) of the PU at \(k=0\) & (1400, 1400) \\ \hline Coordinates of the anchor nodes positions & (500, 500); (500, 1000); (500, 1500); (1000, 1500); (1500, 1500); \\  & (1500, 1000); (1500, 500); (1000, 500); (725, 1000); (1225, 1000); \\  & (1000, 725); (1000, 1225); (1225, 1500); (725, 1500); (1225, 500) \\ \hline Position of the PUE attacker & (1470, 1470) \\ \hline Coordinates of the secondary users positions & (750, 1350); (1200, 1400); (1300, 650); (800, 1000); (700, 750); (1000, 1100); \\  & (850, 650); (1400, 1100); (1450, 1200); (1400, 600); (1450, 850); \\ \hline \end{tabular}
\end{table} 
Table 1: The simulation parameters. \[P_{fa}=\ \frac{Number\ of\ false\ detected\ attack}{Total\ number\ of\ legitimate\ signals} \tag{19}\]  
The probability of miss detection, \(P_{m}\), corresponds to the number of times where an attack is incorrectly classified as a normal signal divided by the total number of attacks. It is given by  
\[P_{m}=\ \frac{Number\ of\ miss\ detected\ attacks}{Total\ number\ of\ attacks} \tag{20}\]  
The error function calculates the error between the estimated and the actual trajectory of the primary user. It is given by  
\[\text{Error function}=\ \frac{1}{n}\ \sum_{i=1}^{n}\bigl{(}X-X^{\prime}\bigr{)}^{2} \tag{21}\]  
where \(X\) is the actual trajectory, \(X^{\prime}\) is the predicted trajectory, and \(n\) is the number of collected measurements. Examples of results are given in Figures 2-9. Figure 2 illustrates the error function versus the measurement noise.