You are on page 1of 15

Hanoi University of Science and

Technology

Exercise for Wireless


Communications
Report
Bit error rate for 16PSK modulation
Symbol error rate for 16PSK modulation
Comparison Theory vs Simulation using Matlab

Student name: Hong Tun V


ID number: 20112477
Instructor: Mr.Nguyn Vn c

Hanoi , Dec, 8th , 2014


Table of Contents
1. Definition
2. Conversion from natural Binary to Gray code
3. Determine the Error rate
A)
Symbol error rate
B)
Bit error rate
4. MATLAB program
Simulation rusults
5. Observation
6. Reference
7. Remark

3
3
4
5
7
8
10
12
13
14

1 - Definition
16 PSK is a digital modulation scheme that conveys data by changing, or
modulating, the phase of a reference signal (the carrier wave).
16 PSK uses 16 points on the constellation diagram (4 identical constellations
rotate an angle of
), equispaced around a circle , 16 PSK can encode 4 bits per
symbol, shown in the diagram with Gray coding to minimize the bit error
rate(BER)

2 - Conversion from natural Binary to Gray code


Simple Matlab/Octave code for doing the binary to Gray code conversion
ip = [0:15];
op = bitxor(ip,floor(ip/2));
gray word

% decimal equivalent of a four bit binary word


% decimal equivalent of the equivalent 4 bit

Table : Natural Binary to Gray code


Input, Input, Gray, Gray,
Dec
Bin
Dec
Bin
0
0000 0
0000
1
0001 1
0001
2
0010 3
0011
3
0011 2
0010
4
0100 6
0110
5
0101 7
0111
6
0110 5
0101
7
0111 4
0100
8
1000 12
1100
9
1001 13
1101
10
1010 15
1111
11
1011 14
1110
12
1100 10
1010
13
1101 11
1011
14
1110 9
1001

15

1111

1000

Fig.1 16PSKconstellation with Gray mapping

3- Determine the error rate


For determining error-rates mathematically, some definitions will be needed:

= Energy-per-bit
= Energy-per-symbol =
with n bits per symbol
= Bit duration
= Symbol duration
No/2 = Noise power spectral density (W/Hz)
= Probability of bit-error

= Probability of symbol-error
Q(x) - give the probability that a single sample taken from a random process
with zero-mean and unit-variance Gaussian probability density function will
be greater or equal to x It is a scaled form of the complementary Gaussian
error function
( )

A-

Symbol error rate

Consider a general M-PSK modulation, where the co-ordinate of each


symbol is:

Consider the symbol on the real axis :

The received symbol :


. Where n is additive noise and follow
Gaussian probability distribution function

( )

with

Symbol error rate is The conditional probability distribution function


(PDF) of received symbol given was transmitted (
)
(

( | )

To derive the symbol error rate, the objective is to find the probability that
the phase of the received symbol lies within this boundary defined by the
magenta lines i.e. from
to
.
For simplifying the derivation, let us make the following assumptions:
(a) The signal to noise ratio, Es/No is reasonably high.

The

real part of the received symbol is not afected by noise

And the Image part


(b) The value of M is reasonably high (typically M >4 suffice)
For a reasonably high value of M, the constellation points are closely spaced. the
distance of the constellation point to the magenta line can be approximated as

( )

The symbol

will be decoded incorrectly, if the imaginary component of

received symbol Y is greater than

. ( )

. //

( ),, calculated by:

. /

Change the variable :

. ( )

we get

. //

( ))

. /

Similarly, The symbol


will be decoded incorrectly, if the imaginary
component of received symbol Y is smaller than
( ) ,, and have
the same probability with (*).

So, the total symbol error rate is

( )-

B- Probability error rate


Relation between bit energy Eb/No to symbol energy Es/No
+ As can be seen from the constellation plot, for a 16PSK modulation, each symbol
transmits
bits. In general, for an M-PSK modulation the number bits in each
constellation symbol is,
.
+ Since each symbol consists of

bits, the symbol to noise

ratio Es/No is k times the bit to noise ratio Eb/No, ie.

Relation between symbol error and bit error


For reasonable symbol to noise ratio

, the symbol will be in error when noise

causes the symbol to fall in the adjacent symbol bin. Now thanks to the Gray
coded mapping, even if the symbol goes into the adjacent symbol there will be
only 1 bit in error from the

bits. So, the relation between symbol error and bit

error is,

Note:
For very low symbol to noise ratio, the noise can cause the symbol to fall into the
non-adjacent symbol bin. This may cause more than 1 bit error for each symbol
error. However, we can ignore this case considering that we are interested only in
reasonably high values of symbol to noise ratio
So , for M = 16, we have : k=

and Total Bit error rate:

4- MATLAB program:
1) Symbol

error

rate

N = 2*10^5; % number of symbols


M = 16;
thetaMpsk = [0:M-1]*2*pi/M; % reference phase values
Es_N0_dB = [0:25]; % multiple Es/N0 values
ipPhaseHat = zeros(1,N);

)-

for ii = 1:length(Es_N0_dB)
% symbol generation
% -----------------ipPhase = randsrc(1,N,thetaMpsk);
ip = exp(j*ipPhase);
s = ip; % normalization of energy to 1
% noise
% ----n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white guassian noise, 0dB variance
y = s + 10^(-Es_N0_dB(ii)/20)*n; % additive white gaussian noise
% demodulation
% -----------% finding the phase from [-pi to +pi]
opPhase = angle(y);
% unwrapping the phase i.e. phase less than 0 are
% added 2pi
opPhase(find(opPhase<0)) = opPhase(find(opPhase<0)) + 2*pi;
% rounding the received phase to the closest
% constellation
ipPhaseHat = 2*pi/M*round(opPhase/(2*pi/M)) ;
% as there is phase ambiguity for phase = 0 and 2*pi,
% changing all phases reported as 2*pi to 0.
% this is to enable comparison with the transmitted phase
ipPhaseHat(find(ipPhaseHat==2*pi)) = 0;
% counting errors
nErr(ii) = size(find([ipPhase- ipPhaseHat]),2); % couting the number of errors
end
simBer = nErr/N;
theoryBer = erfc(sqrt(10.^(Es_N0_dB/10))*sin(pi/M));
close all
figure
semilogy(Es_N0_dB,theoryBer,'bs-','LineWidth',2);
hold on
semilogy(Es_N0_dB,simBer,'mx-','LineWidth',2);
axis([0 25 10^-5 1])
grid on
legend('theory', 'simulation');
xlabel('Es/No, dB')
ylabel('Symbol Error Rate')
title('Symbol error probability curve for 16-PSK modulation')

5a).Simulation results

Fig 2. Symbol error rate curve for 16-PSK modulation'

2) Bit error rate


% Bit Error Rate for 16-PSK modulation using Gray modulation mapping
N = 10^5; % number of symbols
M = 16; % constellation size
k = log2(M); % bits per symbol
thetaMpsk = [0:M-1]*2*pi/M; % reference phase values
Eb_N0_dB = [0:25]; % multiple Es/N0 values
Es_N0_dB = Eb_N0_dB + 10*log10(k);
% Mapping for binary <--> Gray code conversion
ref = [0:M-1];
map = bitxor(ref,floor(ref/2));
[tt ind] = sort(map);
ipPhaseHat = zeros(1,N);
for ii = 1:length(Eb_N0_dB)
% symbol generation
% -----------------ipBit = rand(1,N*k,1)>0.5; % random 1's and 0's
bin2DecMatrix = ones(N,1)*(2.^[(k-1):-1:0]) ; % conversion from binary to decimal

10

ipBitReshape = reshape(ipBit,k,N).'; % grouping to N symbols having k bits each


ipGray = [sum(ipBitReshape.*bin2DecMatrix,2)].'; % decimal to binary
% Gray coded constellation mapping
ipDec = ind(ipGray+1)-1; % bit group to constellation point
ipPhase = ipDec*2*pi/M; % conversion to phase
ip = exp(j*ipPhase); % modulation
s = ip;
% noise
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white guassian noise, 0dB variance
y = s + 10^(-Es_N0_dB(ii)/20)*n; % additive white gaussian noise
% demodulation
% -----------% finding the phase from [-pi to +pi]
opPhase = angle(y);
% unwrapping the phase i.e. phase less than 0 are
% added 2pi
opPhase(find(opPhase<0)) = opPhase(find(opPhase<0)) + 2*pi;
% rounding the received phase to the closest constellation
ipPhaseHat = 2*pi/M*round(opPhase/(2*pi/M)) ;
% as there is phase ambiguity for phase = 0 and 2*pi,
% changing all phases reported as 2*pi to 0.
% this is to enable comparison with the transmitted phase
ipPhaseHat(find(ipPhaseHat==2*pi)) = 0;
ipDecHat = round(ipPhaseHat*M/(2*pi));
% Decimal to Gray code conversion
ipGrayHat = map(ipDecHat+1); % converting to decimal
ipBinHat = dec2bin(ipGrayHat,k) ; % decimal to binary
% converting binary string to number
ipBinHat = ipBinHat.';
ipBinHat = ipBinHat(1:end).';
ipBinHat = str2num(ipBinHat).' ;
% counting errors
nBitErr(ii) = size(find([ipBit- ipBinHat]),2); % couting the number of errors
end
simBer = nBitErr/(N*k);
theoryBer = (1/k)*erfc(sqrt(k*10.^(Eb_N0_dB/10))*sin(pi/M));
close all; figure
semilogy(Eb_N0_dB,theoryBer,'bs-','LineWidth',2);
hold on
semilogy(Eb_N0_dB,simBer,'mx-','LineWidth',2);
axis([0 20 10^-5 1])

11

grid on
legend('theory', 'simulation');
xlabel('Eb/No, dB')
ylabel('Bit Error Rate')
title('Bit error probability curve for 16-PSK modulation')

5b - Simulation Result:

Fig 3. Bit error probability curve for 16-PSK modulation'


Observations
1. The simulated results show good agreement with the theoretical results.
2. For low Eb/No values, we can see that the simulated bit error rate is slightly
higher than that expected by theory. As explained above, this can be attributed to
noise causing symbol to fall into the non-adjacent bin.

12

Reference

1.

The book of Digital communication for


Telecommunication student

2.
3.

13

DSPlog Signal processing for communication


http://en.wikipedia.org/wiki/Phase-shift_keying

Remark: If we only look at the figure from Matlab simulation, we cant see
clearly the different between the Theoretical and Simulation results when n is
significant or negligible (when calculate Ps above, we assumed
).
An Important thing is the y-axiss unit is divided into different value per section ,
i.e:- 10^-5 10^-4 = 0.00001/section
-

10^-4 10^-3 = 0.0001/section


10^-3 10^-2 = 0.001/section
10^-2 10^-1 = 0.01/section
10^-1 10^0 = 0.1/section
Thus, when we look the difference are pretty the same. However, they are
10^n times smaller/greater than each one, in other region.

So, Ive made a zoom on Matlab results and take note the difference on the
table below
Comparison between Theoretical and Simulation result by Calculation
Table 1. Symbol Error Rate (Ps)

12

16

20

7.2

1.52

1.13

0.63

0.19

0.14

24

Theory

Simulate
Different
(*
)

14

0.003

Table 2. Bit Error Rate (Pb)

12

16

25

2.2

0.1

0.016

0.012

Theory

Simulate
Different
(*
)

We can easily see, The more Es increase, the closer


simulation and theoretical results are.

15

You might also like