Documentation |
In phased-array applications, you sometimes need to decide between two competing hypotheses to determine the reality underlying the data the array receives. For example, suppose one hypothesis, called the null hypothesis, states that the observed data consists of noise only. Suppose another hypothesis, called the alternative hypothesis, states that the observed data consists of a deterministic signal plus noise. To decide, you must formulate a decision rule that uses specified criteria to choose between the two hypotheses.
When you use Phased Array System Toolbox™ software for applications such as radar and sonar, you typically use the Neyman-Pearson (NP) optimality criterion to formulate your hypothesis test.
When you choose the NP criterion, you can use npwgnthresh to determine the threshold for the detection of deterministic signals in white Gaussian noise. The optimal decision rule derives from a likelihood ratio test (LRT). An LRT chooses between the null and alternative hypotheses based on a ratio of conditional probabilities.
npwgnthresh enables you to specify the maximum false-alarm probability as a constraint. A false alarm means determining that the data consists of a signal plus noise, when only noise is present.
For details about the statistical assumptions the npwgnthresh function makes, see the reference page for that function.
This example shows how to verify the probability of false alarm empirically for a real-valued signal in white Gaussian noise.
Determine the required signal-to-noise (SNR) in decibels for the NP detector when the maximum tolerable false-alarm probability is 10^{–3}.
Pfa = 1e-3;
T = npwgnthresh(Pfa,1,'real');
Determine the actual threshold corresponding to the desired false-alarm probability, assuming the variance is 1.
variance = 1; threshold = sqrt(variance * db2pow(T));
Verify empirically that the threshold results in the desired false-alarm probability under the null hypothesis. To do so, generate 1 million samples of a Gaussian random variable, and determine the proportion of samples that exceed the threshold.
rng default
N = 1e6;
x = sqrt(variance) * randn(N,1);
falsealarmrate = sum(x > threshold)/N
falsealarmrate = 9.9500e-04
Plot the first 10,000 samples and a line showing the threshold.
x1 = x(1:1e4); plot(x1) line([1 length(x1)],[threshold threshold],'Color','red'); xlabel('Sample'); ylabel('Value');
The red horizontal line in the plot indicates the threshold. You can see that few sample values exceed the threshold. This result is expected because of the small false-alarm probability.
This example shows how to verify the probability of false alarm empirically in a system that uses pulse integration with two real-valued pulses. In this scenario, each sample is the sum of two samples, one from each pulse.
Determine the required SNR for the NP detector when the maximum tolerable false-alarm probability is 10^{–3}.
Pfa = 1e-3;
T = npwgnthresh(Pfa,2,'real');
Generate two sets of 10,000 samples of a Gaussian random variable.
rng default
variance = 1;
N = 1e6;
puls1 = sqrt(variance)*randn(N,1);
puls2 = sqrt(variance)*randn(N,1);
intpuls = puls1 + puls2;
Compute the proportion of samples that exceed the threshold.
threshold = sqrt(variance*db2pow(T)); falsealarmrate = sum(intpuls > threshold)/N
falsealarmrate = 9.8900e-04
This example shows how to verify the probability of false alarm empirically in a system that uses complex-valued signals. The system uses coherent detection, which means that the system has information about the phase of the complex-valued signals.
Determine the required SNR for the NP detector in a coherent detection scheme with one sample. Use a maximum tolerable false-alarm probability of 10^{–3}.
Pfa = 1e-3;
T = npwgnthresh(Pfa,1,'coherent');
Test that this threshold empirically results in the correct false-alarm rate The sufficient statistic in the complex-valued case is the real part of received sample.
rng default
variance = 1;
N = 1e6;
x = sqrt(variance/2)*(randn(N,1)+1j*randn(N,1));
threshold = sqrt(variance*db2pow(T));
falsealarmrate = sum(real(x)>threshold)/length(x)
falsealarmrate = 9.9500e-04