comnum.theory_ber_gray#

comnum.theory_ber_gray(m, ebn0_db, kind='qam', *, mq=None)#

Exact BER of Gray-mapped PAM, square QAM or rectangular QAM over AWGN (K. Cho and D. Yoon, IEEE Trans. Commun. 50(7), 2002, eqs. (9)–(22)).

Parameters:
  • m (int) – order of the PAM (kind="pam"), of the square QAM (kind="qam"), or the number of in-phase levels of a rectangular QAM (kind="qam" with mq).

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

  • kind (str) – "pam" or "qam".

  • mq (int | None) – the number of quadrature levels of a rectangular m × mq QAM.

Returns:

the bit error probability at every E_b/N_0.

Return type:

float | numpy.ndarray

Raises:

ValueError – for an invalid parameter or input (the message names it).

Examples

>>> import comnum
>>> round(comnum.theory_ber_gray(4, 0.0, "qam"), 6)
0.07865
>>> bool(comnum.theory_ber_gray(8, 12.0, "qam", mq=4) < comnum.theory_ber_gray(64, 12.0))
True