www.gusucode.com > phased 案例源码 matlab代码程序 > phased/ThresholdForComplexValuedSignalsInComplexWGNExample.m

    %% Threshold for Complex-Valued Signals in Complex White Gaussian Noise
% This example shows how to empirically verify the probability of false alarm
%  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.

% Copyright 2015 The MathWorks, Inc.


%%
% 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 the 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)/N