BPSK BER with OFDM modulation
Oflate, I am getting frequent requests for bit error rate simulations using OFDM (Orthogonal Frequency Division Multiplexing) modulation. In this post, we will discuss a simple OFDM transmitter and receiver, find the relation between Eb/No (Bit to Noise ratio) and Es/No (Signal to Noise ratio) and compute the bit error rate with BPSK.
OFDM modulation
Let us use the OFDM system loosely based on IEEE 802.11a specifications.
| Parameter | Value |
| FFT size. nFFT | 64 |
| Number of used subcarriers. nDSC | 52 |
| FFT Sampling frequency | 20MHz |
| Subcarrier spacing | 312.5kHz |
| Used subcarrier index | {-26 to -1, +1 to +26} |
| Cylcic prefix duration, Tcp | 0.8us |
| Data symbol duration, Td | 3.2us |
| Total Symbol duration, Ts | 4us |
You may refer to post Understanding an OFDM Transmission for getting a better understanding of the above mentioned parameters.
Cyclic prefix
In an OFDM transmission, we know that the transmission of cyclic prefix does not carry ‘extra’ information in Additive White Gaussian Noise channel. The signal energy is spread over time whereas the bit energy is spread over the time
i.e.
.
Simplifying,
Frequency spread
In OFDM transmission, all the available subcarriers from the DFT is not used for data transmission. Typically some subcarriers at the edge are left unused to ensure spectrum roll off. For the example scenario, out of the available bandwidth from -10MHz to +10MHz, only subcarriers from -8.1250MHz (-26/64*20MHz) to +8.1250MHz (+26/64*20MHz) are used.
This means that the signal energy is spread over a bandwidth of 16.250MHz, whereas noise is spread over bandwidth of 20MHz (-10MHz to +10MHz), i.e.
Simplifying,
.
Relation between Eb/No and Es/No in OFDM
Combining the above two aspects, the relation between symbol energy and the bit energy is as follows:
.
Expressing in decibels,
Simulation model
The attached Matlab/Octave simulation script performs the following:
(a) Generation of random binary sequence
(b) BPSK modulation i.e bit 0 represented as -1 and bit 1 represented as +1
(c) Assigning to multiple OFDM symbols where data subcarriers from -26 to -1 and +1 to +26 are used, adding cyclic prefix, concatenation of multiple symbols to form a long transmit sequence
(d) Adding White Gaussian Noise
(e) Grouping the received vector into multiple symbols, removing cyclic prefix, taking the desired subcarriers
(f) Demodulation and conversion to bits
(g) Counting the number of bit errors
Click here to download: Script for BER computation of BPSK using OFDM

Figure: Bit Error Rate plot for BPSK using OFDM modulation
Can observe that the simulated bit error rate is in good agreement with the theoretical bit error rate for BPSK modulation i.e.
.
![]()
Please click here to SUBSCRIBE to newsletter and download the FREE e-Book on probability of error in AWGN. Thanks for visiting! Happy learning.
If you liked this post, you may leave a comment below, or subscribe to the RSS feed.
You may also find these posts relevant...
Comments
dear , thank you very much
can i use not rand binary data in line 9 in the script
i mean i have data positive and negative and want to put it instead of binary random data ,
so please i want your help in solving this problem , because i try to put this data but failed to run .
regards
traiq
hi, KRISHNA
can u explain me the main difference of simulation results between the BPSK and BPSK with OFDM.What are the main factors that will effect the BER,and in which of the two two systems the BER performance is good,please help me as soon as possible because my project submission last date is 30th Sep., and what are the referances i have to read to understand this project.I hopefully waiting for your response,thank you
Hello! Krishna
Thank you! for ur help . But now i have got a problem when i wrote a matlab code to simulate the BER performance of a trellis coded OFDM ( OFDM with trellis coded Modulation) and i can’t get a proper result . Please try to help me by sending a Matlab code to simulate OFDM with TCM.
Thank you in advance
Lealem
Hi Krishna
thank you very much for Your simulation and theory prgram, really they are very useful. Do you have the matlab code for OFDM with 16-QAM in AWGN and Rayleigh Channels.
Best Regards
Hussien
Hi Krishna
One more thing: I’m looking for MATLAB code for channel estimation and synchronization for OFDM system.
Hi Krishna,
Thank you very much for your matlab script. I’m trying BER for OFDM using 16QAM, but I dont know what is Wrong in my code?! here is my code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BER for OFDM using 16QAM Modulation
clear all
close all;
clc;
M = 16; % number of QAM constellation points (4,16,64,256)
nFFT = 64; % fft size
nDSC = 52; % number of data subcarriers
Td = 64; % Data Symbol Duration
Tcp = 16; % cylic prefix Duration (GI=1/4)
nBitPerSym = 52; % number of bits per OFDM symbol (same as the number of subcarriers for BPSK)
nSym = 10^4; % number of symbols
k = log2(M); % bits per symbol
EbN0dB = [0:16]; % bit to noise ratio
EsN0dB = EbN0dB + 10*log10(nDSC/nFFT) + 10*log10(64/80)+ 10*log10(k); % converting to EsNo (EsN0 = EbN0*(nDSC/nFFT)*(Td/(Td+Tcp))
% OFDM
for ii = 1:length(EbN0dB)
% Transmitter
%data Generation
ipBit = randint(1,nBitPerSym*nSym,M);
%Data Modulation
ipMod = (1/sqrt(10))*qammod(ipBit,M); % 16QAM modulation
tx = ipMod;
% S/P
ipMod = reshape(ipMod,nBitPerSym,nSym).’; % grouping into multiple symbolsa
% Assigning modulated symbols to subcarriers from [-26 to -1, +1 to +26] (zeros padding)
xF = [zeros(nSym,6) ipMod(:,[1:nBitPerSym/2]) zeros(nSym,1) ipMod(:,[nBitPerSym/2+1:nBitPerSym]) zeros(nSym,5)] ;
% Taking IFFT, the term (nFFT/sqrt(nDSC)) is for normalizing the power of transmit symbol to 1
xt = (nFFT/sqrt(nDSC))*ifft(fftshift(xF.’)).’;
% Appending cylic prefix
xt = [xt(:,[49:64]) xt];
% P/S
xt = reshape(xt.’,1,nSym*80);
% Generation Gaussian noise of unit variance, 0 mean
nt = 1/sqrt(2)*[randn(1,nSym*80) + j*randn(1,nSym*80)];
% Adding noise, the term sqrt(80/64) is to account for the wasted energy due to cyclic prefix
yt = sqrt(80/64)*xt + 10^(-EsN0dB(ii)/20)*nt;
yts = sqrt(80/64)*xt + 10^(-EsN0dB(ii)/20)*nt;
% Receiver
% S/P
yt = reshape(yt.’,80,nSym).’;
% removing cyclic prefix
yt = yt(:,[17:80]);
% Taking FFT (converting to frequency domain)
yF = (sqrt(nDSC)/nFFT)*fftshift(fft(yt.’)).’;
% zero removal
yMod = yF(:,[6+[1:nBitPerSym/2] 7+[nBitPerSym/2+1:nBitPerSym] ]);
rx = reshape(yMod,1,520000);
% 16QAM Demodulation
ipBitHat = qamdemod(yMod*sqrt(10),M); % rxData =qamdemod(rxDataMod*sqrt(10),M);
% P/S
ipBitHat = reshape(ipBitHat.’,nBitPerSym*nSym,1).’;
% counting the errors
nErr(ii) = size(find(ipBit - ipBitHat),2);
end
simBer = nErr/(nSym*nBitPerSym);
theoryBer = (1/k)*3/2*erfc(sqrt(k*0.1*(10.^(EbN0dB/10))));
figure (1)
semilogy(EbN0dB,theoryBer,’ms-’,'LineWidth’,2,’MarkerSize’,5);
hold on
semilogy(EbN0dB,simBer,’bx-’,'LineWidth’,2,’MarkerSize’,5);
axis([0 16 10^-5 1]);
grid on
legend(’theory’, ’simulation’);
xlabel(’Eb/No, dB’)
ylabel(’Bit Error Rate’)
title(’Bit error probability curve for 16QAM using OFDM’)
hold off
%####################
Regards
Moayid
Hi,
I saw your code for OFDM transmitter. You have written the code assuming that the bits are coming at the rate of 20Mbps. Is there a way to write a MATLAB script that will simulate a random bit generator at 20MHz using RAND function or should we only go to simulink for that? I would like to see the spectrum of the OFDM symbols for an random input of 20MHZ. though we can plot the spectrum by taking the x-axis as Fs*(-N/2:1:N/2)/N, it would only be to visulaise the plot.
Can you give me a hint on that?
Thank you.
Bye.
hi krishna
i am trying to simulate ofdm with bpsk.i was able to get the +1 -1 signs.what do i need to do before applying this out put to IFFT.
thanks for your help before hand




























Hello! Kirishna ur matlab script is very help full to simulate an OFDM over AWGN channel using BPSK and also other modulation scheme.Can u forward me a matlab script that can be used to simulate performance of BPSK modulated OFDM with a combination of TCM(Trellis coded Modulation)over a fading channel.
Hope fully u will