%% Find Bit Error Rate of Binary Phase-Shift Keying
% The bit error rate (BER) of binary phase-shift keying (BPSK), assuming additive white Gaussian noise (AWGN), is
%  P_b = \frac{1}{2} \rm erfc\Biggl(\sqrt{\frac{E_b}{N_0}}\Biggr).
% Plot the BER for BPSK for values of E_b/N_0 from 0dB to 10dB.

EbN0_dB = 0:0.1:10;
EbN0 = 10.^(EbN0_dB/10);
BER = 1/2.*erfc(sqrt(EbN0));
semilogy(EbN0_dB,BER)
grid on
ylabel('BER')
xlabel('E_b/N_0 (dB)')
title('Bit Error Rate for Binary Phase-Shift Keying')

% Copyright 2015 The MathWorks, Inc.