Professional Documents
Culture Documents
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.
Transmitter Receiver
(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:
snr(i) = EsNo;
ber(i) = error/Nsim;
fprintf('%3.1f \t %10.7e\n', snr(i), ber(i));
i = i + 1;
end % EsNo
% 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.