BER vs SNR for PAM2

Many sources describe the BER vs Eb/N0 as

$$\mathrm{BER} = 0.5 \operatorname{erfc}\left(\sqrt{\frac{E_b}{N_0}}\right)$$

I can verify this relation with (modified from krishna@dsplog.com):

s = sign(randn(N,10000));
for ii = 1:length(Eb_N0_dB)
Eb_E0 = 10^(Eb_N0_dB(ii)/10);
y = s + randn(size(s)) * sqrt(2/Eb_B0);
ipHat = real(y)>0;
nErr(ii) = size(find([ip- ipHat]),2);
SNR = [ SNR 10*log10(0.5/var(noise)) ]; % see description
end
semilogy(Eb_N0_dB, nErr/length(s)); hold all;
semilogy(Eb_N0_dB, 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))));

However, I am interested in the actual SNR vs. BER, i.e. my signals have a certain level (e.g. 1, -1) and I add some noise described by $\sigma^2$. Many sources describe this relationship as (e.g. http://drum.lib.umd.edu/bitstream/handle/1903/3400/umi-umd-3213.pdf?sequence=1&isAllowed=y):

$$\mathrm{BER} = 0.5 \operatorname{erfc}\left( \frac{\sqrt{\mathrm{SNR}}}{2\sqrt{2}} \right)$$

However, when I plot

semilogy(SNR, nErr/length(s));
semilogy(SNR, 0.5*erfc(sqrt(10.^(SNR/10)))/(2*sqrt(2)));

the results do not match. I tried all possible SNR definitions I could imagine.

• You have $0.2$ as the coefficient of erfc in your displayed equation, but $0.5$ in your MATLAB code. Jul 6 '17 at 2:45
• You left the 2*sqrt(2) outside the parenth for erfc in the second version of the formula. Nov 29 '18 at 12:40

I think the reason is a different definition of erfc:

MATLAB uses

$$\operatorname{erfc}(x) = \frac{2}{\sqrt{\pi}} \int_x^\infty e^{-z^2} \, \operatorname{d}z$$

whereas the formula in the posting uses

$$\operatorname{erfc}(x) = \frac{1}{\sqrt{2\pi}} \int_x^\infty e^{-z^2} \, \operatorname{d}z$$

That is, the result matches if the definition is changed to

$$\mathrm{BER} = 0.5 \operatorname{erfc}\left( \frac{\sqrt{\mathrm{SNR}}}{\sqrt{2}} \right)$$

Another thing to be aware is that the definition of SNR as it is used in this formula is not $\operatorname{var}\{x\}/\sigma^2$ but $d_{\min}^2/\sigma^2$ where $d_{\min}^2$ is the shortest distance between values.