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

16QAM Bit Error Rate (BER) with Gray mapping

by Krishna Sankar on June 5, 2008

Let us derive the theoretical 16QAM bit error rate (BER) with Gray coded constellation mapping in additive white Gaussian noise conditions. Further, the Matlab/Octave simulation script can be used to confirm that the simulation is in good agreement with theory.

Gray coded bit mapping in 16-QAM modulation

As we discussed in the previous post on Binary to Gray code for 16QAM, the 4 bits in each constellation point can be considered as two bits each on independent 4-PAM modulation on I-axis and Q-axis respectively.

b0b1 I b2b3 Q
00 -3 00 -3
01 -1 01 -1
11 +1 11 +1
10 +3 10 +3

Table: Gray coded constellation mapping for 16-QAM

16QAM modulation with Gray coded mapping

Figure: 16QAM constellation plot with Gray coded mapping

Symbol Error and Bit Error probability

As can be seen from the above constellation diagram, with Gray coded bit mapping, adjacent constellation symbols differ by only one bit. So, if the noise causes the constellation to cross the decision threshold, only 1 out of bits will be in error. So the relation between bit error and symbol error is,



For very low value of , it may so happen that the noise causes the constellation to fall near a diagonally located constellation point. In that case, the each symbol error will cause two bit errors. Hence the need for approximate operator in the above equation. However, for reasonably high value of , the chances of such events are negligible.

Bit energy and symbol energy

As we learned from the post discussing Bit error rate for 16PSK, since each symbol consists of bits, the symbol to noise ratio k times the bit to noise ratio i.e,




From the post detaling the derivation of 16QAM Symbol error rate, we know that the symbol error is,


Combining the above two equations, the bit error rate for Gray coded 16QAM in Additive White Gaussian Noise is


Simulation model

The Matlab/Octave script performs the following:

(a) Generation of random binary sequence

(b) Assigning group of 4 bits to each 16-QAM constellation symbol per the Gray mapping

(c) Addition of white Gaussian Noise

(d) Demodulation of 16-QAM symbols and

(e) De-mapping per decimal to Gray conversion

(f) Counting the number of bit errors

(g) Running this for each value of Eb/No in steps of 1dB.

Click here to download : Script for computing 16QAM BER with Gray mapping

Figure: Bit Error Rate plot for 16QAM modulation with Gray mapping

I think we have analyzed the bit error and symbol error probabilites for most of the PSK and QAM modulation schemes in Additive White Gaussian Noise. Time to move on to error rate in multipath channel. receiver diversity. MIMO channel, modulation with memory etc etc :)

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.

{ 102 comments… read them below or add one }

Nur February 21, 2015 at 9:35 pm

Hello Sir
Considering the BER of 16-QAM, what are the equations of 1. No Fading situation and Rayleigh Fading situation.
i have these equation are they correct: BPSK= No Fading , Pb= q(sqrt(2 * snr));
BPSK=Rayleigh Fading =Pb= y = (1 – sqrt(snr ./ (1 + snr))) / 2;

QPSK=No Fading= y = q(sqrt(snr)); and
QPSK=Rayleigh Fading= PB= y = (1 – sqrt(snr ./ (2 + snr))) / 2;

16QAM= No Fading= y = 3*q(sqrt(snr/5));
16QAM= Rayleigh Fading= y = (1 – sqrt(snr ./ (5 + snr))) / 2; please help me with this… i couldn’t find derivation of these equation. thanks in advance


Nola75Gbgrgf December 27, 2014 at 7:00 am

Fantastic goods from you, man. I have understand your stuff previous to and you are just extremely great. I really like what you have acquired here, certainly like what you’re stating and the way in which you say it. You make it enjoyable and you still care for to keep it smart. I can not wait to read far more from you. This is really a great website.


HaroldN56zyfohoy December 27, 2014 at 2:57 am

Nice post. I learn something new and challenging on blogs I stumbleupon everyday. It’s always helpful to read through articles from other authors and use a little something from other websites.


Melliss59C December 27, 2014 at 12:13 am

you are actually a excellent webmaster. The site loading velocity is incredible. It seems that you’re doing any distinctive trick. In addition, The contents are masterpiece. you have performed a great task in this matter!


Marilyn69F December 26, 2014 at 5:42 pm

For hottest information you have to pay a quick visit web and on the web I found this web site as a finest web page for hottest updates.


OscarBanks December 26, 2014 at 12:56 pm

Thankfulness to my father who informed me regarding this weblog, this weblog is actually awesome.


AliLabilliere December 26, 2014 at 4:14 am

Everyone loves what you guys tend to be up too. This sort of clever work and exposure! Keep up the good works guys I’ve added you guys to blogroll.


TajYeojiasxs December 25, 2014 at 8:31 am

Hi there, yeah this article is truly pleasant and I have learned lot of things from it regarding blogging. thanks.


LydaXDXKdafopu December 10, 2014 at 1:17 am

Hello, after reading this amazing article i am also cheerful to share my knowledge here with mates.


PorterPape December 10, 2014 at 12:40 am

Wow! After all I got a weblog from where I be able to actually get useful facts regarding my study and knowledge.


DebraMcCleary December 10, 2014 at 12:35 am

I think the admin of this website is really working hard in support of his web site, as here every stuff is quality based data.


VidaPowerld December 10, 2014 at 12:30 am

I am regular visitor, how are you everybody? This post posted at this web site is really good.


Lakesha8368 December 9, 2014 at 11:33 pm

I was more than happy to discover this website. I wanted to thank you for ones time for this particularly wonderful read!! I definitely savored every little bit of it and I have you bookmarked to see new things on your blog.


BradleyHite December 9, 2014 at 11:26 pm

This article offers clear idea in favor of the new people of blogging, that genuinely how to do running a blog.


PeggyNfwfxwhen December 8, 2014 at 3:30 am

There’s certainly a great deal to find out about this issue. I love all of the points you’ve made.


JacquelLJZ December 7, 2014 at 1:44 pm

I have read so many articles or reviews concerning the blogger lovers except this post is truly a good piece of writing, keep it up.


ColumbuHorseman December 3, 2014 at 5:29 am

Hurrah, that’s what I was searching for, what a material! present here at this web site, thanks admin of this web site.


power filter aquatop aquatop October 19, 2014 at 11:05 am

Hi! Would you mind if I share your blog with my zynga group?
There’s a lot of folks that I think would really appreciate your content.
Please let me know. Thank you


desdi July 7, 2014 at 1:55 am

hi krishna, i would luv to download would like to download the free ebook on AWGN.i folowed the subscription instructions but i m yet to see a copy of the book.
and thanks for ur goodwork!!!!


www.crossing.it April 14, 2014 at 12:52 am

I got this web site from my pal who told me about this
website and now this time I am browsing this website and reading very informative content at this time.


Santosh Reddy April 4, 2014 at 1:17 am

what is the signal mapping for 8 bit psk


Rana January 31, 2013 at 2:47 pm

sir can u help me?
i need Packet error rate for 16 QAM


Krishna Sankar February 1, 2013 at 5:50 am
P.Uthayasankar January 28, 2013 at 4:44 pm

hai krishna pillai frnd, i want to simulate the transmission of message using QAM in different frequency domain in DSP MATLAB


Krishna Sankar February 1, 2013 at 5:34 am

@Uthayasankar: sorry, did not follow your question


Himanshu January 8, 2013 at 11:06 am

Sir, I need to calculate the BER for uncoded 16QAM in AWGN. Can u suggest the modifications required. Well, I had found a paper on it http://perso.ensil.unilim.fr/~meghdadi/notes/ber_awgn.pdf . But the result of equations mentioned in this paper are not matching with the result of MATLAB function.
Please help me for the changes required.


Krishna Sankar January 9, 2013 at 5:29 am

@Himanshu: That looks like a good link. Are you looking for the symbol error rate or bit error rate? For symbol error rate, check out http://www.dsplog.com/2007/12/09/symbol-error-rate-for-16-qam/


sara December 7, 2012 at 8:32 pm

Hi krishna!
finally I can access your blog again :)
i have a query why cant we use grey coding for 32-bit Cross QAM?
btw I am just curious why you have not given any code for odd number of bits per symbol cross QAM or rectangular QAM?


Krishna Sankar December 8, 2012 at 3:52 am

@sara: Glad that you are able to visit the blog – not sure about the issue.
Digitial communication is a vast topic – have only have a handfull of articles in this blog. I have not read much about rectangular QAM. Will study and revert.


srinu pyla October 29, 2012 at 10:53 am

hello sir how can I join in this ? how can I interact with u? my research topic is optimization of PAPR in OFDM systems


Krishna Sankar November 2, 2012 at 6:37 am

@srinu pyla: You can post your queries in the comments section


Francisco October 11, 2012 at 3:07 am

Hi Krishna,

First of all, congratulations for this blog which is very interesting.
I was wondering if you ever try to apply Grey mapping to a binary PCS code? I’ve been trying by finding the periodic autocorrelation function first but then it gets kind of confused. If you ever try this before, could you probably give some guidence how to tackle it/ I will really appreciate.


Krishna Sankar October 15, 2012 at 6:24 am

@Francisco: Sorry, I have not tried this. Can you point me to some references on binary PCS code?


karim July 27, 2012 at 7:31 pm

Hello Krishna
tank you for your site… it is fantastic.
could you help me?
I want to simulation convolutional code with viterbi algorithm . . .
I need to help for MATLAB code!


Krishna Sankar August 1, 2012 at 6:14 am

@karim: Thanks.
The post on Viterbi decoder describes a rate 1/2 K=7 convolutional encoder and its corresponding Viterbi decoder.

Some follow up posts on Viterbi decoder are
a) Soft Input Viterbi decoder
b)Viterbi with finite survivor state memory

Hope this helps


sunita April 18, 2012 at 8:57 pm

hi krishna
Simulate & Compare the BER of a 8-PSK system and a 8-QAM system with grey coding and Eb/No==0,2,4,6,8,10 dB
can you plz post the steps to run this program?



Krishna Sankar April 19, 2012 at 5:03 am

@sunita: The post comparing 16PSK and 16QAM might be of help to you


Roy November 23, 2014 at 10:33 pm

Hi Krishna,

I am having a hard time with my project and I need to give it next week. I don’t know how to do it.

Can you please help me. I need to have this or else I will fail the subject. PLEASE!!!

Simulate & Compare the BER of a 8-PSK system and a 8-QAM system with grey coding and Eb/No=0,2,4,6,8,10 dB

Thank you


jay November 20, 2014 at 6:58 am

Hi Sunita,

Did you get a chance to finish this project? I have same exact project to do.

Simulate & Compare the BER of a 8-PSK system and a 8-QAM (pick one constellation) system with grey coding and Eb/No =0,2,4,6,8,10 dB

Can you send me the code?


mohammad April 11, 2012 at 12:34 am

Hello Krishna Pillai.
i want help
if we generate random signal to 16qam like this:
x= rand(1,100000);
s=(x<1/16)*(3+3i)+(x1/16)*(3+i) +…….etc
then if we want to know number of error we added noise to this signal
sig=(x>0)*(3+3i) % test one of 16 qam
n=awgn(sig,snr) ;
so that this result should be compatible with theoretical law
but the result is not compatible ,please where is the error


Krishna Sankar April 11, 2012 at 5:19 am

@mohammad: Are you able to get zero errors if you do not add noise?


Anita March 13, 2012 at 11:55 am

sir i need MMSE equalizer for 16 QAM.


Krishna Sankar March 21, 2012 at 5:12 am

@Anita: Is it a 1tx-1rx system?


abc March 12, 2012 at 8:18 pm

Hello krishna,
I am working on the viterbi decoding of the rate1/2 convolution encoder of constraint length 7. I am facing difficulty in coding the state metric and traceback unit of viterbi decoder on matlab as there will be 64 states. could you please help me out in this.


Krishna Sankar March 21, 2012 at 5:12 am

@abc: Please take a look at http://www.dsplog.com/tag/viterbi/


salman February 28, 2012 at 5:25 am

plz provide me the code for my project which is described as:-
Consider a 16QAM communication system. The information rate is 2 Mb/s and the
carrier frequency is 12 GHz. Assume perfect synchronization.
a) Simulate the system if the channel is AWGN and draw bit error rate of the system
versus Eb/No. Compare the results with what you obtain in theory.
b) Consider (15,11) Hamming code. Apply this code into the above system.
Compare the results with what you obtain in theory.
c) Simulate uncoded system if we have a Doppler Spread due to mobile movement
in the channel. Simulate and draw the bit error rate of the system for maximum
mobile speed 42.3 Km/Hour. No equalizer is used in the system.
d) Apply coding of part (b) into the system of part (c). Simulate the system and
discuss the results.
e) Design an interleaver for the system of part (d) to improve the coded performance
results. Simulate the system.
f) Discuss all the results.


Krishna Sankar March 12, 2012 at 5:01 am

@salman: Good luck with your assignment


Manpreet Kaur August 4, 2014 at 7:15 am

Hi Salman,
Can you pls share this assignment with me? I hope you solved it, It is quite similar to mine. My email is manu.manpreet22@gmail.com


ridham August 8, 2014 at 10:41 pm

can you share this assignment with me please


ridham August 8, 2014 at 10:44 pm

can you send me this assignment on ridhammayani007@gmail.com please


Divine Dennis February 22, 2012 at 8:49 pm

Thanks for that…


Divine Dennis February 16, 2012 at 2:05 pm

I’ve just gone through some of your tutorials and I really appreciate the work you are doing. I’ve just subscribed to your feed and will appreciate if you could send me the free ebook as well.


Krishna Sankar February 21, 2012 at 7:17 pm

@Divine: Emailed you the instructions


Sri Lalitha January 26, 2012 at 8:59 pm

Sir can u provide me the program for QPSK in Rayleigh fading environment along with error performance..


Krishna Sankar January 29, 2012 at 5:52 am

@SriLalitha: A bunch of BPSK related posts in Rayleigh channel is available at
Hope this helps


Sri Lalitha March 1, 2012 at 9:19 pm

thanks sir


Ojasvi Bhatia January 6, 2012 at 2:33 pm

Hello Sir,

I want to compare BER performance of OFDM system using BPSK, M-PSK and M-QAM schemes with Rayeleigh/Ricean Fading channel. Can u please send me script which can help me …..please I am new to MATLAB


Krishna Sankar January 7, 2012 at 6:17 am

@Ojasvi: You can symbol error rate for a general M-QAM in OFDM over AWGN at
Converting symbol error rate to Bit error rate should be relatively simple. You can refer to the 16QAM BER example at http://www.dsplog.com/2008/06/05/16qam-bit-error-gray-mapping/


Ovidiu October 4, 2011 at 6:43 pm

Hy . I think you might have some errors in your results. You have to divide your result by 2 otherwise when you have low SNR your error rate will be above 1. :)


Best regards,


Krishna Sankar October 30, 2011 at 7:33 pm

@Ovidiu: Are you sure?


priya March 3, 2011 at 2:19 pm

we impressed with your article.we need more codings on adaptive modulation


Hassan November 23, 2010 at 11:12 pm

Dear Krishna,

I need to calculate Matlab code for 64 QAM BER!
I wonder how to change the code you wrote for 64 QAM SER to 64QAM BER ?
Please could you explain, I should know it as soon as possible.



Krishna Sankar July 2, 2012 at 5:41 am
v.sridhar September 5, 2010 at 1:17 pm

pls send me ber for bpsk,qpsk,8qam,16qam,64qam. pls send me that matlab code


Krishna Sankar September 6, 2010 at 5:09 am
Hassan July 23, 2010 at 7:11 pm

Dear Sir,

For BPSK AWGN AND BPSK RAYLEIGH , Eb = 1 already. But for 16-QAM, Eb=2.5 by doing theoretical calculation and also what you did in your 16-QAM script. Now how shall I make Eb=1 for 16-QAM case so that I can compare this 16-QAM with BPSK AWGN AND BPSK RAYLEIGH?
Please kindly help me in this above problem.
Thank You


Krishna Sankar July 26, 2010 at 6:49 am

@Hassan: To normalize the power for 16QAM constellation, scale it by 1/sqrt(10).


hassan June 12, 2010 at 1:28 am

I want to realize the simulation of the transmission using OFDM with 16QAM thank you for helping me if possible as much as possible


Krishna Sankar June 21, 2010 at 5:58 am

@hassan: I have discussed BPSK in OFDM @ http://www.dsplog.com/2008/06/10/ofdm-bpsk-bit-error/
Hopefully, you can adapt the simulation in the above post for 16QAM case.


kanchan April 11, 2010 at 12:16 pm

i am mid way in matlab.i mean not very good and not very bad.
i am simulating and implementing the practical adsl environment in matlab.
please help me regarding it.


Krishna Sankar April 14, 2010 at 5:03 am

@kanchan: All the best. You can ask your queries in the comments section


atif February 28, 2010 at 5:40 pm

please help me in 16 qam modulation.any one send me the matlab code of 16 qam modulation.


Krishna Sankar March 30, 2010 at 4:57 am
anna February 20, 2010 at 10:18 pm

hye sir…. do you have any tutorial on how to structure the constellation because the symbols is randomly being plot in the graph… i want to start with {0000} first and lastly to {1111)..- from left top corner of the constellation then move to the right and down…


Krishna Sankar March 31, 2010 at 5:35 am

@anna: If you see carefully, its not chosen randomly. Its chosen in a way such that adjacent constellation symbols differ by one one bit (and that called Gray coding) :)


waleed salos December 9, 2009 at 12:43 am

Dear Krishna sankar
I waleed salos Thank alot for Reply but I need Matlab codes for Post and pre-FFT Beamforming in an OFDM system
LMS Beamforming for Pre and Post-FFT processing in OFDM communication systems
Thank for all


Krishna Sankar December 10, 2009 at 6:03 am

@waleed: Sorry, I am not familiar with the topic which you are referring to.


waleed salos December 7, 2009 at 4:41 pm

I am waleed from palestinian
I was in need the performnce of bit error rate in pre-ffT and postfft at frequency selective fading .
plesae help me
thank for all


Krishna Sankar December 8, 2009 at 5:28 am

@waleed salos: Hopefully the post on BER for BPSK with OFDM in multipath channel might be of help


shadat December 6, 2009 at 2:31 pm

please send me simulation for 16QAM and 64 QAM modulation and demodulation for convolutionaly encoding and viterbi decoding and theoritical BER for convolutionaly BPSK,QPSK,16QAM,64QAM


Krishna Sankar December 7, 2009 at 5:28 am
Fritzou November 17, 2009 at 10:40 pm

Hello Mr Krishna Sankar
Great work
why you didn’t use an filter in the transmission and in the reception?(raised cosine)
what would I do if I had this case ?
Thanks .


Krishna Sankar December 6, 2009 at 3:42 pm

@Fritzou: The transmit and receive filters will cause additional notational complexity, which I wished to avoid in this post. I have some posts on simulations with transmit and receive filters
a) http://www.dsplog.com/2008/05/01/eye-diagram-plot-matlab-raised-cosine-filter/
b) http://www.dsplog.com/2008/04/22/raised-cosine-filter-for-transmit-pulse-shaping/
c) http://www.dsplog.com/2009/05/08/ber-with-matched-filtering/


Preston November 14, 2009 at 8:32 am

Thanks for the great info on here, it’s helping alot…

I am having a problem seeing how I would factor in the number of users, and the processing gain, of a CDMA system for the Probability of Bit error….

I am assuming that the Gp and the number of users, would be factored into the value for Eb but I’m not sure. Can you give me some direction on this?



Krishna Sankar December 3, 2009 at 5:34 am

@Preston: Well, I did not quite understand how you are using 16QAM Gray mapping to the CDMA case? In the CDMA case, I would expect you to have a code for each user.


minh November 12, 2009 at 9:29 am

I dont understand why while normalizing the transmit power to 1, you use the factor 1/sqrt(10). Would you explain it more? How about this factor in 32QAM and 64QAM? Thank you


Krishna Sankar November 13, 2009 at 5:38 am
Fritzou October 31, 2009 at 10:29 pm

Hello ! Thank you so much for this great work ^_^
I have a question about the n noise :
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; 0 dB variance
if I didn’t use a complex noise, wh


Fritzou November 3, 2009 at 10:34 pm

Hello ! Thank you so much for this great work ^_^
I have a question about the n noise :
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; 0 dB variance
if I use a real noise, what is the value of the variance ?


Krishna Sankar November 8, 2009 at 8:48 am

@Fritzou: 3dB less.


Krishna Sankar November 8, 2009 at 8:28 am

@Fritzou: If you dont use complex, then the variance will be down by 3dB.


izzat October 13, 2009 at 10:05 am

hi sir.
i’m new to matlab and have problem to modulate the 64QAM bit error rate.
how do i change the code u wrote in 16QAM to 64QAM or 256QAM?
every help is much appreciated.


Krishna Sankar October 15, 2009 at 5:20 am
ipraz2 September 28, 2009 at 1:15 pm

sir, i am new here. How i can add convolution encoding & viterbi decoding within the code. Are the code same for 16psk & 16qam???if u have code pls write.


Krishna Sankar October 1, 2009 at 5:25 am
venkat September 8, 2009 at 7:08 am

hi i need the matlab code for
” channel estimation and predicition for adaptive OFDM links”.
plz help me….


Krishna Sankar September 9, 2009 at 5:51 am

@venkat: Sorry, I do not have the Matlab code.


K.T.Liao September 4, 2009 at 6:38 am

Hello Krishna Pillai
Your blog helps me a lot!
I still have some question about the BER and SER on 16QAM
In code for caculating SER
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)];
y = s + 10^(-Es_N0_dB(ii)/20)*n; % additive white gaussian noise

In code for caculating BER
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)];
y = s + 10^(-Es_N0_dB(ii)/20)*n; % additive white gaussian noise

1)what’s the difference using Es/N0 or Eb/N0?
2)if I want to draw the curve of SER and using Eb/N0 as the x-axis
is that wrong??


Krishna Sankar September 9, 2009 at 5:35 am

@K.T.Liao: My replies:
1) Es/N0 refers to symbol to noise ratio and Eb/N0 refers to bit to noise ratio. For eg, in 16QAM, each constellation symbol carries 4 bits, so Es/N0 = 4Eb/N0.
2) Nothing wrong in plotting SER vs Eb/N0. I have written a post on it @


yvon June 5, 2009 at 3:26 pm

Hi, I have found your matlab code on the 16qam ber with gray code on the site http://www.dsplog.com and I have two question to ask you please.

1) What is the difference between “16qam ber with gray code” and “16qam ber without gray code”?
2) How do you get the theoretical expression of any M-aire qam ber.?
can you give me the corresponding expression of the 64-qam.?

Thanks for your help.


Krishna Pillai June 7, 2009 at 2:28 pm

@yvon: My replies:
1/ With Gray coded mapping, the bit loading into adjacent constellation symbols differ by only one bit. So, each error in constellation symbol typically results in one bit being in error. Without Gray coded bit mapping, this assumption is no longer true.

2/ I have posted about theoretical derivation of M-QAM symbol error rate @

Hope this helps.


hamid kazemi August 23, 2008 at 8:37 pm

I need article about walsh modulator
plz help me


Leave a Comment

{ 4 trackbacks }

Previous post:

Next post: