www.gusucode.com > phased 案例源码 matlab代码程序 > phased/ThresholdComplexValuedSignalsInComplexWGNExample.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 _coherent detection_ of complex-valued signals. % Coherent detection means that the system utilizes 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)/length(x)