0% found this document useful (0 votes)
70 views2 pages

QAM 16 in AWGN

This document contains MATLAB code that calculates the bit error rate (BER) of quadrature phase-shift keying (QPSK) modulation in an additive white Gaussian noise (AWGN) channel. The code generates QPSK symbols, adds noise, demodulates to estimate received bits, and calculates BER by comparing actual and estimated bits over a range of signal-to-noise ratios. A graph of BER versus Eb/No is produced. The code was written by Yasir Ahmed to model QPSK modulation and demodulation using complex numbers for the in-phase and quadrature components.

Uploaded by

zekarias
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views2 pages

QAM 16 in AWGN

This document contains MATLAB code that calculates the bit error rate (BER) of quadrature phase-shift keying (QPSK) modulation in an additive white Gaussian noise (AWGN) channel. The code generates QPSK symbols, adds noise, demodulates to estimate received bits, and calculates BER by comparing actual and estimated bits over a range of signal-to-noise ratios. A graph of BER versus Eb/No is produced. The code was written by Yasir Ahmed to model QPSK modulation and demodulation using complex numbers for the in-phase and quadrature components.

Uploaded by

zekarias
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 2

EbNodB=-6:2:24

EbNo=10.^(EbNodB/10);

k=8;

M=2^k;

x=sqrt(3*k*EbNo/(M-1));

Pb=(4/k)*(1-1/sqrt(M))*(1/2)*erfc(x/sqrt(2));

semilogy(EbNodB,Pb)

% This program is used to calculate the Bit Error Rate (BER) of QPSK in an
% Additive White Gaussian Noise (AWGN) channel. The modulation and
% demodulation is done at baseband. Complex numbers are used to model the
% in-phase and quadrature components of a QPSK signal. The length of the
% symbol sequence and range of EbNo can be varied.
%
% By Yasir Ahmed
% www.raymaps.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This program is used to calculate the Bit Error Rate (BER) of QPSK in an
% Additive White Gaussian Noise (AWGN) channel. The modulation and
% demodulation is done at baseband. Complex numbers are used to model the
% in-phase and quadrature components of a QPSK signal. The length of the
% symbol sequence and range of EbNo can be varied.
%
% By Yasir Ahmed
% www.raymaps.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; %Clear all variables
close all; %Close all figures
l=1e6;
EbNodB=0:2:10;
EbNo=10.^(EbNodB/10);
for n=1:length(EbNodB)
si=2*(round(rand(1,l))-0.5); %In-phase symbol generation
sq=2*(round(rand(1,l))-0.5); %Quadrature symbol generation
s=si+j*sq; %Adding the two parallel symbol
streams
w=(1/sqrt(2*EbNo(n)))*(randn(1,l)+j*randn(1,l)); %Random noise generation
r=s+w; %Received signal
si_=sign(real(r)); %In-phase demodulation
sq_=sign(imag(r)); %Quadrature demodulation
ber1=(l-sum(si==si_))/l; %In-phase BER calculation
ber2=(l-sum(sq==sq_))/l; %Quadrature BER calculation
ber(n)=mean([ber1 ber2]); %Overall BER
end
semilogy(EbNodB, ber,'o-') %Plot the BER
xlabel('EbNo(dB)') %Label for x-axis
ylabel('BER') %Label for y-axis
grid on %Turning the grid on

You might also like