So, I was trying to plot BER (Bit Error Rate) vs. Eb/No (in dB) curve using Python. Here is what I get, enter image description here

Eb/N0 is in dB on the x-axis

But I know that this is not the correct graph.

Here is my code.

import matplotlib.pyplot as plt
import numpy as np
from scipy.special import erfc

def Q(x):
    return 0.5*erfc(x*(2**(-0.5)))

ebnodb = np.arange(0.1, 12, 0.01)
ebno = [10**(i*0.1) for i in ebnodb]
ebno = np.array(ebno)
y = Q(np.sqrt(2*ebno))

plt.plot(ebnodb, y)

Can someone figure out, what am I doing wrong?

  • $\begingroup$ it is because you are plotting the log of $y$. $\endgroup$ Apr 7, 2019 at 15:51

1 Answer 1


Usually, such figures show the error rate on a log scale, and $E_b/N_0$ in dB. So you would specify $E_b/N_0$ in dB, then convert it to a ratio, and use that value to evaluate the formula for the bit error rate (as you did). Then you plot the logarithm of the error rate as a function of $E_b/N_0$ in dB. So the main problem is that you used a linear scale for the BER instead of a logarithmic scale.

If you do things right, you'll end up with something like this:

enter image description here

  • $\begingroup$ Thank you very much @Matt. I got the right curve now. $\endgroup$ Apr 7, 2019 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.