sdr.bsc_capacity(p: ArrayLike) NDArray[float64]

Calculates the capacity of a binary symmetric channel (BSC).

Parameters:
p: ArrayLike

The transition probability \(p\) of the BSC channel.

Returns:

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

Notes

The inputs to the BSC are \(x_i \in \{0, 1\}\) and the outputs are \(y_i \in \{0, 1\}\). The capacity of the BSC is

\[C = 1 - H_b(p) \ \ \text{bits/channel use} .\]

Examples

When the probability \(p\) of bit error is 0, the capacity of the channel is 1 bit/channel use. However, as the probability of bit error approaches 0.5, the capacity of the channel approaches 0.

In [1]: p = np.linspace(0, 1, 100); \
   ...: C = sdr.bsc_capacity(p)
   ...: 

In [2]: plt.figure(); \
   ...: plt.plot(p, C); \
   ...: plt.xlabel("Transition probability, $p$"); \
   ...: plt.ylabel("Capacity (bits/channel use), $C$"); \
   ...: plt.title("Capacity of the Binary Symmetric Channel");
   ...: 
../../_images/sdr_bsc_capacity_1.png