1 Star2 Stars3 Stars4 Stars5 Stars (25 votes, average: 4.92 out of 5)
Print Print

Understanding an OFDM transmission

by Krishna Sankar on February 3, 2008

Let us try to understand simulation of a typical Orthogonal Frequency Division Multiplexing (OFDM) transmission defined per IEEE 802.11a specification.

Orthogonal pulses
In a previous post (here ), we have understood that the minimum frequency separation for two sinusoidals with arbitrary phases to be orthogonal is , where is the symbol period.

In Orthogonal Frequency Division Multiplexing, multiple sinusoidals with frequency separation is used. The sinusoidals used in OFDM can be defined as (Refer Sec6.4.2 in [DIG-COMM-BARRY-LEE-MESSERSCHMITT]:

, where

correspond to the frequency of the sinusoidal and

is a rectangular window over .

Using of inverse Fourier Transform

We now have understood that OFDM uses multiple sinusoidals having frequency separation where each sinusoidal gets modulated by independent information. The information is multiplied by the corresponding carrier and the sum of such modulated sinusoidals form the transmit signals. Mathematically, the transmit signal is,

The interpretation of the above equation is as follows:
(a) Each information signal multiplies the sinusoidal having frequency of .
(b) Sum of all such modulated sinusoidals are added and the resultant signal is sent out as .

Update: 29th May 2008

(thanks to the comment by Mr. Mork)

The sampled version of the above equation is,

It is reasonable to understand that above operation corresponds to an inverse Discrete Fourier Transform (IDFT) operation.

Understanding of an OFDM transmission specified per IEEE 802.11a [80211A]

From the Table 79 in [80211A], the symbol duration .
This implies that the used subcarriers are and so on.
The available bandwidth of 20MHz is split into 64 subcarriers. Out of the available 64 subcarriers having indices , the number of used subcarriers is 52. The used subcarriers are having indices from are used for transmitting information sequence to .

To understand in detail the correspondence between the subcarrier index and frequency, one may refer to a previous post (here).

Once the bits in each symbol are assigned to appropriate IDFT inputs (Ref. Figure 109 in [80211A]), the IDFT operation is performed to obtained the time domain signal.

For each symbol, some samples from the end are appended to the beginning of the symbol (referred to as cyclic prefix insertion). We may discuss the pros/cons of cyclic prefix in a future post.

Simulation Model
A simple Octave script where a BPSK modulated signal is transmitted on the 52 used subcarriers, may be used for understanding generation of an OFDM signal. The script is loosely based on 802.11a specification.
Click here to download.

spectrum of an OFDM transmission
Figure: Spectrum of an OFDM transmission (based on 802.11a specification)


[DIG-COMM-BARRY-LEE-MESSERSCHMITT] Digital Communication: Third Edition, by John R. Barry, Edward A. Lee, David G. Messerschmitt

[802.11A] Wireless LAN Medium Access Control (MAC) and Physical (PHY) Layer specifications – High speed physical layer in 5GHz band

Hope this helps.

D id you like this article? Make sure that you do not miss a new article by subscribing to RSS feed OR subscribing to e-mail newsletter. Note: Subscribing via e-mail entitles you to download the free e-Book on BER of BPSK/QPSK/16QAM/16PSK in AWGN.

nibedita January 13, 2015 at 5:20 pm

Hello Sir,

While adding noise
yt = sqrt(80/64)*xt + 10^(-EsN0dB(ii)/20)*nt;
why it is divide by 20 and not 10. where
EsN0dB = EbN0dB + 10*log10(nDSC/nFFT) + 10*log10(64/80);
please answer.

Samsung Soundbar With Subwoofer January 9, 2015 at 11:54 am

Awesome blog! Do you have any tips for aspiring writers? I’m planning to start my own site soon but I’m a little lost on everything.
Would you recommend starting with a free platform like Wordpress or go for a paid option? There are
so many choices out there that I’m totally overwhelmed ..
Any tips? Thanks!

Mayur November 24, 2014 at 4:16 am

I need a theoretical proof of representing an OFDM signal.

Bharathi October 25, 2014 at 12:55 pm

hello.. need help abt filters used in OFDM transmission system.. doing a project.. using 64fft, 14MHZ Carrier.. at the receiver side, we are not getting the exact samples at receiver side which we are transmitting. is there any relation between tx filter specifications and rx filter specifications to retrieve the exact samples. that means interpolation factor & decimation factor or filter coefficients or type of filters & its efficiency??

parameshwar October 21, 2014 at 5:43 pm

hello sir,i have doubt on generating OFDM.how we can mapping using QPSK for length n=128,help me in No.of sub carriers.

Max October 20, 2014 at 8:18 am

Good day! This post could not be written any better!
Reading through this post reminds me of my previous room mate!

He always kept chatting about this. I will forward this post to him.
Fairly certain he will have a good read. Thank you
for sharing!

http://hosei-im.jp/yahagi/userinfo.php?uid=90513 September 29, 2014 at 2:20 am

I know this if off topic but I’m looking into starting my own blog and was curious what all is needed to get setup?

I’m assuming having a blog like yours would cost a pretty
penny? I’m not very web smart so I’m not 100% certain.
Any suggestions or advice would be greatly appreciated. Thank you

JOSE September 28, 2014 at 3:15 pm

how to generate ofdm overlapping spectrum after fft at the receiver

chiju June 23, 2014 at 11:22 pm

hello Krishna, please can you help me with a code to generate OFDM baseband signal for LTE-A? And please what changes do i need to make to the code you gave to find the signal in time domain? Thanks.

Xt_Blog June 10, 2014 at 5:37 am

You are so awesome! I don’t think I’ve read anything
like this before. So good to discover somebody with original thoughts on this topic.
Really.. thank you for starting this up. This website is one thing
that is needed on the web, someone with a little originality!

gagan June 6, 2014 at 11:05 pm

can we use walsh hadamard transform (fwht) and inverse walsh hadamard transform (ifwht) instead of using “fft” and “ifft”

carloman June 3, 2014 at 4:43 pm

I am interested in understanding how to create the baseband I & Q signals which go to the quad modulator.
It seems to me that OFDM at the carrier has dual independent sidebands.
Using a QM with quadrature baseband I & Q will create SSB (phasing method), in which one of the sidebands is cancelled out. I wish to avoid this.

What is the complex form or expression for the baseband I & Q signals which will be multiplied by cos & sin at carrier freq, and then added to create the OFDM signal at carrier.

Also, does it matter if they are added or subtracted ? I think not ?
Thanks for any help and for your comprehensive website.

sailor May 28, 2014 at 2:15 pm

Hi krishna, can you explain how ifft is able to transform series of modulated symbol(-1/+1) to be placed in different sub carrier spaced by 1/T. As i understood ifft transforms frequency domain representation of a signal to time domain.

krishna April 9, 2014 at 10:10 am

hello Krishna sankar;
how to generate the code if frequency selective channel is given for OFDM and below is the frequency selective channel
% —————————————–channel
L = 7;
ci = randn(1,L);
cq = randn(1,L);
c = ci + 1i*cq;
% c = ones(1,L);
S = zeros(size(cext_data));
St = cext_data*(c(1));
for k = 2:L
S = cext_data*(c(k));
St(k+1:end) = St(k+1:end) + S(1:end-k);
% ————————————————
cext_data = St;
for snr=0:1:25


please do reply fast Krishna sankar

krishna April 4, 2014 at 6:56 pm

hello Krishna sankar;
how to generate the code if frequency selective channel is given for OFDM and below is the frequency selective channel
% —————————————–channel
L = 7;
ci = randn(1,L);
cq = randn(1,L);
c = ci + 1i*cq;
% c = ones(1,L);
S = zeros(size(cext_data));
St = cext_data*(c(1));
for k = 2:L
S = cext_data*(c(k));
St(k+1:end) = St(k+1:end) + S(1:end-k);
% ————————————————
cext_data = St;
for snr=0:1:25


please do reply fast Krishna sankar

kalyani July 20, 2013 at 7:40 am

how QAM and mapping is used in OFDM

Krishna Sankar July 22, 2013 at 3:54 am

@kalyani: each qam constellation is mapped onto a subcarrier

shamseer March 12, 2013 at 12:35 pm

Hi sir,
Why we are using only 52 out of 64?

Krishna Sankar March 13, 2013 at 5:28 am

@shamseer: The subcarriers on the edges are kept unused to allow for a reasonable transition band at channel boundaries. Further, the subcarrier at dc is also not used.

Arunpradhap Natarajan March 8, 2013 at 10:41 am

Dear Krishnan anna,

In OFDM multicarrier modulation why we are modulating with sine and cosine signal why can’t we modulate with either sine or cosine signal only

with regards
Arunpradhap Natarajan

Krishna Sankar March 13, 2013 at 6:12 am

@Arunpradhap Natarajan: We are sending information on complex sinusoidal which has only one sided frequency component.

Arunpradhap Natarajan March 31, 2013 at 7:13 pm

Dear shankar anna,

OFDM complex modualtion is Equal to the phasing method of SSB modulation am i correct.Then i want to how it happens in digital mode
could you explain me in detail

with regards

Arunpradhap Natarajan

Krishna Sankar April 1, 2013 at 7:28 am

@Arunpradhap Natarajan: Yes, you are right. Maybe the post on negative frequency will be of additional help.

Preetha February 15, 2013 at 1:19 pm

hi sir,
i’m doing project in wireless communication….our project tittle is mitigation of impulsive interference in ofdm system…in our base paper NEYMAN PEARSON testing is used to detect interference….any other advanced testing is available to mitigate te interference….ana also expln tis qstn
Plz explain GLRT?
why we adding pilot in ofdm tx?
wat is cyclic prefix?

Krishna Sankar February 21, 2013 at 6:18 am

- sorry, do not know GLRT
- pilots are added to help the receiver track the residual phase/frequency errors
- cyclic prefix is added as a buffer between two symbols to prevent inter symbol inteference

bijoy December 12, 2012 at 10:53 am

Hi krishna,

Few doubts

a) How is the nBitPerSymbol = 52 is decided ?

b) In the code you are using BPSK modulation, so each subcarrier carries 1-bit information, is this understanding correct ?
c) if we are using QPSK , each subcarrier carries 4-bits of information, am I right ?

d) does 802.11a specifies which modulation to be used ?

Could you please answer these if possible


Krishna Sankar December 13, 2012 at 4:55 am

@bijoy: Replies/
a/ The number 52 is decided by the specification. For 802.11a/g the number of used subcarriers was 52, when 802.11n came it was slightly increased to 56 and so on…
b/ Yes, for BPSK, each subcarrier carries one bit of information.
c/ For QPSK each subcarrier carries 2 bits of information.
d/ Yes. The modulation and coding rate is defined in the specification. Starting from BPSK, rate 1/2 (for 6Mbps), it goes all the way to 64QAM rate 3/4 (for 54Mbps).

Akshaya December 8, 2012 at 1:15 pm

Hi, I read your article and I have a doubt. You have given the set of subcarriers when we implement IFFT in TX and FFT in RX… Will this set of subcarriers change if we implement FFT in TX and IFFT in RX?

Krishna Sankar December 12, 2012 at 5:29 am

@akshaya: swapping to fft in tx and ifft in rx does not change the subcarrier frequency – however it does affect the bin where the modulation information goes. for eg, the information which was going on subcarrier bin +10 will go to -10 and so on…

achuse December 6, 2012 at 11:09 pm

dear sir,
If DPSK is used other than PSK what is the advantage in terms of reference carriers (preamble) ?

Krishna Sankar December 8, 2012 at 3:56 am

@achuse: Well, since we are interested in having only a known sequence in the transmitter – am not sure that DPSK will bring in advantages over PSK. What do you think?

achuse December 8, 2012 at 9:54 am

if DPSK is used, then the receiver do not need the reference to decode the data since the phase is compared with the previous symbol which is just before the current symbol. so if some phase change had occured and it is evenly affecting all the symbols, then we do not want to cancel the effect since we are taking the difference between the pahses to identify the data ? that means no need of correction?

Krishna Sankar December 12, 2012 at 5:45 am

@achuse: Hmm.. but for preamble, the case for DPSK does not exist, right?

achuse December 6, 2012 at 11:04 pm

dear sir,
suppose I have 104 datas are to be sent in 52 subcarriers by BPSK. when iam plotting the frequency response after IDFT(before adding cyclic prefix) i can see positive and negative peaked subcarriers for 1 and -1 respectively. ie at the position of each carrier there will be EITHER negative or positive peak and it can be seen clearly. but how did it happen? ie when i send the second symbol (ie next 52 datas) which are different from the first symbol, is the amplitude at each frequency should be the mix of the both (first 52 data and second 52 data)?

Krishna Sankar December 8, 2012 at 3:58 am

@achuse: When you find the frequency response, you are practically undoing the effect of IDFT and getting back the source I/Q symbols which you used.

achuse December 8, 2012 at 9:47 am

Thank you sir,
ie ok sir, so what we obtain is the 2nd set of 52 datas? it has nothing to do with first set of 52 datas?

Krishna Sankar December 12, 2012 at 5:32 am

@achuse: each ofdm symbol is typically independent and does not have any relation with the previous symbol.

achuse December 6, 2012 at 10:46 pm

Why does the carriers in the middle range DFT points not used? In other specifications also only few DFT points are used. what may be the reason? can it be linked with frequency offset or windowing? can you please explain how timing offset can be synchronized? also can you explain why PSD decreases with increasing sampling frequency?

Krishna Sankar December 8, 2012 at 4:04 am

@achuse: My replies:
1. The middle range DFT points corresponds to the edges in the frequency band. Typically, those subcarriers are left unused to allow for slow rolloff of the filter transition band.
2. Pilots present in each symbol is used to synchronize for timing offset. Typically, timing offset results in a linear phase growth in frequency domain, and this linear phase is used to synchronize. WHen the timing growth exceeds more than a sample duration, then a sample skip/repeat need to be used.
3. I think that is a notional concept – PSD is represented in dBm/Hz (or /MHz etc). When the sampling frequency changes, the resolution of each subcarrier is fs/nfft, and the PSD is scaled accordingly.

Hope this helps.

Rahim November 7, 2012 at 3:06 pm

i would like to get a matlab code for a 1 transmitter and n number of recievers, where the transmitter is transmitting a qpsk ofdm signal with 64ifft and the n receivers should receive it with 64 fft.. the SNRs are 10 db and -5db in two cases.. it is also said that that qpsk ofdm signal is transmitted in between a band of 0.25 to 0.75 (normalized frequency)

Krishna Sankar November 18, 2012 at 7:13 am
chithra October 31, 2012 at 8:11 am


In OFDM, why the center subcarrier (subcarrier 0) is inactive?? Can you please shed some light on this?

Thanks in Advance!

Krishna Sankar November 2, 2012 at 7:02 am

@chithra: The 0′s the subcarrier tries to send information on the DC signal. Typical transmitters and receivers will have additional leakage on the dc level OR ac coupling thereby increasing the chances of error in the demodulation. Hence dc is not used.

abhisha October 16, 2012 at 9:47 pm

I have been trying to simulate ofdm with double differential modulation to avoid the effects of carrier frequency offsets.I used function ifft directly for finding IFFT.could you please tell me how to introduce a carrier frequency offset.I tried it by multiplying the transmitted signal with exp(1i*2*pi*frequency offset*t),but it was not working

Krishna Sankar October 17, 2012 at 6:47 am

@abhisha: multiply with exp(j*2*pi*fd*t), where fd is the carrier frequency offset and t is the sampling time.
The post on carrier frequency offset with ofdm has an example :

swapnil September 24, 2012 at 11:50 am

Please suggest me recent research topic in ofdm.
Do you have information about OFDM papr reduction by Shifting Null Subcarriers?

Krishna Sankar September 26, 2012 at 5:31 am

@swapnil: I have not tried modeling the papr reduction by playing with null subcarriers

Sumit August 10, 2012 at 7:24 pm

Suppose I want to suppress some of the sub-carriers, the intuitive way is to multiply it with 0 or use some notch filter. I tried the code which you have given but couldn’t find some way to multiply the corresponding subcarrier argument with zero. Can you throw some light about where I need to modify in the code.

Krishna Sankar August 11, 2012 at 6:37 am

@Sumit: The columns of the variable ipMod corresponds to subcarriers. You can try making all the elements of one of the column zero.

Sumit September 26, 2012 at 6:45 am

Thanks.. it worked :)

pallavi August 2, 2012 at 3:19 pm

I would like to clarify with the fact that, when we talk of ofdm does the orthogonality simply means the carriers are orthogonal? if so then how will it differ from a simple fdm at the implementation level of any receiver?

Krishna Sankar August 3, 2012 at 6:15 am

@pallavi: The key is that carriers which are very close to each other are still orthogonal. A classical FDM uses frequency separation to achieve near orthogonality.

Shoaib Amin August 8, 2012 at 5:33 pm

Hello Krishna,

Can you please also explain something for WCDMA signals?

How to generate them in matlab


Krishna Sankar August 9, 2012 at 6:13 am

@Shoaid: Will do

Hasan June 19, 2012 at 7:27 pm

Hi Krisna,
From the reading I understand that out of 64 sub-carrier, 52 is used for data transmission. But from the code

ipMod = [ipMod zeros(1,nBitPerSymbol*nSymbol-nBit)];
ipMod = reshape(ipMod,nSymbol,nBitPerSymbol);

since you inserted zeros, each row of ipMod have less than 52 bpsk symbols (-1 & 1) except the first row. Is this OK ?

Please help me.

Krishna Sankar June 26, 2012 at 6:13 am

@Hasan: Each row of the variable ipMod has 52 subcarriers having +/-1 values. Then 12 zeros are inserted to make it a 64 element vector.

Arun Malik June 13, 2012 at 3:47 pm

Hi K. Sankar,

I saw all your post. very nice all of them. my question is this “can you specified for applicability of all your post in game-theoretic aspect”, please try to explain one post regarding power allocation in physical layer using game-theory.




Krishna Sankar June 26, 2012 at 5:50 am

@Arun: Hmm… game theory…i ‘ve not really thought about this topic. will add this as one of the to do’s

eshan June 8, 2012 at 12:35 pm

sir help me out in my thesis please guide me to develop my thesis my dates are near i am working on OFDM system PAPR reduction using Amplitude clipping my base paper is
Clipping Based PAPR Reduction Method for LTE
OFDMA Systems by M.M. Rana published in Ijecs it is also available in google also,Please sir help me

Krishna Sankar June 11, 2012 at 5:09 am

@eshan: good luck

harsha May 10, 2012 at 11:35 am

Hi Krishna,
I want to know that whether ak is in frequency domain. if so do we convert them in to frequency domain before feeding into IFFT.

Krishna Sankar May 15, 2012 at 5:42 am

@harsha: yes, ak is in frequency domain

harsha June 19, 2012 at 3:05 pm

Hi Krishna,
So how do we make sure that ak is in frequency domain. Do we apply any type transformation techniques before feeding in to OFDM modulator and after modulating the bits (either by QAM or QPSK).

Krishna Sankar June 26, 2012 at 6:10 am

@harsha: consider that ak’s are going to change the amplitude (and phase of) sinusoidal waves.

satya April 11, 2012 at 9:31 pm

what is the use of upconverter in the transmission of OFDM

Krishna Sankar April 12, 2012 at 5:16 am

@satya: to convert the basedband signals to passband

Dinu March 27, 2012 at 4:55 am

Hi Krishna,

Thanks very much for your matlab codes. They are really useful for wireless researches.

I am implementing a carrier recovery system and symbol recovery system for a wireless system which uses frequency domain equalization. I tried to find some matlab codes on carrier recovery, but no matlab codes are available.

Could please help me to find a m file code on carrier recovery?

Thanks in advance.

Krishna Sankar March 29, 2012 at 5:32 am

@Dinu: The carrier recovery in OFDM with periodic preamble sequence is discussed in

Burhan March 15, 2012 at 9:04 am

Your codes are really useful Thanks for your helping.
Have you done any work IDMA-OFDMA ? If yes, can you send me the codes.

Thank you.

Krishna Sankar March 18, 2012 at 11:33 am

@Burhan: Sorry nothing yet posted on IDMA-OFDMA

Deepraj March 6, 2012 at 9:53 am

@krishna Do you have matlab code for OFDM transmitter and receiver using frequency selective fading channel.

Krishna Sankar March 12, 2012 at 4:57 am
saeed mohammad March 5, 2012 at 2:45 am

i need help to do ofdm simualtion for lte system downlink shared channel
can you write an article a bout that
it’s very important for me

Krishna Sankar March 5, 2012 at 5:34 am

@saeed: I have not spend time on the LTE spec. Will do so…

saeed mohammad March 5, 2012 at 3:57 pm

but it’s somehow i cant understand specs to be simulated
and have a lot of questions but I’m working and did my effort
really your blog is very very important and very useful keep going
appreciate your hard work
thank you

rajsh March 2, 2012 at 3:45 pm

IN th abovce spectra 0 to 10 Mhz will cover all 52 subcarrier?
if am doing somthing like
ipMod (:,1:10)=0;

(after BPSK mod and reshape ),band is getting removed from negative frequecy portion only..
why it so?

Krishna Sankar March 5, 2012 at 5:38 am

@rajsh: Hmm… if the sampling frequency is 20MHz and the fftsize is 64, then the fft indices from [-32 to 31] correspond to [-10MHz to 10MHz).

Michael February 6, 2012 at 8:06 pm

Hi Krishna,
i have a question about the pwelch() function ,in ur code,like this:
fsMHz = 20;
[Pxx,W] = pwelch(st,[],[],4096,20);
xlabel(‘frequency, MHz’)
ylabel(‘power spectral density’)
title(‘Transmit spectrum OFDM (based on 802.11a)’);
the fifth parameter ’20′,i know it is the rate of sampling.But,our rate is 20 000 000,not that 20.

so ,is there something i ignore or some logical in that expression,why do you put ’20 ‘ in that place instead of 20000000?

Krishna Sankar February 10, 2012 at 5:54 am

@Michael: Well, the sampling frequency is a notional in matlab. So, if its 20Hz it means we can ‘see’ frequencies from [-10Hz to +10Hz); and if it is 20MHz the range is from [-10MHz to +10MHz).


Invizible soul November 13, 2012 at 10:23 pm

Changing 20MHz to 20Hz will change the level of the PSD estimate given by pwelch() function. For 20Hz you have a PSD around -30dB but with 20MHz you have a PSD of -90dB. And it comes from the scaling by f_sampling in pwelch(). You can check it by changing the sampling frequency.

Krishna Sankar November 18, 2012 at 7:04 am

@Invizible soul: Yes, thanks.

Jo January 19, 2012 at 2:22 am

Hi Krishna,

Any thoughts on reason for the OFDM spectrum not to be rectangular? I am simulating real, unipolar ofdm signal, but the psd estimate gives me half of raised-cosine filter like shape. I am intrigued. Please can you email me back if you do reply. Many Thanks.

Krishna Sankar January 23, 2012 at 5:39 am

@Jo: Well, unless you are doing some filtering, it should be close to rectangular…

MFS January 9, 2012 at 10:03 am

@Krishna: can you send me a copy of probability of error book. thanks

Krishna Sankar January 14, 2012 at 6:54 am

@MFS: emailed you the instructions

MFS January 15, 2012 at 1:28 pm

@Krishna: thanks, received

Toms January 4, 2012 at 9:56 pm

Hi Krishna

I am doing a project on Dynamic Bandwidth allocation in OFDMA transmission.Do you have any MATLAB codes for fundamental bandwidth allocation for GPON or in OFDMA, as I am new to the matlab any information or codes on this area will be helpful to me. Thanks a lot….

Krishna Sankar January 5, 2012 at 5:10 am

@Toms: Sorry, I do not have any code handy

golak behera December 24, 2011 at 12:23 am

its really a good article.thanks..

MFS December 20, 2011 at 3:54 pm

Hi Krishna,
do you have a matlab code regarding how to create an orthogonal pulse like Hermite pulse and the demodulation of this these pulses?

Krishna Sankar January 3, 2012 at 4:48 am

@MFS: What is Hermite pulse?

MFS January 5, 2012 at 8:13 am

@Krishna: Hermite pulse is an orthogonal pulses created from a modification of the Hermite polynomials (http://en.wikipedia.org/wiki/Hermite_polynomials) and it is used in digital communication in a fashion like OFDM.

Krishna Sankar January 6, 2012 at 6:16 am

@MFS: Thanks. I have quite a bit to learn out there.
Can you also point me to the UWB specification which uses this concept?

MFS January 6, 2012 at 9:23 am
Nanu Nadoda September 1, 2010 at 10:15 pm

hi krishna
i am new to matlab. can you send me basic script for transmitter and receiver using 64 qam modulation with addition and removal of cyclic prefix

Krishna Sankar September 5, 2010 at 6:26 am
Afm July 25, 2010 at 11:43 pm

hi krisna,

Could you do an article about understanding the MC-CDMA too? I know it is a little bit similar to OFDM and I have also read some paper on MC-CDMA. I just dont really get how to implement the coding (which is in frequency domain) and the message bit in Matlab. Do I need to multiply them together in the frequency domain or ifft the coding first and then multiply with message bit?


Krishna Sankar July 26, 2010 at 6:48 am

@Afm: Have not written about MC-CDMA, will write in future…

thieutuoc June 15, 2010 at 5:09 am

Hi krishna
In OFDM system is a mapping blocks, data blocks will be put back into the IFFT, so the question is which blocks any effect?
thank you!

Krishna Sankar June 21, 2010 at 5:43 am

@thieutuoc: Sorry, I do not follow your query.

thieutuoc June 26, 2010 at 8:09 am

Sorry Krishna, I mistake. It is digital modulation block (QAM).
Thanks Krishna!

thieutuoc June 14, 2010 at 8:55 pm

hi krishna,
OFDM system has a block of data Mapping is then brought through the block ifft data, so I want to know what to do for mass Mapping.

Krishna Sankar June 21, 2010 at 5:49 am

@thieutuoc: What is mass mapping? Are you referring to QAM mapping?

behzad June 12, 2010 at 1:13 pm

hi krishna
i want to know how to define separation frequency between the sub-carrier in ofdm.
it the way i have found with ifft command this frequency is 1 Hz.
thanks krishna

Krishna Sankar June 14, 2010 at 6:15 am

@behzad: Well, subcarrier spacing is controlled by the sampling clock and the number of points in the FFT. For examples, if the sampling clock is 20MHz and the FFT size is 64, the subcarrier spacing is 20MHz/64 = 312.5kHz

dungpt June 14, 2010 at 7:47 am

Can I understand the sampling clock is the sampling rate of DAC? For example, at 20MSa/s sampling rate, symbol period T=64*1/20(MSa/s)=3.2 (microsecond). Therefore, the subcarrier spacing is 1/T=312.5 kHz.

Krishna Sankar June 21, 2010 at 5:51 am

@dungpt: Your numbers are right. You can assume that the sampling period is the sampling period of the FFT. Sampling period of DAC need not be sampling period of iFFT. Typically, DAC can have 2x/3x oversampling compared to fft sampling rate.

tikio April 28, 2010 at 3:04 pm

i want to ask that what if i sample with a sampling rate of 15Mhz
and if i sample with a rate of 40 Mhz will there be any negative frequency components present in the signal .
secondly does the concept of complex discrete fourier transform has anything to do with the negative frequencies
or the concept that the transform magnitude of the real signal is composed of signal at the negative frequencies and the positive frequencies, has anything related to this notion

Krishna Sankar July 2, 2012 at 5:28 am

1) The 15MHz ‘real’ signal has both +ve and -ve frequencies.
recall : cos(wt) = ( e^(jwt) + e^(-jwt) )/2
2) fourier transform uses e^(jwt) as basis functions

vedika April 5, 2010 at 2:09 am

Hello Sir,
Thanks a lot for the reply,
Could u please guide me as to how a receiver is designed,I am not able to recover the samples.I am using 64QAM and I am mapping the data and dividing it into subblocks,as the definition of OFDM goes..
after the ifft,i tried to to do the fft but the samples are not getting recoverd,they get scaled..
please help me for the same.

Krishna Sankar April 5, 2010 at 4:26 am

@vedika: If the scaling factor is constant across all subcarriers, then it can be easily accounted for. Agree?

Chaitanya March 31, 2010 at 8:32 pm

Hi Krishna,
I had to include a Simulink model for clarification. So I’ve sent my doubt to your mail. Kindly check it out.

Krishna Sankar April 4, 2010 at 3:45 am

@Chaitanya: Answering in the comments will be faster than emails (am running a bit late on blog related email queries)

Chaitanya April 5, 2010 at 10:25 am

I will wait for your reply to the mail. Meanwhile, can you explain the need for training insertion and zero padding in OFDM? Also, the function of channel estimation and compensation in the receiver.
These were few of the blocks i encountered in the model.

Also, in he OFDM transmitter, the blocks were in this order

Bit generator —- RS encoder—- QPSK modulator —- Row Selector —- Matrix concatenation(first Vertical, then Horizontal) —- zero pad —- IFFT —- Cyclic prefix —- Training Insertion —- Parallel to Serial converter.

The vertical matrix concatenation block had 3 inputs(two from the row selector and the other is constant zero)
The horizontal matrix concatenation block had 2 inputs(one from the preceding vertical block and the other from a block denoted TR)
The TR block consisted of:
PN seq generator —– Unipolar to bipolar conv

The training insertion block consisted of:
Column selector —– Horizontal matrix concatenation

All this was there in the Simulink model i attached to your mail. So if u could give me the purpose of the various blocks when your time permits, it would be invaluable.

Krishna Sankar April 6, 2010 at 4:51 am

a) In frequency domain, we do not want to use subcarriers at the edge (and also at DC). Hence these subcarriers are nulled out.
b) In typical OFDM systems, the system model can be written as
Y = HX + N, where
Y – is the received symbol
H – is the channel
X – is the transmitted symbol
N – is the noise.
To accurately demodulate X, we need to undo the effect of channel prior to demodulation.
So Yhat = Y/H = X + N/H ~= X (if N is low) —> this is channel compensation

For estimating channel, we will send a symbol where X is known at the receiver.
Hhat = Y/X = H + N/X ~= H (if N is low) –> this is channel estimation

Chaitanya April 6, 2010 at 6:54 pm

Thanks for the explanation. The nulling out of subcarriers explains the zero padding block. But what about the training pulses inserted in the transmitter and separated at the receiver?

vedika March 29, 2010 at 2:02 pm

hello krishna
I simulated your code and got the process of it.now i am supposed to design even the receiver part.
I have corrupted the transmitted OFDM using AWGN function and this the following code that i used for receiver part after your code

Y= AWGN(st,SNR);

[Pyy,W] = pwelch(Y,[],[],4096,20);


rt = [];
for ii = 1:nSymbol

% assigning bits a1 to a52 to subcarriers [-26 to -1, 1 to 26]
for j=17:80
inputFFT(subcarrierIndex+nFFTSize/2+1) = Y(ii,j);

inputFFT = fftshift(inputFFT);
outputFFT = fft(inputFFT,nFFTSize);
rt = [rt outputFFT]


Would u please help further ?
1. i am not able to remove the cyclic prefix that was added,how to get it?
2. how willl recover the original generated samples?

Please do the needful..
Thanks a lot..

Krishna Sankar March 30, 2010 at 4:16 am

@vedika: My replies:
1/ For removing cyclic prefix, need to remove samples corresponding to the duration of the cyclic prefix
2/ Plz take a look at http://www.dsplog.com/2008/06/10/ofdm-bpsk-bit-error/

preppy March 16, 2010 at 8:59 pm

Hi Krishna
i’m currently making simulation to compare SISO and SISO OFDM using matlab. I’m using specification from 802.16d (fixed WiMAX) with 256 subcarriers (200 used subcarriers), with BPSK modulation and using AWGN channel(no fading applied). The idea is to plot these two conditions on SNR vs BER graph. I have the result from this simulation, showing that SISO OFDM have a lower SNR (which is better i think) than SISO in the same BER. What doubts me is how can OFDM make SISO have a better SNR, ’cause all i know about OFDM from reading several books are all about orthogonality and ISI issues. Can u relate SNR-BER issues with orthogonality-ISI issues? Is my simulation shows correct result or not? thanks in advance..
P.S.: i’m using same amount of bits, which is 200 SC x 48 data symbols/SC x 1 bit/symbol = 9600 bits, as for OFDM case, i’m using CP ratio 1/8 so it has 288 subcarriers total..hope this will complete the details..

Krishna Sankar March 28, 2010 at 2:30 pm

@preppy: There should not be any difference in SISO vs SISO OFDM performance in AWGN.

Filbert February 25, 2010 at 11:52 am

Hi Krishna,
In your psd figure above, most of the frequencies lie on -30 dB, if i want to normalize the psd, to be 0 dB, what is the normalization factor? Thank you

Krishna Sankar March 31, 2010 at 5:08 am

@Filbert: Multiply Pxx with 10^(30/10)

notrino February 12, 2010 at 7:19 pm

i must simulate this paper but i dont know some of blocks in block diagram,such as zero pad,cyclic prefix ,frame status conversion and i dont find these blocks in matlab simulink.plz help me,thanks

Krishna Sankar April 4, 2010 at 4:00 am

@notrino: Try to understand the functionality of each block, and then model it

vedika February 7, 2010 at 9:49 pm

hello krishna
I simulated your code and got the process of it.now i am supposed to design even the receiver part.
I have corrupted the transmitted OFDM using AWGN function and this the following code that i used for receiver part after your code

Y= AWGN(st,SNR);

[Pyy,W] = pwelch(Y,[],[],4096,20);


rt = [];
for ii = 1:nSymbol

% assigning bits a1 to a52 to subcarriers [-26 to -1, 1 to 26]
for j=17:80
inputFFT(subcarrierIndex+nFFTSize/2+1) = Y(ii,j);

inputFFT = fftshift(inputFFT);
outputFFT = fft(inputFFT,nFFTSize);
rt = [rt outputFFT]


Would u please help further ?
1. i am not able to remove the cyclic prefix that was added,how to get it?
2. how willl recover the original generated samples?

Please do the needful..
Thanks a lot..

Krishna Sankar April 4, 2010 at 4:15 am

@vedika: Try looking at the post on BER computation with OFDM http://www.dsplog.com/2008/06/10/ofdm-bpsk-bit-error/

Raghav December 27, 2009 at 11:38 am

Ok..sir thanks…!!! Well… i’m really trying to understand Discrete Fractional fourier Transform… and i’m doing a Project on OFDM..I think it will be a Big Achievement implementing OFDM with DFrft… Can u too Just take a look on that…and if possible Jss make me Understand its Algorithm..!!

mohan December 22, 2009 at 10:37 am

is there any particular reason behind “placing the pilot carriers at -21,-7, 7 and 21″. I mean spacing of 14 sub carriers? Can they be placed at any position other than these and if so, what can be the impact on performance etc?


Krishna Sankar December 23, 2009 at 5:53 am

@mohan: I do not think, there is any requirement that ‘have to be spaced 14 subcarriers apart’. But, in general its desirable to have them spread wide apart.
And as FYI. The pilots are used for estimating
a) constant phase shift across subcarriers – caused by residual frequency offset, phase noise
b) linear phase across subcarriers – caused by sampling clock frequency offset

mohan December 16, 2009 at 1:43 pm

I got the clariffication for the doubt i raised just now. The 6null carriers at on each side of the band are contributing the DC and 11 zeros.


Krishna Sankar December 23, 2009 at 5:23 am

@mohan: oh, k. good. i just replied anyways :)

mohan December 16, 2009 at 1:36 pm

Sir, thanks for providing very good articles on OFDM.

I have a doubt regarding the placement of [-26:-1] subcarriers at [38:63].

In the script for generating the OFDM tx symbols, it is given that
% shift subcarriers at indices [-26 to -1] to fft input indices [38 to 63]

What if these [-26:1] are mapped to [27:52] and then [52:63] are filled with zeros.

I understood the aliasing effect but the doubt is why are the -ve indexed carriers are mapped to [38:63] instead of [27:52]


Krishna Sankar December 23, 2009 at 5:22 am

@mohan: I did not fully understand the motivation behind your query, but to answer you:
the subcarriers mapped to [38 to 63] will get aliased to [-26 to -1]. If you try to map to [27 to 52], then
a) no aliasing on subcarriers mapped from [27 to 31]
b) aliasing on subcarriers mapped from [32 to 52] to [-32 to -12]

Also, please have a look at the post on negative frequency

Fahmi December 5, 2009 at 8:50 pm

Dear Sir,
I have an ambiguity concerning the guard interval;
my question is:
Why we chose the end of the transmitted symbol as guard interval and not the beginning of the symbol, for example?
And thank you in advance.

Krishna Sankar December 7, 2009 at 5:26 am

@Fahmi: Well, we would want to make the symbol + guard interval continuous transmission without any abrupt phase changes. One way to do this is to take the last xx samples and append to the front of the symbol.

angelo December 5, 2009 at 1:04 am

zf equalizer should be not a problem,it is just a division in freq.

i implemented LS estimator and MMSE estimator,
i would ask to krishna why for MMSE estimator i have to normalize di RECEIVED QAM Symbols by a factor (fftlenght/numofcarriers)


Krishna Sankar December 7, 2009 at 5:17 am

@angelo: I have discussed OFDM with ZF equalization in http://www.dsplog.com/2008/08/26/ofdm-rayleigh-channel-ber-bpsk/
If there is no interference, then using ZF equalization is optimal, we might not want to use MMSE. If you are using MMSE, then the scaling factor might have been present to precisely define the noise variance.

Rupesh Kumar December 3, 2009 at 2:05 pm

Hello Sir,

I am trying to implement ZF frequency equalizer in OFDM for performance analysis through matlab coding.

Please, help me…..if you give me the code then it will be better for me.

Krishna Sankar December 7, 2009 at 5:09 am
Raghav November 20, 2009 at 2:31 am

well sir…i am using… QPSK… which requires….0 to M-1 input values…and M is 4 here…can u throw more light on 2nd point u described..!!
And sir…i got one more problem….i have to implement OFDM…using..fractional fourier transform…
and i need…some matlab codes…of discrete fractional fourier transform..and IDFrFt too…!!
Can you help me with that sir..?

Krishna Sankar December 6, 2009 at 4:17 pm

@Raghav: Sorry, I have no posts on fractional Fourier transforms.

Raghav October 21, 2009 at 12:59 am

Hi….Guyz..m Implementing OFDM Transmitter using…ifft and i am doing so..by generating random nos. ranging 0 to 3…and i am using QPSK…and…64 pt ifft….but when i am finding its power spectral density its coming out to be a bit unexpected…help me..
clear all;
for j=1:48
fsMHz = 20;
[Pxx,W] = pwelch(st,[],[],4096,20);
xlabel(‘frequency, MHz’)
ylabel(‘power spectral density’)
title(‘Transmit spectrum OFDM (based on 802.11a)’);

Krishna Sankar October 27, 2009 at 5:24 am

@Raghav: Some comments:
1/ Using modulation values 0 to 3 might not be correct. You might want to use -3,-1, 1, 3 if you want 4PAM
2/ The subcarier loading where edge subcarriers and DC subcarriers are not used is missing.

Bhasker Gupta October 15, 2009 at 4:48 pm

hi krishna how are u
1, in this script you plotted ofdm spectrum after adding cyclic prefix to ifft output.
i think the iffft output will be the ofdm output is it so sir.
2, you use the function [Pxx, W]=pwelch(st,[],[],4096,20) to plot ofdm spectrum. but in any frequency spectrum it is always between frequency on x axis and magnitude (in dB) on y axis. but by using above function it is PSD on y axis . so does that has same meaning . actually but i did was firstly i take the fft of iffft output and then it taken its absolute value. then i tried to plot dB conversion of absolute value.but i am not getting accurate plot will you plz help me?

Krishna Sankar October 17, 2009 at 4:08 am

@Bhasker: My replies:
1/ Yes. The spectrum which we are concerned is that of the transmit waveform which goes on the air, and that includes the cyclic prefix.
2/ The variable Pxx is in linear. In the plot, I converted to log by 10log10(Pxx) and plotted. Using ifft for one symbol alone might not be a good idea, as it uses very small set of smaples. The pwelch() uses the whole vector and has algorithms to provide the ‘smoothed’ spectrum.

You can post your queries. Good luck.

zizi October 14, 2009 at 1:31 pm

Dir krishna,
I have 2 questions :
1-Where are the frequency samling and the duartion symbole mentioned in your code programme.
2-In BER OFDM-multipath simulation if i use the matlab commande ‘rayleigtchan’ ,the curve of BER to be constant, how to equalize the chanal in this cas.
please help me.
thank you.

Krishna Sankar October 15, 2009 at 5:33 am

@zizi: My replies:
1/ Please refer to my previous reply :)
2/ Divide by the channel in frequency domain.

khalil January 16, 2012 at 10:01 pm

Me too i don’t find the symbol duration or exactly bit duration.
Each symbol contains many bits that are transmitted with a bit duration.
I don’t find it in the code matlab

Krishna Sankar January 23, 2012 at 5:29 am

@khalil: The concept of time between samples is notional in Matlab. For eg, if we assume that
a) the time between the samples is 1/20MHz
b) number of samples in a symbol is 64,
then the symbol duration 64/20 = 3.2us

zizi October 12, 2009 at 9:53 pm

Dir krishna,
But in your codes matlab you haven’t use the frequency sampling and the duration of symbol (and duration of cyclic prefix) ?
please help me.
thank you.

Krishna Sankar October 13, 2009 at 5:03 am

@zizi: Hmm… I checked. The code assumed a time domain sampling frequency of 20MHz. The duration of the cyclic prefix is 16 samples (0.8us with 20MHz sampling).
Maybe checking out http://www.dsplog.com/2009/10/07/quiz-ieee-80211a-specifications/ might be also be helpful.

zizi October 8, 2009 at 12:36 pm

Dir krishna,
How do u calculate the sampling frequency and the duration of symbole (34)?
are there limitation for ifft size and number of carriers?
thank you for your helps.

Krishna Sankar October 12, 2009 at 5:27 am

@zizi: Sampling frequency, number of subcarriers etc are chosen based on the system requirements.

For example, in 802.11a specifications, we had a channel of bandwidth 20MHz. So we chose the FFT sampling frequency as 20MHz. Then we chose a 64 point FFT, which resulted in a subcarrier spacing of 312.5kHz (20MHz/64). Had we chosen a higher order FFT, we would have been able to have more subcarriers, but the subcarrier spacing will be narrow.

Some systems like WiMax uses 256/512pt FFT. Some others like DVB etc uses 1024 pt FFT. So, as I see the choices of FFT size, sampling clock etc are engineering choices based on the end design goal.

vedika September 15, 2009 at 10:50 am

I have 2 doubts..Please help me clear them..

In the script code that you have given–
inputiFFT(subcarrierIndex+nFFTSize/2+1) = ipMod(ii,:);

why have we used the above operation?
Also why do we need to do the below:

How the Cyclic prefix operation has been performed?in the code..Please explain..

thank you..

Krishna Sankar September 18, 2009 at 5:38 am

1. For each row ii, am assigning all columns of ipMod to the variable inputiFFT per the indexing subcarrierIndex+nFFTSize/2+1
2. For inserting cyclic prefix, we take the last 16 samples from the ifft output and pad it to the same variable again.
% adding cyclic prefix of 16 samples
outputiFFT_with_CP = [outputiFFT(49:64) outputiFFT];

vedika September 12, 2009 at 11:20 pm

hello krishna,
i wanted to know how exactly we do the shifting and why is it required..
Also after generating the random symbols,is it that we need to take ifft.. and but when do we modulate it with a carrier like the different carriers that have frequency in multiples for orthogonality..?
please clear my concepts..
thank you..

Krishna Sankar September 14, 2009 at 5:31 am

@vedika: The iFFT takes care of assigning each constellation symbol to different carriers that are orthogonal.

aredeq September 7, 2009 at 11:17 am

hi krishna.. can you help me in designing OFDM system with BPSK using MATLAB Simulink?

Krishna Sankar September 9, 2009 at 5:44 am

@aredeq: Sorry, I do not have Simulink

kalidoss.r August 18, 2009 at 7:12 pm

1. In the MATLAB script, how to assign the 52 bits to ifftshift variable size of 64 bits. It omits first 6-bits and last 6-bits,remaining bits are filled in the location.
2.In this script where we introduce orthogonality of the signals or how can we visualize the orthogonality.
3. In the program original data bits are 2500, after cyclic prefix total transmitted bits are 3920 instead of 2500. Nearley 56% of increasing data length, it may eat very large bandwidth….

My statements are correct or not….

Sorry for the continuous disturbance…..

Krishna Sankar August 19, 2009 at 5:51 am

@kalidoss: My replies:
1/ In fact using the term sub-carriers might be better. I omit subcarriers from [-32 to -27, 0, 27 to 31]
2/ Orthogonality is introduced because, exp(j*2*pi*k*t/T) are orthogonal. Please refer to the post on Inter Carrier Interference (ICI) in OFDM for a better explanation http://www.dsplog.com/2009/08/08/effect-of-ici-in-ofdm/.
3/ Not correct. Adding cyclic prefix, increases the duration of the symbol on the air. However, this does not increase the bandwidth. Recall, if OFDM we are sending complex sinusoidals. Adding cyclic prefix, means we are sending the same sinusoidals for extra duration, and not sending additional sinusoidals.

kalidoss.r August 17, 2009 at 8:41 pm

In the MATLAB script whats the use of fftshift command,why do you perform in the program….

Krishna Sankar August 18, 2009 at 3:58 am

@kalidoss: The output of the N point FFT by default is from [0 to N-1]. However, the frequencies from [N/2 to N-1] gets infact aliased to [-N/2 to -(N-1)]. The fftshift function does the re-arrangement of the N point FFT to do reflect this aliasing.
octave:20> x = [1:16]
octave:21> fftshift(x) = [ 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 ]

Also, try reading the post on negative frequency.

r.kalidoss August 13, 2009 at 9:11 am

In OFDM all the information symbols are convert into parallel form, digital mapping and ifft operation performed.

The output of IFFT is very minimum amplitude in the form of 0.05+i0.253 and so on.Then how to modulate this very minimum amplitude with high carrier frequency. (like interms of MHz)…..



Krishna Sankar August 14, 2009 at 5:05 am

@kalidoss: In the example, the signal to be upconverted to ‘RF band’ is c. The upconversion operation is
out = Re{c * exp(j*2*pi*f_carrier*t)}

Nitya July 23, 2009 at 2:35 am

I am a graduate student, doing a project in water filling algorithm in OFDM. Can any one suggest some material which gives fundamental description of ‘Water filling algorithm’? In many papers, they just mentions it as ‘Applying Water filling algorithm..’ and I could not find a source which explains what it is.


Krishna Pillai July 24, 2009 at 4:21 am

@Nitya: I quickly recall that water filling algorithm stands for concentrating the transmit power at frequencies where channel is good. Though I have not looked into detail, I found that Chapters 8.5.1 and 8.5.2 in Digital Communication: Third Edition, by John R. Barry, Edward A. Lee, David G. Messerschmitt. discuss about water filling.
Good luck.

krishnakumar June 10, 2009 at 10:45 pm

sir, i am new to OFDM but i could not understand what is happening to signal after ifft in tranmsission. Whether the tranmission is in frequency domain or time domain. how the signal will look like in spectromter in air. after ifft how the modulation produces multiple frequency. pl explain. I am new to this field. thank you

Krishna Pillai June 11, 2009 at 5:00 am

@krishnakumar: The signal after ifft() is the sum of many complex sinewaves – e^{jwt} + e^{2jwt} + e^{3jwt} + …
The samples are in time domain. The spectrum plot is captured in this post itself.
Plz re-read this post. Hopefully, it should answer some of your queries.

salma July 24, 2009 at 12:42 am

plz, help me to understand why we need to those steps in our code
in script for generting OFDM transmit waveform (loosely based on
IEEE 802.11A specifications)

for ii = 1:nSymbol

inputiFFT = zeros(1,nFFTSize);

% assigning bits a1 to a52 to subcarriers [-26 to -1, 1 to 26]
inputiFFT(subcarrierIndex+nFFTSize/2+1) = ipMod(ii,:);

% shift subcarriers at indices [-26 to -1] to fft input indices [38 to 63]
inputiFFT = fftshift(inputiFFT);

outputiFFT = ifft(inputiFFT,nFFTSize);

% adding cyclic prefix of 16 samples
outputiFFT_with_CP = [outputiFFT(49:64) outputiFFT];

st = [st outputiFFT_with_CP];


I can not understand why we need to assign bits a1 to a52 to subcarriers [-26 to -1, 1 to 26]; and not enter our data points directly to ifft like writting

ipMod = [ipMod zeros(1,nBitPerSymbol*nSymbol-nBit)];
ipMod = reshape(ipMod,nFFTSize,length(ipMod )/nFFTSize);

then enters it directly to ifft????????????

Krishna Pillai July 24, 2009 at 4:53 am

@salma: Well, given a sampling frequency of fs and fft order N, we subcarriers defined from [-N/2 to N/2-1]*fs/N. To send information in subcarriers from [-N/2 to -1]*fs/N, we infact send them at [N/2 to N-1] amd due to aliasing, the information gets folded back to [-N/2 to -1]*fs/N.

I have discussed bit more on this topic @

Hope this helps.

This is a difficult, but important concept to understand in OFDM. Crossing this hurdle is an important step in understanding wireless communication in general and OFDM in particular.

engineer193 June 7, 2009 at 2:02 pm

Mr Krishna
Thanks for ur support I want to know that how can i use

hF=fft(ht,64,2); command in place of

hF = fftshift(fft(ht,64,2)); if there is no alternative then pls explain me about these commands

hF = fftshift(fft(ht,64,2));

Krishna Pillai June 7, 2009 at 3:19 pm

@engineer193: Did not quite follow your question. The fftshift() operator is used to order the output of the fft() such that the spectrum is show with DC at the center. Plz refer to the post on negative frequency for bit more details.

raj June 7, 2009 at 8:48 am

Dear Mr Krishna
Thanks for ur reply. I want to ask you that

1)if i am not using pilot bits, so is it possible that i can take 52 subcarriers for data bits transmission.

2)Why we use 20 MHz as sampling frequency what is the reason behind it.

3)I have used nSym = 64 while using 52 subcarriers for data transmission is that correct.

4)Can we use EbN0dB in place of EsN0dB in your code for BPSK OFDM in AWGN and Rayleigh Fadig channels.

Krishna Pillai June 7, 2009 at 2:41 pm

@raj: My replies:
1/ Yes, you may
2/ Well, sampling frequency of 20MHz was defined by the IEEE TGa standardization committee. In general, it depends on the available spectrum and the number of channel required etc
3/ Well, number of symbols and number of used subcarriers are two independent parameters, agree? OR was there a typo in your comment and you mean nFFT = 64 (instead of nSym = 64)? Even for the latter, your assumption is correct.
4/ For BPSK, Eb/N0 and Es/N0 are same. Agree?

Bijunair May 27, 2009 at 12:06 pm

Dear Krishna Pillai Sir,
Plz give ur email id.

Krishna Pillai May 31, 2009 at 8:31 pm

@Bijunair: You may find my details @ http://www.dsplog.com/contact-us/

raj May 25, 2009 at 5:38 am

Dear Mr Krishna
Regarding your matlab code for OFDM using BPSK over Rayleigh Fading Channels. I tried but i failed to understand how u calculated these parameters.

nFFT = 64; % fft size
nDSC = 52; % number of data subcarriers
nBitPerSym = 52; % number of bits per OFDM symbol (same as the number of subcarriers for BPSK)
nSym = 10^4; % number of symbols

As according to my coding BPSK in OFDM. i have used 256 bits to transmit over 256 symbols i.e. 1 bit/symbol. Using 256 point fft and IFFT. So pls advice me how can i setup my parameters.
Acc to my knowledge in BPSK one bit is transmitted in one symbol and then it is furthur transmitted on the subcarrier.Pls correct me if i am wrong.

Krishna Pillai May 31, 2009 at 8:14 pm

@raj: “Acc to my knowledge in BPSK one bit is transmitted in one symbol and then it is furthur transmitted on the subcarrier.Pls correct me if i am wrong.”
This is wrong. In OFDM, depending on the FFT size, there will be more than 1 subcarrier which is used. For eg, in 802.11a systems, we use 64pt FFT and use 52 subcarriers. If each subcarrier is BPSK modulated, then each symbol can carry 52 bits. Hope this helps.
Please refer to posts @ http://www.dsplog.com/tag/ofdm

haleh December 23, 2009 at 3:41 pm

Hi Krishna,why BER of QAM-OFDM and QAM in AWGN are same?

zingas May 8, 2009 at 11:53 am

i want to ask whether there is any difference between taking n-point ifft
and then fft for OFDM Vs taking ifft and then n-point fft in matlab.

the difference i get is the signal with n-point ifft and then fft has a
spectrum which do not have good resolution


Krishna Pillai May 12, 2009 at 5:26 am

@zingas: Is there any specific reason why you mentioned ‘n-point’ specifically?

In general, as long as you undo the effect of what you did at the transmitter at the receiver, you should be able to demodulate correctly the received symbol.

The fft spectral resolution is controlled by sampling frequency (fs) and the size of fft (N). For eg, with fs = 20MHz, and N = 64, the resolution is 312.5kHz. Agree?

algenaby April 19, 2009 at 6:15 pm

Hi Mr.Krishna,
I am very happy for your Contributions in solve the problems associated with high data rate as OFDM.I am reseacher and I hope to provide me fundamental code for 16QAM (OFDM) and 16PSK (OFDM).
thanks .

Krishna Pillai April 22, 2009 at 5:29 am
Budhaditya March 30, 2009 at 2:52 pm

while going through “Understanding an OFDM transmission” i have come across few problems,and they are:

1.When the 20 Mhz is divided into 64 subcarriers,then why only 52 are used?is it because we have to provide the guard band in between the siglans???

Krishna Pillai April 4, 2009 at 4:23 pm

@Budhaditya: You are right. To be more precise, the null subcarriers are provided to have guard band between signals in adjacent channels.

Kishore March 26, 2009 at 9:06 am

Hi Krishna,
One more doubt,

subcarrierIndex = [-26:-1 1:26];

Here 52 subcarriers are used.

1)Can i use 0 to 51 intstead of negative frequencies and avoid fftshift()?.
2) How do we interpret these subcarrier numbers
0 corresponds to dc value
N/2 ( here 52/2) – corresponds to Nyquist frequency and after this is a replica.

Am i right here ?

Thanks again.

Krishna Pillai April 4, 2009 at 7:54 am

@Kishore: My replies:

(1). Definition of subcarriers from [32:63] in 64-pt FFT is notional. What ever we sent on those subcarriers will get aliased back to [-32:-1]. To understand better, think of the following scenario. Lets say we are sampling a sinusoidal at 11MHz with sampling frequency of 20MHz. From sampling theory, we know that 11MHz gets aliased to 11-20 = -9MHz.

(2) Negative subcarriers can be interpreted as complex sinuosidal e^(-jwt) – with the phase decreasing with increasing time. N/2 is not typically 52/2. Typically we deal with FFT sizes which are powers of 2 – in this example we use 64.
Did you want to look at a post on negative freqency @

Hope this helps to give you good pointers. Please revert, if otherwise.

Omar Quiñones March 17, 2009 at 3:31 pm


tengo una duda, estoy trabajando en un proyecto y debo usar la ventana hanning, pero resulta que esta me reduce la magnitud de los datos, he leido que para compensar dicha magnitud, estos datos deben ser multiplicados por un factor… pero no tengo conocimiento de como calcular este factor, alguien aquí tiene este dato, o me podrian colaborar con información al respecto. Muchas Gracias

Krishna Pillai March 21, 2009 at 8:59 am

@Omar: (after translating your comment to english thanks to google translate)
“I have a doubt, I’m working on a project and I use the Hanning window, but it is me that this reduces the magnitude of the data, I read that, to compensate for this magnitude, these data should be multiplied by a factor … but I’m not aware of how to calculate this factor, someone here has such information, or do you work with information. Thank you very much”

hmm….how are you applying Hamming window ?

Filbert March 11, 2009 at 9:59 am

Hi Khrisna,
I have sent you my simulation result, i do hope you can give your opinion about it. And i have another question. You said i should try

[Pxx,W] = pwelch(st,25,0.01,4096,20);

May i know why you chose 25 for window length and 0.01 for overlap factor? Are there any consideration for choosing these parameters?

Thank you

Krishna Pillai March 21, 2009 at 7:04 am

@Filbert: I think smaller window length ensures that the spectrum is smoother. That was one of your objectives, no?

Marwan March 8, 2009 at 12:11 am

Hi Mr Pillai,
I have failed to implement OFDM raised cosine windowing. Are you able to give me some matalab hints?
thank you in advance!

Krishna Pillai March 8, 2009 at 7:46 pm

@Marwan: As I understand, raised cosine windowing is performed to do transmit filtering without causing ISI. However, in OFDM, as there is cyclic prefix, there wont be any ISI evenif we use a normal filter. Hence may I know the motivation behind using raised cosine filtering for OFDM.

Filbert March 2, 2009 at 10:20 am

Hi Krishna,
How are you? I just wonder why the psd in papers i have read the ripple is so smooth (some of them are just flat lines!). When i use your script, there are a lot of ripples. Do you have any idea about this? Thank you

Krishna Pillai March 5, 2009 at 5:04 am

@Filbert: It depends on the parameter passed onto the pwelch() function. Try specifying the window size and overlap factor.
Modify the pwelch() code to
[Pxx,W] = pwelch(st,25,0.01,4096,20);

Claire February 16, 2009 at 7:54 am


if you would like to use different windowing method (such as hanning), should I use the hanning(x) and multiply the signal and then using the psd() to calculate the PSD (to replace the pwelch function)?

Thanks for your help!

Krishna Pillai February 21, 2009 at 7:07 am

@claire: I think pwelch() by default multiplies by hamming windo before finding the spectrum.

thiruppathi March 2, 2009 at 7:27 pm

hi sir ,

plz sent some good material about to understand the Doppler shift ;;

sir can you provide the book mentioned below

“L.Hnzo, M.Munster, B.J.Choi, T.Keller, “OFDM and MC-CDMA,”

thank you
IEEE communication socity, March,2004.”

Krishna Pillai March 5, 2009 at 5:16 am

@thiruppathi; I think Digital Communications: Fundamentals and Applications by Bernard Sklar has a good review on Doppler in the chapter on Fading channels (Chapter 15 in my copy).

sona February 6, 2009 at 3:16 pm

i would like to do a project on ‘simulation of ofdm using matlab’. also i would like to compare the performance with some other communication system. Which you think is the best one to be compared with ofdm so that i can show the benefits of using ofdm clearly. can you give some help in doing the same?

Krishna Pillai February 10, 2009 at 7:59 pm

@sona: You may compare the performance of single carrier 802.11 transmission which is spread spectrum based (data rates of 1Mbps, 2Mbps, 5.5Mbps, 11Mbps) and compare it with 802.11a which is OFDM based (data rates of 6, 9, 12, … 54Mbps).
You may show the performance in multipath for similar data rates. Am expecting that OFDM should offer better immunity for multipath.

Hope this helps.

Filbert January 28, 2009 at 12:20 pm

Hi Krishna, how are you? I have some questions about your Matlab code “scriptofdmtx”. Is it right to write:

outputiFFT=64*ifft(inputiFFT,nFFTSize) or just
outputiFFT= ifft(inputiFFT,nFFTSize)?

I get confused if it should be multiplied with nFFTSize or not.

And for [Pxx, W]=pwelch(st,[],[],4096,20)

What is 4096 for? I think it is just nFFT? Why don’t you use 64 instead of 4096?

Thank you

Krishna Pillai January 30, 2009 at 5:36 am

@Filbert: My responses
1. Multiplication by nFFTSize does not really matter. It just enables one to scale the power of the signal, if one desires to do so.
2. The parameter 4096 controls the frequency resolution of the pwelch() function. Yes, I could have used 64, but I just wanted the plot to have more frequency resolution.
Hope this helps.

kamran January 26, 2009 at 6:16 pm

hi Krishna… i hope you are fine and doing well. I am new to this field and would like to post questions starting from a basic level. In matlab why do we need to upsample our data sequence e.g. 4-PAM before sending it to the pulse shaping filter? I read that we need to match their sampling frequencies… but i didn’t understand what its trying to explain. Can you kindly explain this to me that why we need to match the sampling frequencies of both???
thanking in advance…

Krishna Pillai January 27, 2009 at 6:28 am

@kamran: Yes, you are right. The sampling of data sequence and the sampling of the filter should match. If it does not match, then the filtering might not be proper. I have written some posts on transmit pulse shaping filter @
URI: http://www.dsplog.com/2008/04/14/transmit-pulse-shape-nyquist-sinc-rectangular/
URI: http://www.dsplog.com/2008/04/22/raised-cosine-filter-for-transmit-pulse-shaping/
URI: http://www.dsplog.com/2008/05/01/eye-diagram-plot-matlab-raised-cosine-filter/

Hope this helps.

Filbert January 25, 2009 at 2:24 pm

Hi Krishna,
I read from references that it requires oversampling at least twice, so if you transmitting 2500 bits, it needs at least 1250 zeros in the middle of the sequence. Is it right? I do not see the oversampling in your Matlab script. Thanks

Krishna Pillai January 27, 2009 at 6:16 am

@Filbert: For OFDM case, its a bit different. In OFDM we let aliasing to happen. However, the aliasing does not cause distortion because there are no frequency components in the -ve side of the spectrum. I have discussed in bit detail on the post on Negative Frequency.
URI: http://www.dsplog.com/2008/08/08/negative-frequency/

Btw, if its oversampling by 2 (of a bit sequence of 2500bits), we need to insert 2500 bits. You can find details on oversampling and associated filtering (zero-order hold, sinc, raised cosine etc) @
URI: http://www.dsplog.com/2008/04/14/transmit-pulse-shape-nyquist-sinc-rectangular/
URI: http://www.dsplog.com/2008/04/22/raised-cosine-filter-for-transmit-pulse-shaping/
URI: http://www.dsplog.com/2008/05/01/eye-diagram-plot-matlab-raised-cosine-filter/

Hope this helps.

kakamilan January 14, 2009 at 7:54 am

Note that there is an time extention beofre IDFT.The time that a symbol lasts will be N times than before. So T should be NT while suming N symbols. Is it right?

Krishna Pillai January 16, 2009 at 6:20 am

@kakamilan: Sorry, I did not understand your comment. I do not see a reason why the symbol should be extended before IFFT. Typically the cyclic prefix insertion is done after ifft.
OR where you implying something else?

Abdul-Jabbar Al-Ubaidy January 4, 2009 at 7:12 pm

Hi all,
OFDM is play great role in communication enhancement the understanding of this subject need good acknowledgment in M-arry modulation process and frequency analysis process ,so we can generate OFDM using wavelet Transform instead Fourier Transform.

Krishna Pillai January 6, 2009 at 6:17 am

@Abdul: Can you please point to reference explaining OFDM generation using Wavelet Transform

Krishna Pillai May 29, 2008 at 5:05 am

@Mork:Thanks for the valuable comments.
Trying to answer the first comment:
(a) Yes, I agree. I was loosely specifying that a continuous time signal can be represented using IDFT. Infact, I should have added one more step, where I defined s(nT) and then claimed that it can be represented using IDFT.
(b) Yes, direct implementation is K oscillators :(

Trying to answer the second comment.
Thanks for the link to the paper “OFDM transmitters: analog representation and DFT-based implementation”
(a) From a quick read, the authors are showing that one has to consider the sampled window function g(nT) rather than the contnuous function g(t). I did not follow the full paper, however I was unable to find the reason behind y(t) having more psd than x(t) in region from 0.5 to 0.75 omega_s (ref. figure 5). Any thoughts?
(b) Further, just to note that, in a typical implementation, the output x(nT) will be upsampled followed by a digital filtering, then passed to the DAC. Not of relavence to this discussion, but just to add as FYI.

Thanks again for your comments. You helped me provide a better insight. :)

Ps. I made a brief update to the post to reflect that s(nT) and not s(t) can be implemented using iDFT.

Mork May 27, 2008 at 9:44 pm

Sorry for the double-posting, but I just happened to find the answer to my question (by pure chance — I’ve been trying to find out for quite a while already).
The relation between s(t) as you wrote it (and as it is widely used) and the actual (I)DFT implementation is looked at in a paper by Lin and Phoong (http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1223555). Summarized very briefly, they find that for general window functions — g(t) in your example — including the commonly used rectangular windows, it is indeed *not* possible to generate the same s(t) using a DFT followed by a DAC. It is possible to generate a signal with the same values at the times t=nT, but the corresponding signal will still be different (and thus have a different PSD, too).

Thanks for your attention :-)
- M

Mork May 27, 2008 at 6:27 pm


After providing the formula for s(t), you wrote
>It is reasonable to understand that above operation corresponds to an inverse Discrete Fourier Transform (IDFT) operation.
Why? s(t) is a continuous-time signal, so wouldn’t it be the Fourier Series (if anything) rather than the DFT?

Another question: I understand the properties of s(t) as it is, but how can this be implemented efficiently for large values of K? A direct implementation of the formula would require K oscillators at the receiver and the transmitter (to generate the individual sinusoidals), right?

– M

Krishna Sankar April 13, 2010 at 5:29 am

@Chaitanya: The training sequence help the receiver synchronize with the transmitter – to help with channel estimation, phase synchronization etc

Krishna Sankar January 7, 2012 at 5:52 am

@MFS: Thanks, will study that.

Comments on this entry are closed.

{ 3 trackbacks }

Next post: