sdr.awgn_capacity(snr: ArrayLike, bandwidth: float | None = None) NDArray[float_]

Calculates the capacity of an additive white Gaussian noise (AWGN) channel.

Parameters:
snr: ArrayLike

The signal-to-noise ratio \(S / N\) in dB of the channel.

bandwidth: float | None = None

The bandwidth \(B\) of the channel in Hz. If specified, the capacity is calculated in bits/s. If None, the capacity is calculated in bits/2D.

Returns:

The capacity \(C\) of the channel in bits/2D, or bits/s if bandwidth was specified.

Notes

The inputs to the AWGN channel are \(x_i \in \mathbb{C}\) and the outputs are \(y_i \in \mathbb{C}\). The capacity of the AWGN channel is

\[C = \log_2(1 + \frac{S}{N}) \ \ \text{bits/2D} ,\]

where \(S = \frac{1}{N} \sum_{i=0}^{N-1} \left| x_i \right|^2\) is the average signal power and \(N = \sigma^2\) is the complex noise power. The units are bits/2D, which is equivalent to bits per complex channel use.

If the channel bandwidth \(B\) is specified, the channel capacity is

\[C = B\log_2(1 + \frac{S}{N}) \ \ \text{bits/s} .\]

Examples

The capacity monotonically decreases as the SNR decreases. In the limit as the SNR approaches 0 (\(-\infty\) dB), the capacity approaches 0.

In [1]: snr = np.linspace(-20, 20, 100); \
   ...: C = sdr.awgn_capacity(snr)
   ...: 

In [2]: plt.figure(figsize=(8, 4)); \
   ...: plt.plot(snr, C); \
   ...: plt.xlabel("Signal-to-noise ratio (dB), $S/N$"); \
   ...: plt.ylabel("Capacity (bits/2D), $C$"); \
   ...: plt.title("Capacity of the AWGN Channel"); \
   ...: plt.grid(True); \
   ...: plt.tight_layout()
   ...: 
../../_images/sdr_awgn_capacity_1.png

At capacity, which occurs when \(R = C\), \(E_b/N_0\) is related to \(E_s/N_0\) by

\[\frac{E_b}{N_0} = \frac{1}{R} \frac{E_s}{N_0} = \frac{1}{C} \frac{E_s}{N_0} .\]

When viewing the capacity as a function of \(E_b/N_0\), the capacity approaches 0 as \(E_b/N_0\) approaches -1.59 dB. This is the absolute Shannon limit.

In [3]: ebn0 = sdr.snr_to_ebn0(snr, C)

In [4]: plt.figure(figsize=(8, 4)); \
   ...: plt.semilogy(ebn0, C); \
   ...: plt.xlabel("Bit energy to noise PSD ratio (dB), $E_b/N_0$"); \
   ...: plt.ylabel("Capacity (bits/2D), $C$"); \
   ...: plt.title("Capacity of the AWGN Channel"); \
   ...: plt.grid(True, which="both"); \
   ...: plt.tight_layout()
   ...: 
../../_images/sdr_awgn_capacity_2.png