# Detector Performance Analysis Using ROC Curves

This example shows how you can assess the performance of both coherent and noncoherent systems using receiver operating characteristic (ROC) curves. It assumes the detector operates in an additive complex white Gaussian noise environment.

ROC curves are often used to assess the performance of a radar or sonar detector. ROC curves are plots of the probability of detection (Pd) vs. the probability of false alarm (Pfa) for a given signal-to-noise ratio (SNR).

### Introduction

The probability of detection (Pd) is the probability of saying that "1" is true given that event "1" occurred. The probability of false alarm (Pfa) is the probability of saying that "1" is true given that the "0" event occurred. In applications such as sonar and radar, the "1" event indicates that a target is present, and the "0" event indicates that a target is not present.

A detector's performance is measured by its ability to achieve a certain probability of detection and probability of false alarm for a given SNR. Examining a detector's ROC curves provides insight into its performance. We can use the rocsnr function to calculate and plot ROC curves.

### Single Pulse Detection

Given an SNR value, you can calculate the Pd and Pfa values that a linear or square-law detector can achieve using a single pulse. Assuming we have an SNR value of 8 dB and our requirements dictate a Pfa value of at most 1%, what value of Pd can the detector achieve? We can use the rocsnr function to calculate the Pd and Pfa values and then determine what value of Pd corresponds to Pfa = 0.01. Note that by default the rocsnr function assumes coherent detection.

```
[Pd,Pfa] = rocsnr(8);
idx = find(Pfa==0.01); % find index for Pfa=0.01
```

Using the index determined above we can find the Pd value that corresponds to Pfa = 0.01.

Pd(idx)

ans = 0.8899

One feature of the rocsnr function is that you can specify a vector of SNR values and rocsnr calculates the ROC curve for each of these SNR values. Instead of individually calculating Pd and Pfa values for a given SNR, we can view the results in a plot of ROC curves. The rocsnr function plots the ROC curves by default if no output arguments are specified. Calling the rocsnr function with an input vector of four SNR values and no output arguments produces a plot of the ROC curves.

SNRvals = [2 4 8 9.4]; rocsnr(SNRvals);

In the plot we can select the data cursor button in the toolbar (or in the Tools menu) and then select the SNR = 8 dB curve at the point where Pd = 0.9 to verify that Pfa is approximately 0.01.

### Multiple Pulse Detection

One way to improve a detector's performance is to average over several pulses. This is particularly useful in cases where the signal of interest is known and occurs in additive complex white noise. Although this still applies to both linear and square-law detectors, the result for square-law detectors could be off by about 0.2 dB. Let's continue our example by assuming an SNR of 8 dB and averaging over two pulses.

`rocsnr(8,'NumPulses',2);`

By inspecting the plot we can see that averaging over two pulses resulted in a higher probability of detection for a given false alarm rate. With an SNR of 8 dB and averaging over two pulses, you can constrain the probability of false alarm to be at most 0.0001 and achieve a probability of detection of 0.9. Recall that for a single pulse, we had to allow the probability of false alarm to be as much as 1% to achieve the same probability of detection.

### Noncoherent Detector

To this point, we have assumed we were dealing with a known signal in complex white Gaussian noise. The rocsnr function by default assumes a coherent detector. To analyze the performance of a detector for the case where the signal is known except for the phase, you can specify a noncoherent detector. Using the same SNR values as before, let's analyze the performance of a noncoherent detector.

rocsnr(SNRvals,'SignalType','NonfluctuatingNoncoherent');

Focus on the ROC curve corresponding to an SNR of 8dB. By inspecting the graph with the data cursor, you can see that to achieve a probability of detection of 0.9, you must tolerate a false-alarm probability of up to 0.05. Without using phase information, we need a higher SNR to achieve the same Pd for a given Pfa. For noncoherent linear detectors, we can use Albersheim's equation to determine what value of SNR will achieve our desired Pd and Pfa.

`SNR_valdB = albersheim(0.9,.01) % Pd=0.9 and Pfa=0.01`

SNR_valdB = 9.5027

Plotting the ROC curve for the SNR value approximated by Albersheim's equation, we can see that the detector will achieve Pd = 0.9 and Pfa = 0.01. Note that the Albersheim's technique applies only to noncoherent detectors.

rocsnr(SNR_valdB,'SignalType','NonfluctuatingNoncoherent');

### Detection of Fluctuating Targets

All the discussions above assume that the target is nonfluctuating, which means that the target's statistical characteristics do not change over time. However, in real scenarios, targets can accelerate and decelerate as well as roll and pitch. These factors cause the target's radar cross section (RCS) to vary over time. A set of statistical models called Swerling models are often used to describe the random variation in target RCS.

There are four Swerling models, namely Swerling 1-4. The nonfluctuating target is often termed either Swerling 0 or Swerling 5. Each Swerling model describes how a target's RCS varies over time and the probability distribution of the variation.

Because the target RCS is varying, the ROC curves for fluctuating targets are not the same as the nonfluctuating ones. In addition, because Swerling targets add random phase into the received signal, it is harder to use a coherent detector for a Swerling target. Therefore, noncoherent detection techniques are often used for Swerling targets.

Let us now compare the ROC curves for a nonfluctuating target and a Swerling 1 target. In particular, we want to explore what the SNR requirements are for both situations if we want to achieve the same Pd and Pfa. For such a comparison, it is often easy to plot the ROC curve as Pd against SNR with varying Pfa. We can use the rocpfa function to plot ROC curve in this form.

Let us assume that we are doing noncoherent detection with 10 integrated pulses, with the desired Pfa being at most 1e-8. We first plot the ROC curve for a nonfluctuating target.

rocpfa(1e-8,'NumPulses',10,'SignalType','NonfluctuatingNoncoherent')

We then plot the ROC curve for a Swerling 1 target for comparison.

rocpfa(1e-8,'NumPulses',10,'SignalType','Swerling1')

From the figures, we can see that for a Pd of 0.9, we require an SNR of about 6 dB if the target is nonfluctuating. However, if the target is a Swerling case 1 model, the required SNR jumps to more than 14 dB, an 8 dB difference. This will greatly impact the design of the system.

As in the case of nonfluctuating targets, we have approximation equations to help determine the required SNR without having to plot all the curves. The equation used for fluctuating targets is Shnidman's equation. For the scenario we used to plot the ROC curves, the SNR requirements can be derived using the shnidman function.

`snr_sw1_db = shnidman(0.9,1e-8,10,1) % Pd=0.9, Pfa=1e-8, 10 pulses, `

snr_sw1_db = 14.7131

` % Swerling case 1`

The calculated SNR requirement matches the value derived from the curve.

### Summary

ROC curves are useful for analyzing detector performance, both for coherent and noncoherent systems. We used the rocsnr function to analyze the effectiveness of a linear detector for various SNR values. We also reviewed the improvement in detector performance achieved by averaging multiple samples. Lastly we showed how we can use the rocsnr and rocpfa functions to analyze detector performance when using a noncoherent detector for both nonfluctuating and fluctuating targets.