Engee documentation
Notebook

Multi-sample signal detection

This example shows how to detect a signal in complex white Gaussian noise using several received signal samples. A consistent filter is used to take advantage of the processing.

Introduction

The example "Detecting a signal against a background of white noise" presents the basic task of detecting a signal. Only one sample of the received signal is used for detection. In this example, more samples are used in the detection process to increase detection efficiency.

As in the previous example, let's assume that the signal strength is 1, and the signal-to-noise ratio (SNR) of one sample is 3 dB. The number of Monte Carlo trials is 100,000. The desired false alarm probability level (Pfa) is 0.001.

In [ ]:
using DSP
In [ ]:
Ntrial = Int64(1e5); # количество испытаний Монте-Карло 
Pfa = 1e-3; 
snrdb = 3; # SNR в дБ 
snr = db2pow(snrdb); # SNR в линейном масштабе 
npower = 1/snr; # мощность шума 
namp = sqrt(npower/2); # амплитуда шума в каждом канале

Signal detection using a long waveform

As mentioned in the previous example, the threshold is determined based on the Pfa. Therefore, as long as the threshold is selected, the Pfa remains unchanged, and vice versa. Meanwhile, of course, it is desirable to have a higher probability of detection (Pd). One way to achieve this is to use multiple samples for detection. For example, in the previous case, the SNR on one sample is 3 dB. If multiple samples can be used, then a consistent filter can provide additional gains in SNR and thus improve performance. In practice, a longer signal can be used to achieve such a gain. In the case of discrete-time signal processing, multiple samples can be obtained by increasing the sampling rate.

Let's assume that the signal is now formed from two samples:

In [ ]:
Nsamp = 2;
wf = ones(Nsamp,1);
mf = conj.(reverse(wf)); # matched filter

For a coherent receiver, the signal, noise, and threshold are defined as follows

In [ ]:
using Random
# fix the random number generator
seed = 2014
rstream = Xoshiro(seed)

s = wf*ones(1,Ntrial);
n = namp*(randn(rstream,Nsamp,Ntrial)+1im*randn(rstream,Nsamp,Ntrial));
snrthreshold = db2pow(npwgnthresh(Pfa, 1,"coherent"));
mfgain = mf'*mf;
threshold = sqrt.(npower*mfgain*snrthreshold);   # Final threshold T;

If the goal is present:

In [ ]:
x = s + n;
y = mf'*x;
z = real(y);
Pd = sum(z.>threshold)/Ntrial
print("Pd = $(Pd)")
Pd = 0.39814

If there is no goal

In [ ]:
x = n;
y = mf'*x;
z = real(y);
Pfa = sum(z.>threshold)/Ntrial
print("Pfa = $(Pfa)")
Pfa = 0.00104

Note that the SNR is improved by a consistent filter.

In [ ]:
snr_new = snr*mf'*mf;
snrdb_new = pow2db.(snr_new)[1];
print("snrdb_new = $(round(snrdb_new;sigdigits=5))")
snrdb_new = 6.0103

Let's build a maintenance curve for the new SNR value:

In [ ]:
rocsnr(snrdb_new,SignalType="NonfluctuatingCoherent",MinPfa=1e-4)
Out[0]:

It can be seen from the figure that the point set by Pfa and Pd falls directly on the curve. Thus, the SNR corresponding to the ROC curve is the SNR of one sample at the output of the matched filter. This shows that although multiple samples can be used for detection, the SNR threshold for a single sample (snrthreshold in the program) does not change compared to the case of a simple sample. There are no changes, because the threshold value is essentially determined by the Pfa. However, the final threshold, T, changes due to the additional gain of the matched filter. The resulting Pfa value remained the same compared to the case when only one sample was used for detection. However, the additional consistent gain improved the Pd from 0.1390 to 0.3947.

To test the relationship between Pd, Pfa, and SNR, similar calculations can be performed for an incoherent receiver.

Signal detection by pulse integration

Radar and sonar systems often use pulse integration to further improve detection performance. If the receiver is coherent, then pulse integration is reduced to adding the real parts of the matched filtered pulses. Thus, when using a coherent receiver, the improvement in SNR occurs linearly. If 10 pulses are integrated, the SNR will improve 10 times. For an incoherent receiver, this dependence is not so simple. The following example shows the use of pulse integration with an incoherent receiver.

Assume that the integration is 2 pulses. Then construct the received signal and apply a matched filter to it.

In [ ]:
PulseIntNum = 2;
Ntotal = PulseIntNum*Ntrial;
s = wf*exp.(1im*2*pi*rand(rstream,1,Ntotal));  # noncoherent
n = sqrt(npower/2).*(randn(rstream,Nsamp,Ntotal) + 1im*randn(rstream,Nsamp,Ntotal));

If the goal is present, we get

In [ ]:
x = s .+ n;
y = mf'*x;
y = reshape(y,Ntrial,PulseIntNum);  # reshape to align pulses in columns;

You can accumulate impulses using one of two possible approaches. Both approaches involve approximating a modified Bessel function of the first kind, which occurs when modeling the likelihood ratio (LRT) test of an incoherent detection process using multiple pulses. The first approach is to summarize by pulses, which is often called a quadratic law detector. The second approach is to summarize for all pulses, what is often called a linear detector. With a small SNR, it is preferable to use a square law detector, while with a large SNR, it is more profitable to use a linear detector. In this simulation, we use a square law detector. However, the difference between the two types of detectors is usually within 0.2 dB.

For this example, choose a quadratic law detector that is more popular than a linear detector. The pulsint function can be used to perform the quadratic law detector. The function treats each column of the input data matrix as a separate pulse. The pulsint function performs the operation

\begin{align}
y=\sqrt{|x_1|2+\cdots+|x_n|2}\ .
\end

In [ ]:
z = pulsint(y,"noncoherent");

The relationship between the threshold T and Pfa, taking into account the new sufficient statistics of z, is determined as follows

\begin{align}
P_{fa}=1-I\left(\frac{T^2/(NM)}{\sqrt{L}},L-1\right)
=1-I\left(\frac{\rm SNR}{\sqrt{L}},L-1\right)\ .
\end

where
\begin{align}
I(u,K)=\int_0{u\sqrt{K+1}}\frac{e{-\tau}\tau^K}{K!}d\tau
\end

the form of the incomplete Pearson gamma function, and L is the number of pulses used to integrate the pulses. Using a quadratic law detector, it is possible to calculate the threshold value of the SNR associated with pulse integration using the npwgnthresh function, as before.

In [ ]:
snrthreshold = db2pow(npwgnthresh(Pfa,PulseIntNum,"noncoherent"));

The resulting threshold for sufficient statistics, , is defined as follows

In [ ]:
mfgain = mf'*mf;
threshold = (sqrt.(npower*mfgain*snrthreshold))[1];

The probability of detection is determined as follows

In [ ]:
Pd = sum(z.>threshold)/Ntrial
print("Pd = $(Pd)")
Pd = 0.52807

Then calculate the Pfa when the received signal is only noise using an incoherent detector with integrated 2 pulses.

In [ ]:
x = n;
y = mf'*x;
y = reshape(y,Ntrial,PulseIntNum);
z = pulsint(y,"noncoherent");
Pfa = sum(z.>threshold)/Ntrial
print("Pfa = $(Pfa)")
Pfa = 0.00101

To build a pulse integration ROC curve, you need to specify the number of pulses used in the integration in the rocsnr function.:

In [ ]:
rocsnr(snrdb_new,SignalType="NonfluctuatingNoncoherent",
    MinPfa=1e-4,NumPulses=PulseIntNum)
Out[0]:

Once again, the point set by Pfa and Pd falls on the curve. Thus, the SNR on the ROC curve determines the SNR of a single sample used for single-pulse detection.

Such an SNR value can also be obtained from Pd and Pfa using the Albersham equation. The result obtained from the Alberheim equation is only an approximation, but it is good enough in the commonly used ranges of Pfa, Pd and pulse integration.

Note: The Alberheim equation has several assumptions:

  • the goal does not fluctuate,
  • white Gaussian noise;
  • the receiver is incoherent;
  • A linear detector is used for detection.

To calculate the required SNR for a single sample to achieve certain Pd and Pfa, use the Albersham function

In [ ]:
snr_required = albersheim(Pd,Pfa,N=PulseIntNum)
print("snr_required = $(round(snr_required;digits=5))")
snr_required = 6.01593

This calculated required SNR value corresponds to the new SNR value of 4 dB.

To see the improvement in Pd due to pulse integration, we construct a ROC curve without pulse accumulation.

In [ ]:
rocsnr(snrdb_new,SignalType="NonfluctuatingNoncoherent",
    MinPfa=1e-4,NumPulses=1)
Out[0]:

It can be seen from the figure that without pulse accumulation, Pd can only be about 0.24 at Pfa 1e-3. When two pulses accumulate, as shown in the Monte Carlo simulation above, for the same Pfa, the Pd is about 0.53.

Conclusion

This example showed how using multiple signal sampling during detection can increase the probability of detection while maintaining the desired false alarm probability level. In particular, it was shown how using a longer signal or pulse accumulation method can improve Pd. The example shows the relationship between the Pd, Pfa, ROC curve and the Alberheim equation. The efficiency is calculated using Monte Carlo simulation.