comnum.awgn_ebn0#

comnum.awgn_ebn0(x, ebn0_db, bits_per_symbol, rng, *, sps=1.0)#

Add noise for an E_b/N_0 of ebn0_db: σ² = P_x · sps / (b · E_b/N_0) for b bits per symbol at sps samples per symbol.

Parameters:
  • x (array_like) – the signal.

  • ebn0_db (float) – E_b/N_0 (dB).

  • bits_per_symbol (float) – information bits per symbol b (fractional for a coded or shaped signal).

  • rng (Rng) – the generator.

  • sps (float) – samples per symbol.

Returns:

the noisy signal (complex128).

Return type:

numpy.ndarray

Raises:

ValueError – for an input that is not an array of numbers of the expected shape.

Examples

>>> import comnum
>>> c = comnum.Constellation("qam", 4).normalized()
>>> b = comnum.bits(2 * 50_000, comnum.Rng(1))
>>> y = comnum.awgn_ebn0(c.map_bits(b), 6.0, 2, comnum.Rng(2))
>>> abs(comnum.ber(c.demap_bits(y), b) / comnum.theory_ber(4, 6.0) - 1) < 0.15
True