sdr.non_coherent_gain(n_nc: ArrayLike, snr: ArrayLike, p_fa: ArrayLike = 1e-06, detector: 'linear' | 'square-law' = 'square-law', complex: bool = True, snr_ref: 'input' | 'output' = 'input', extrapolate: bool = True) NDArray[float64]

Computes the SNR improvement by non-coherently integrating \(N_{nc}\) samples.

Parameters:
n_nc: ArrayLike

The number of samples \(N_{nc}\) to non-coherently integrate.

snr: ArrayLike

The reference SNR in dB.

p_fa: ArrayLike = 1e-06

The desired probability of false alarm \(P_{fa}\). This is used to compute the necessary thresholds before and after integration. The non-coherent gain is slightly affected by the \(P_{fa}\).

detector: 'linear' | 'square-law' = 'square-law'

The detector type.

  • "coherent": A coherent detector,

    \[T(x) = \mathrm{Re}\left\{\sum_{i=0}^{N_c-1} x[n-i]\right\} .\]

  • "linear": A linear detector,

    \[T(x) = \sum_{j=0}^{N_{nc}-1}\left|\sum_{i=0}^{N_c-1} x[n-i-jN_c]\right| .\]

  • "square-law": A square-law detector,

    \[T(x) = \sum_{j=0}^{N_{nc}-1}\left|\sum_{i=0}^{N_c-1} x[n-i-jN_c]\right|^2 .\]

complex: bool = True

Indicates whether the input signal is real or complex. This affects how the SNR is converted to noise variance.

snr_ref: 'input' | 'output' = 'input'

The SNR reference.

  • "input": The SNR is referenced at the input of the non-coherent integrator \(\text{SNR}_{\text{in},N_{nc}}\).

  • "output": The SNR is referenced at the output of the non-coherent integrator \(\text{SNR}_{\text{in},1}\).

extrapolate: bool = True

Indicates whether to extrapolate \(G_{nc}\) using smaller values of \(N_{nc}\). This is only done when the non-coherent gain cannot be explicitly solved for due to lack of floating-point precision. If False, the function will return np.nan for any \(N_{nc}\) that cannot be solved for.

Returns:

The non-coherent gain \(G_{nc}\) in dB.

See also

sdr.peebles

Notes

Let the input SNR required to achieve the specified detection performance with no non-coherent integration be \(\text{SNR}_{\text{in},1}\). Let the input SNR required to achieve the same detection performance with \(N_{nc}\) non-coherent integrations be \(\text{SNR}_{\text{in},N_{nc}}\). The non-coherent gain is defined as their difference. It is the SNR reduction provided by the use of non-coherent integration.

\[G_{nc} = \text{SNR}_{\text{in},1} - \text{SNR}_{\text{in},N_{nc}}\]

Examples

See the Non-coherent integration example.

Compute the non-coherent gain for various integration lengths at 10-dB SNR.

In [1]: sdr.non_coherent_gain(1, 10)
Out[1]: 0.0

In [2]: sdr.non_coherent_gain(2, 10)
Out[2]: 2.499445060713011

In [3]: sdr.non_coherent_gain(10, 10)
Out[3]: 8.666092814306324

In [4]: sdr.non_coherent_gain(20, 10)
Out[4]: 11.410342926869486

Plot the non-coherent gain parameterized by input SNR.

In [5]: plt.figure(); \
   ...: n = np.logspace(0, 3, 51).astype(int); \
   ...: plt.semilogx(n, sdr.coherent_gain(n), color="k");
   ...: 

In [6]: for snr in np.arange(-30, 40, 10):
   ...:     plt.semilogx(n, sdr.non_coherent_gain(n, snr, snr_ref="input"), label=f"{snr} dB")
   ...: 

In [7]: plt.legend(title="Input SNR", loc="upper left"); \
   ...: plt.xlabel("Number of samples, $N_{nc}$"); \
   ...: plt.ylabel("Non-coherent gain, $G_{nc}$"); \
   ...: plt.title("Non-coherent gain for various input SNRs");
   ...: 
../../_images/sdr_non_coherent_gain_1.png

Compare the non-coherent gain for linear and square-law detectors for various input SNRs. Notice that the square-law detector performs better at low SNRs and the linear detector performs better at high SNRs.

In [8]: plt.figure(); \
   ...: snr = np.linspace(-20, 10, 21); \
   ...: plt.plot(snr, sdr.non_coherent_gain(10, snr, p_fa=1e-6, detector="linear"), label="Linear"); \
   ...: plt.plot(snr, sdr.non_coherent_gain(10, snr, p_fa=1e-6, detector="square-law"), label="Square-law"); \
   ...: plt.legend(title="Detector", loc="upper left"); \
   ...: plt.xlabel("Input signal-to-noise ratio (dB)"); \
   ...: plt.ylabel("Non-coherent gain, $G_{nc}$"); \
   ...: plt.title("Non-coherent gain for $N_{nc} = 10$");
   ...: 
../../_images/sdr_non_coherent_gain_2.png

Examine the non-coherent gain across input SNR and false alarm rate for non-coherently integrating 10 samples. Notice that the non-coherent gain is affected by both. The coherent integration gain, however, is a constant 10 dB across both.

In [9]: plt.figure(); \
   ...: snr = np.linspace(-40, 12, 101); \
   ...: n_nc = 10;
   ...: 

In [10]: for p_fa in [1e-14, 1e-12, 1e-10, 1e-8, 1e-6, 1e-4, 1e-2]:
   ....:     g_nc = sdr.non_coherent_gain(n_nc, snr, p_fa)
   ....:     plt.plot(snr, g_nc, label=f"{p_fa:1.0e}")
   ....: 

In [11]: plt.legend(title="$P_{fa}$"); \
   ....: plt.ylim(0, 10); \
   ....: plt.xlabel("Input signal-to-noise ratio (dB)"); \
   ....: plt.ylabel("Non-coherent gain (dB)"); \
   ....: plt.title("Non-coherent gain for $N_{nc} = 10$");
   ....: 
../../_images/sdr_non_coherent_gain_3.png