You are on page 1of 3

Steve Collins

Last 4 digits of ID#: 3678

EE250 Fall 2010

Binary communication with Additive White Gaussian Noise

The purpose of this project is to use the Monte Carlo method to produce random inputs into a
binary communication system with additive white Gaussian noise, and examine how the
theoretical bit error rate (BER) compares to the simulated BER.

The system model is shown below:

Transmitter Receiver

B: random 1/0 BPSK Mod S R BPSK B’

(2B-1) De-Mod
W

The input B is a random variable taking values of 0 or 1, produced using the Monte Carlo
method. B is then input into a modulator which uses the transformation S=2B-1, mapping 0 ->
-1 and 1-> 1. The bit is then sent to the receiver which receives the bit plus noise, R=S + W. This
received value is compared to a ‘decision’ value and the decision of whether the bit is a 0 or 1 is
made. An error occurs when B≠B’ and the BER is calculated by dividing the number of error bits
by the total number of bits sent.

The math behind the system is straightforward if you have taken EE 250 and are familiar with
how the Gaussian distribution shifts for each input B. The PDF for a Gaussian random variable

is:
2
−1 w−b
1 2
(
σ
)
pW(w)= e
√2 П σ 2
The value of b shifts the distribution horizontally. Assigning inputs s 0=0 and s1=1, the conditional
PDF’s of the received signal are:
2
−1 w +1
1 2
(
σ
)
pR/s0(R/s0)= e
√2 П σ 2
2
−1 w−1
1 2
(
σ
)
pR/s1(R/s1)= e
√2 П σ 2
The figure below shows graphically the conditional PDF with BPSK modulation.

From the figure you can see that the conditional distribution is a Gaussian distribution shifted
so that the input B is now the mean of the distribution. The total probability of an error,
assuming P[s0]=P[s1]= ½ , is:

P[error] = P[s0]P[error/s0] + P[s1]P[error/s1] = ½ *erfc¿)


No in the above equation is half of the variance. With this theory in hand, we need a MatLab
code that will generate this simulation. The code I used was from “The Art of Error Correcting
Code” [1] by Professor Robert Morelos. I changed the seed value to equal my school ID number
and the range from 10 dB to 4 dB. The MatLab code I used is shown below:
clear % Clear all variables in Matlab's workspace

seed = 003563678; % This allows to reproduce results


rand('state',seed)
randn('state',seed)

Nsim = 1000000; % Number of simulated bits


i = 1; % Index for array of results
P0 = 1/2; % Probability of bit = "0"

for EsNo=0:1:4 % Loop over energy-to-noise ratio


error = 0; % Error counter
for n = 1:Nsim
No = 10^(-EsNo/10);
sigma= sqrt(No/2); % Standard deviation of the AWGN
if (rand < P0), M = 0; % Generate a random bit
else M = 1; end
A = (-1)^M; % Mapping: "0" --> 1, "1" --> -1
Y = A + sigma*randn; % Add noise to transmitted symbol
if Y > 0, Mhat = 0; % Decision device
else Mhat = 1; end
if Mhat ~= M, error = error+1; end % Count errors, if any
end % Nsim

snr(i) = EsNo;
ber(i) = error/Nsim;
fprintf('%3.1f \t %10.7e\n', snr(i), ber(i));
i = i + 1;
end % EsNo

% Theoretical bir error probability of BPSK modulation


perr = Q(sqrt(2*10.^(snr/10)));

% Plotting commands
figure(1)
semilogy(snr,ber,'-*r')
hold on
semilogy(snr,perr,'-ob')
legend('Simulated','Theory');
title('Error performance of binary transimission over an AWGN channel');
xlabel('E_b/N_0 (dB)');
ylabel('Bit error rate');
grid on
hold off

Result: After playing around with the code and seeing how it affected the results, I can see that
as the number of simulations increase, the closer the simulated curve fits to the theoretical
curve. The curve shown below is for 1 million simulations.

You might also like