komm.AWGNChannel
Additive white Gaussian noise (AWGN) channel. It is defined by $$ Y_n = X_n + Z_n, $$ where $X_n$ is the channel input signal, $Y_n$ is the channel output signal, and $Z_n$ is the noise, which is iid according to a Gaussian distribution with zero mean. The channel signal-to-noise ratio is calculated by $$ \snr = \frac{P}{N}, $$ where $P = \mathrm{E}[X^2_n]$ is the average power of the input signal, and $N = \mathrm{E}[Z^2_n]$ is the average power (and variance) of the noise. For more details, see CT06, Ch. 9.
Attributes:
-
signal_power
(float | str
) –The input signal power $P$. If equal to the string
'measured'
, then every time the channel is invoked the input signal power will be computed from the input itself (i.e., its squared Euclidean norm). -
snr
(Optional[float]
) –The channel signal-to-noise ratio $\snr$ (linear, not decibel). The default value is
np.inf
, which corresponds to a noiseless channel.
Input:
-
in0
(Array1D[float]
) –The input signal $X_n$.
Output:
-
out0
(Array1D[float]
) –The output signal $Y_n$.
Examples:
>>> np.random.seed(1)
>>> awgn = komm.AWGNChannel(signal_power=5.0, snr=200.0)
>>> x = [1.0, 3.0, -3.0, -1.0, -1.0, 1.0, 3.0, 1.0, -1.0, 3.0]
>>> awgn(x).round(2)
array([ 1.26, 2.9 , -3.08, -1.17, -0.86, 0.64, 3.28, 0.88, -0.95, 2.96])
noise_power: float
property
The noise power $N$.
capacity
Returns the channel capacity $C$. It is given by $C = \frac{1}{2}\log_2(1 + \snr)$, in bits per dimension.
Examples:
>>> awgn = komm.AWGNChannel(signal_power=1.0, snr=63.0)
>>> awgn.capacity()
np.float64(3.0)