matlab exercise for wireless communications

Upload: vuhoangquan93

Post on 02-Jun-2018

278 views

Category:

Documents


5 download

TRANSCRIPT

  • 8/10/2019 Matlab Exercise for Wireless Communications

    1/15

    1

    Hanoi University of Science and

    Technology

    Exercise for Wireless

    CommunicationsReport

    Bit error rate for 16PSK modulation

    Symbol error rate for 16PSK modulation

    Comparison Theory vs Simulation using Matlab

    Student name: Hong Tun VID number: 20112477

    Instructor: Mr.Nguyn Vn c

  • 8/10/2019 Matlab Exercise for Wireless Communications

    2/15

    2

    Hanoi , Dec, 8th, 2014

    Table of Contents

    1.Definition 3

    2.Conversion from natural Binary to Gray code 3

    3.Determine the Error rate

    A) Symbol error rate

    B)

    Bit error rate

    4

    5

    7

    4.MATLAB program

    Simulation rusults

    8

    10

    5.

    Observation 12

    6.Reference 13

    7.Remark 14

  • 8/10/2019 Matlab Exercise for Wireless Communications

    3/15

    3

    1 - Definition

    16 PSK is a digital modulation scheme that conveys data by changing, or

    modulating, thephase 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 persymbol, shown in the diagram withGraycodingto minimize thebit error

    rate(BER)

    2 - Conversion from natural Binary to Gray code

    Simple Matlab/Octave code for doing the binary to Gray code conversionip = [0:15]; % decimal equivalent of a four bit binary word

    op = bitxor(ip,floor(ip/2)); % decimal equivalent of the equivalent 4 bit

    gray word

    Table : Natural Binary to Gray code

    Input,

    Dec

    Input,

    Bin

    Gray,

    Dec

    Gray,

    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 110110 1010 15 1111

    11 1011 14 1110

    12 1100 10 1010

    13 1101 11 1011

    14 1110 9 1001

    http://en.wikipedia.org/wiki/Gray_codinghttp://en.wikipedia.org/wiki/Gray_codinghttp://en.wikipedia.org/wiki/Gray_codinghttp://en.wikipedia.org/wiki/Gray_coding
  • 8/10/2019 Matlab Exercise for Wireless Communications

    4/15

  • 8/10/2019 Matlab Exercise for Wireless Communications

    5/15

    5

    = Probability of symbol-error

    Q(x) - give the probability that a single sample taken from a random process

    with zero-mean and unit-varianceGaussian probability density functionwillbe 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 thatthe 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/Nois reasonably high.

    http://en.wikipedia.org/wiki/Normal_distributionhttp://en.wikipedia.org/wiki/Normal_distributionhttp://en.wikipedia.org/wiki/Normal_distribution
  • 8/10/2019 Matlab Exercise for Wireless Communications

    6/15

    6

    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 pointto the magentaline can be approximated as.

    The symbol will be decoded incorrectly, if the imaginary component ofreceived symbol Y is greater than ,, calculated by:

    .

    .//

    ./

  • 8/10/2019 Matlab Exercise for Wireless Communications

    7/15

    7

    Change the variable : we get

    . . // . / Similarly, The symbol

    will be decoded incorrectly, if the imaginary

    component of received symbol Y is smaller than ,, and havethe 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 eachconstellation symbol is,

    .

    + Since each symbol consists of bits, the symbol to noise

    ratioEs/No isktimes the bit to noise ratioEb/No, ie.

  • 8/10/2019 Matlab Exercise for Wireless Communications

    8/15

    8

    .

    Relation between symbol error and bit error

    For reasonable symbol to noise ratio , the symbol will be in error when noisecauses 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 symbolsM = 16;

    thetaMpsk = [0:M-1]*2*pi/M; % reference phase values

    Es_N0_dB = [0:25]; % multiple Es/N0 values

    ipPhaseHat = zeros(1,N);

  • 8/10/2019 Matlab Exercise for Wireless Communications

    9/15

  • 8/10/2019 Matlab Exercise for Wireless Communications

    10/15

    10

    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 symbolsM = 16; % constellation sizek = log2(M); % bits per symbol

    thetaMpsk = [0:M-1]*2*pi/M; % reference phase values

    Eb_N0_dB = [0:25]; % multiple Es/N0 valuesEs_N0_dB = Eb_N0_dB + 10*log10(k);

    % Mapping for binary Gray code conversionref = [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

  • 8/10/2019 Matlab Exercise for Wireless Communications

    11/15

    11

    ipBitReshape = reshape(ipBit,k,N).'; % grouping to N symbols having k bits eachipGray = [sum(ipBitReshape.*bin2DecMatrix,2)].'; % decimal to binary

    % Gray coded constellation mappingipDec = ind(ipGray+1)-1; % bit group to constellation pointipPhase = ipDec*2*pi/M; % conversion to phase

    ip = exp(j*ipPhase); % modulations = ip;

    % noisen = 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 2piopPhase(find(opPhase

  • 8/10/2019 Matlab Exercise for Wireless Communications

    12/15

    12

    grid onlegend('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.

  • 8/10/2019 Matlab Exercise for Wireless Communications

    13/15

    13

    Reference

    1. The book of Digital communication for

    Telecommunication student

    2. DSPlogSignal processing for communication

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

  • 8/10/2019 Matlab Exercise for Wireless Communications

    14/15

    14

    Remark: If we only look at the figure from Matlab simulation, we cant seeclearly the different between the Theoretical and Simulation results when n is

    significant or negligible (when calculate Ps above, we assumed ).An Importantthing is the y-axiss unit is divided into different value per section ,i.e:- 10^-510^-4 = 0.00001/section

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

    -

    10^-310^-2 = 0.001/section

    -

    10^-210^-1 = 0.01/section

    - 10^-110^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 thetable below

    Comparison between Theoretical and Simulation result by Calculation

    Table 1. Symbol Error Rate (Ps)

    0 4 8 12 16 20 24

    Theory Simulate Different

    (*)7.2 1.52 1.13 0.63 0.19 0.14

    0.003

  • 8/10/2019 Matlab Exercise for Wireless Communications

    15/15

    15

    Table 2. Bit Error Rate (Pb)

    0 4 8 12 16Theory

    Simulate Different

    (*) 25 2.2 0.1 0.016 0.012

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

    simulation and theoretical results are.