***166

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.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

If you liked this post, you may leave a comment below, or subscribe to the RSS feed.

You may also find these posts relevant...
  • BER for BPSK in OFDM with Rayleigh multipath channel
  • Articles
  • Trying out PAPR reduction for OFDM by multiplication with j
  • Download free e-book on error probability in AWGN
  • Peak to Average Power Ratio for OFDM
  • Comments

    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

    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

    @tariq: Well, I was unable to understand your concern. In the next line,
    ipMod = 2*ipBit-1; % BPSK modulation 0 –> -1, 1 –> +1
    the random binary data is converted to +1’s and -1’s respectively for binary 1 and binary 0.
    Agree? OR where you looking for something else?

    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

    @ravi kumar:
    As you can see, there is no difference in Eb/No vs BER plot provided for ‘BPSK in AWGN’ and ‘BPSK over OFDM in AWGN’.

    As I have stated prior, in AWGN there is no performance improvement/loss by doing OFDM modulation. However, in multipath channel, when using a properly designed OFDM, the equalization becomes simpler.

    A good book to read is OFDM Wireless LANs: A Theoretical and Practical Guide by Juha Heiskala , John Terry

    [...] BPSK BER with OFDM modulation [...]

    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

    @Lealem : I have not yet written any posts on Trellis coded modulation. I hope to do so in future (maybe within couple of months).

    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

    @Hussein: Thanks. I do not have the codes, but I would think that it will be reasonable to extend the available simulation models to 16QAM case.
    For 16-QAM in AWGN (without OFDM) you may look at the posts,
    URI: http://www.dsplog.com/2008/06/05/16qam-bit-error-gray-mapping/
    URI: http://www.dsplog.com/2007/12/09/symbol-error-rate-for-16-qam/

    For extending them to OFDM, you may use the following posts as reference:
    http://www.dsplog.com/2008/06/10/ofdm-bpsk-bit-error/
    http://www.dsplog.com/2008/08/26/ofdm-rayleigh-channel-ber-bpsk/

    Hope this helps.

    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

    @Hussien: Typically for channel estimation, we send a known sequence (called preamble). Using the knowledge of the known sequence and what we received, we can estimate the channel.

    For eg, in an OFDM system, the system model can be written as
    Y = HX + N where
    Y - is the received symbol on subcarrier k
    H - is the channel on subcarrier k
    X - is the transmitted symbol on subcarrier k
    N - is the noise on subcarrier k

    Since X is known, the estimate of H is,
    H^ = Y/X

    For synchronization, different aspects need to addressed:
    (a) Frequency synchronization - You can find an example of frequency offset estimation in 802.11a system at
    http://www.dsplog.com/2008/03/03/frequency-offset-estimation-using-80211a-short-preamble/
    (b) Time synchronization - Aligning the symbol boundary
    (c) Sampling clock offset tracking
    etc

    @Moayid: Thanks for the comment. However, may I suggest I would prefer to help you debug (than debugging the code myself).

    I think, to keep things simple, firsly you should try
    (a) with out adding noise
    (b) before moving to bit error rate, maybe its simpler to find symbol error rate.
    (c) Once you get the symbol error rate curve correct, then one may move to bit error rate.

    The following posts on 16QAM maybe helpful.
    URI: http://www.dsplog.com/2007/12/09/symbol-error-rate-for-16-qam/
    URI: http://www.dsplog.com/2008/06/05/16qam-bit-error-gray-mapping/

    Hope this helps.

    thank’s…can it made using another methode?except matlab.haw about C++.

    @victor: Yes, it can be. However, I do expect coding/debugging to be take more time in C++.

    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

    i am using ifft size 64,for 52 subcarriers

    @MUTHUKRISHNAN: I do not think that the following statement - “You have written the code assuming that the bits are coming at the rate of 20Mbps.” is true.

    If you see, in the simulation model, I have assumed that the (a) number of data subcarriers is 52
    (b) modulation is BPSK
    (c) there is no coding
    (d) fft size is 64
    (e) cyclic prefix size is 16 samples
    (f) symbol duration is 80 samples

    The key to control visualize the spectrum is on the assumption of sampling frequency of the fft. If the fft is operating at a frequency fs, then the symbol duration in the above system is 80/fs. The data rate is 52/(80/fs). If fs is assumed to be 20MHz, then the data rate is 13Mbps, Do you agree?

    You can use pwelch() command to plot the spectrum of an OFDM packet consisting of multiple OFDM symbols. The Matlab/Octave script in the following URI might be helpful.

    Understanding an OFDM transmission
    http://www.dsplog.com/2008/02/03/understanding-an-ofdm-transmission/

    Hope this helps.

    @mohammed: It depends on the system which we have - some specifications like 802.11a has coding/interleaving etc.

    In the simplest case, we can directly apply the data to the defined data subcarriers in the ifft. That is the approach which we used in the Matlab/Octave simulation model provided in this post.

    Hope this helps.

    Leave a comment

    (required)

    (required)