M-QAM Bit Error Rate in AWGN

Quadrature Amplitude Modulation has been adopted by most wireless communication standards such as WiMAX and LTE. It provides higher bit rates and consequently higher spectral efficiencies. It is usually used in conjunction with Orthogonal Frequency Division Multiplexing (OFDM) which provides a simple technique to overcome the time varying frequency selective channel.

We have previously discussed the formula for calculating the bit error rate (BER) of QAM in AWGN. We now calculate the same using a simple Monte Carlo Simulation.

% n_bits: Input, number of bits
% M: Input, constellation size
% EbNodB: Input, energy per bit to noise power spectral density
% ber: Output, bit error rate
% Copyright RAYmaps (www.raymaps.com)

function[ber]= QAM_AWGN(n_bits, M, EbNodB)

% Transmitter

% Channel

% Receiver
h2.decisiontype='hard decision';

64-QAM Constellation in AWGN

The above function basically has three inputs and one output. The inputs are the number of bits to be passed through the channel, the size of the constellation and the signal to noise ratio in dB. The output is the bit error rate (BER). The simulation can be divided into three section namely the transmitter, the channel and the receiver. In this simulation we have used Gray coding which gives us about a dB of improvement at low to medium signal to noise ratio.

M-QAM Bit Error Rate in AWGN
M-QAM Bit Error Rate in AWGN

As seen above the BER obtained through our simulation matches quite well with the BER obtained through the theoretical formula. Each additional bit per symbol required about 2dB extra in signal to noise ratio to achieve the same bit error rate.

Lastly we explain some of the terms used above.


All wireless receivers suffer from thermal noise which is a function of absolute temperature and bandwidth of the receiver. This noise is added to the received signal and makes detection of weak signals a major challenge. Just to given you an idea typical GSM receivers have a noise floor of -113 dBm. Therefore, if the received signal has a power of -100 dBm we get a signal to noise ratio (SNR) of 13 dB. In simulation this noise is usually modeled as a Gaussian Random Process. It is additive, as opposed to channel impairments which are multiplicative and has a flat spectrum (thus called White Noise).

Gray Coding

When using QAM modulation, each QAM symbol represents 2,3,4 or higher number of bits. That means that when a symbol error occurs a number of bits are reversed. Now a good way to do the bit-to-symbol assignment is to do it in a way such that no neighboring symbols differ by more than one bit e.g. in 16-QAM, a symbol that represents a binary word 1101 is surrounded by four symbols representing 0101, 1100, 1001 and 1111. So if a symbol error is made, only one bit would be in error. However, one must note that this is true only in good signal conditions. When the SNR is low (noise has a higher magnitude) the symbol might be displaced to a location that is not adjacent and we might get higher number of bits in error.

Hard Decision

The concept of hard decision decoding is important when talking about channel coding, which we have not used in the above simulation. However, we will briefly explain it here. Hard decision is based on what is called “Hamming Distance” whereas soft decision is based on what it called “Euclidean Distance”. Hamming Distance is the distance of a code word in binary form, such as 011 differs from 010 and 001 by 1. Whereas the Euclidean distance is the distance before a decision is made that a bit is zero or one.  So if the received sequence is 0.1 0.6 0.7 we get a Euclidean distance of 0.66 from 010 and 0.46 from 001. So we cannot make a hard decision about which sequence was transmitted based on the received sequence of 011. But based on the soft metrics we can make a decision that 001 was the most likely sequence that was transmitted (assuming that 010 and 001 were the only possible transmitted sequences).

9 thoughts on “M-QAM Bit Error Rate in AWGN

  1. Hi John, is possbile to increase the bit rate increasing the bandwidth, without exceeding the theoretical limit for the bpsk? for example with a bit rate of 5 bits/s over a bandwidth of 5 Hz . This is correct? And if so how can i implement it in matlab code? Do you have any idea?

    Thanks again for attention !

  2. Hi John,
    I’m working to a bpsk ber simulation and I have to increase the spectral efficiency, putting the symbol rate (or baud rate) in the code! Can you help me in some way? Need help, I can’t understand how to increase the number of bit for symbol in the code!


    Num_bit = 10^6 % number of bits
    data = rand(1,Num_bit)>0.5; % random bits generator
    s = 2*data-1; % bpsk modulation
    noise = 1/sqrt(2)*[randn(1,Num_bit) + j*randn(1,Num_bit)]; % add gaussian noise (Channel AWGN)
    Ebno = [0:10]; % Unitary variance

    for i = 1:length(Ebno)
    % adding noise
    rx = s + 10^(-Ebno(i)/20)*noise;

    % receiver
    datarx = real(rx)>0; % hard decision, if real(rx) > 0 datarx = 1, else datarx = 0

    num_err(i) = size(find([data- datarx]),2);


    media = mean(data);
    varianza = var (noise);

    fprintf (‘media = %f\n’, media);
    fprintf (‘varianza = %f\n’, varianza);

    % simulation BER

    BER = num_err/Num_bit;
    teoBer = 0.5*erfc(sqrt(10.^(Ebno/10)));

    hold on
    axis([0 10 10^-5 0.5])
    grid on
    legend(‘teorico’, ‘simulato’);
    xlabel(‘Eb/No, dB’);
    ylabel(‘Bit Error Rate’);
    title(‘Curva di BER per modulazione BPSK’);

  3. The above code calculates the energy per bit and then calculates the noise power to get the desired signal to noise ratio. For working of AWGN use MATLAB help.


  4. Hi John,
    I don’t speak English well. :)
    Please! You can explain difference between function AWGN (in matlab) and code
    As I understand it, function AWGN in matlab adds gaussian noise and when I try it in code I get incorrect results.
    mail: manhdatbn93@gmail.com
    Thank you :)

  5. Pooja,

    I hope you have created two files.

    1. The above code with the name QAM_AWGN.m

    2. A piece of code that is used to call the above function as

    BER=QAM_AWGN(n_bits, M, EbNodB)

    Hope this helps!!!


  6. Pooja,

    You have to take care of the input arguments in

    QAM_AWGN(n_bits, M, EbNodB)

    such as

    QAM_AWGN(100000, 16, 10)

    this means that the Bit Error Rate (BER) is calculated for 100000 bits, for 16-QAM at an EbNo of 10dB.

    Try it!!!


  7. Hi
    I tried your code for QAM_AWGN but on the second line it is showing me error:Not enough input arguments. Can you help me?

  8. To Mr John
    Nice to know you. I’m planning to do a research about performance of wimax/lte downlinks over haps channel in terms of capacity vs HAP elevation angle. Could you please provide some matlab scripts related to this topic. I look forward to your help.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>