sdr.biawgn_capacity(snr: ArrayLike) NDArray[float64]

Calculates the capacity of a binary-input additive white Gaussian noise (BI-AWGN) channel.

Parameters:
snr: ArrayLike

The signal-to-noise ratio \(S / N = A^2 / \sigma^2\) at the output of the channel in dB.

Note

This SNR is for a real signal. In the case of soft-decision BPSK, the SNR after coherent detection is \(S / N = 2 E_s / N_0\), where \(E_s\) is the energy per symbol and \(N_0\) is the noise power spectral density.

Returns:

The capacity \(C\) of the channel in bits/1D.

Notes

The BI-AWGN channel is defined as

\[Y = A \cdot X + W ,\]

where \(X\) is the input with \(x_i \in \{-1, 1\}\), \(A\) is the signal amplitude, \(W \sim \mathcal{N}(0, \sigma^2)\) is the AWGN noise, the SNR is \(A^2 / \sigma^2\), and \(Y\) is the output with \(y_i \in \mathbb{R}\).

The capacity of the BI-AWGN channel is

\[C = \max_{f_X} I(X; Y)\]

\[I(X; Y) = H(Y) - H(Y | X) ,\]

where \(I(X; Y)\) is the mutual information between the input \(X\) and output \(Y\), \(H(Y)\) is the differential entropy of the output \(Y\), and \(H(Y | X)\) is the conditional entropy of the output \(Y\) given the input \(X\). The maximum mutual information is achieved when \(X\) is equally likely to be \(-1\) or \(1\).

The conditional probability density function (PDF) of \(Y\) given \(X = x\) is

\[f_{Y|X}(y|x) = \frac{1}{\sqrt{2\pi\sigma^2}} \exp \left( -\frac{(y - A x)^2}{2\sigma^2} \right) .\]

The marginal PDF of \(Y\) is

\[f_Y(y) = \frac{1}{2} f_{Y|X}(y|1) + \frac{1}{2} f_{Y|X}(y|-1) .\]

The differential entropy of the output \(Y\) is

\[H(Y) = - \int_{-\infty}^{\infty} f_Y(y) \log f_Y(y) \, dy .\]

The conditional entropy of the output \(Y\) given the input \(X\) is

\[H(Y | X) = - \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} f_{Y|X}(y|x) \log f_{Y|X}(y|x) \, dy \, dx .\]

In this case, since \(Y = X + W\), the conditional entropy simplifies to

\[H(Y | X) = H(W) = \frac{1}{2} \log(2\pi e \sigma^2) .\]

The capacity of the BI-AWGN channel is

\[\begin{split} \begin{align*} C &= H(Y) - H(Y | X) \\ &= - \int_{-\infty}^{\infty} f_Y(y) \log f_Y(y) \, dy - \frac{1}{2} \log(2\pi e \sigma^2) . \end{align*} \end{split}\]

However, the integral must be solved using numerical methods. A convenient closed-form upper bound, provided by Yang, is

\[C \leq C_{ub} = \log(2) - \log(1 + e^{-\text{SNR}}) ,\]

where \(\text{SNR} = A^2 / \sigma^2\) in linear units.

References

Examples

In [1]: snr = np.linspace(-30, 20, 51)

In [2]: C_ub = np.log2(2) - np.log2(1 + np.exp(-sdr.linear(snr)))

In [3]: C = sdr.biawgn_capacity(snr)

In [4]: plt.figure(); \
   ...: plt.plot(snr, C_ub, linestyle="--", label="$C_{ub}$"); \
   ...: plt.plot(snr, C, label="$C$"); \
   ...: plt.legend(); \
   ...: plt.xlabel("Signal-to-noise ratio (dB), $A^2/\sigma^2$"); \
   ...: plt.ylabel("Capacity (bits/1D), $C$"); \
   ...: plt.title("Capacity of the BI-AWGN Channel");
   ...: 
../../_images/sdr_biawgn_capacity_1.png
In [5]: snr = np.linspace(-30, 20, 51)

In [6]: p = sdr.Q(np.sqrt(sdr.linear(snr)))

In [7]: C_hard = sdr.bsc_capacity(p)

In [8]: C_soft = sdr.biawgn_capacity(snr)

In [9]: plt.figure(); \
   ...: plt.plot(snr, C_hard, label="BSC (hard)"); \
   ...: plt.plot(snr, C_soft, label="BI-AWGN (soft)"); \
   ...: plt.legend(); \
   ...: plt.xlabel("Signal-to-noise ratio (dB), $A^2/\sigma^2$"); \
   ...: plt.ylabel("Capacity (bits/1D), $C$"); \
   ...: plt.title("Capacity of the BSC (hard-decision) and BI-AWGN (soft-decision) Channels");
   ...: 
../../_images/sdr_biawgn_capacity_2.png