lab_note4

download lab_note4

of 10

Transcript of lab_note4

  • 8/13/2019 lab_note4

    1/10

    KEEE494: 2nd Semester 2009 Lab 4

    Lab 4: Quadrature Amplitude Modulation

    1 ModulationA quadrature amplitude-modulated (QAM) signal employs two quadrature carriers, cos2fct, sin2fct, each ofwhich is modulated by an independent sequence of information bits. The transmitted signal waveforms have the form

    um(t) = AmcgT(t)cos2fct + AmsgT(t)sin2fct, m= 1, 2,...,M (1)

    where{Amc}and{Ams}are the sets of amplitude. For example, Fig. ?? illustrates a 16-QAM signal constellationthat is obtained by amplitude modulating each quadrature carrier by M = 4 PAM. In general, rectangular signalconstellations result when two quadrature carriers are each modulated by PAM.

    More generally, QAM may be viewed as a form of combined digital amplitude and digital phase modulation. Thus

    the transmitted QAM signal waveforms may be expressed as

    umn(t) = AmgT(t) cos(2fct + n), m= 1, 2,...,M1, n= 1, 2,...,M2 (2)

    IfM1 = 2k1 andM2 = 2

    k2 , the combined amplitude- and phase-modulation method results in the simultaneous

    transmission ofk1+ k2 = log2 M1M2 binary digits occurring at a symbol rate Rb/(k1+ k2).

    It is clear that the geometric signal representation of the signal given by ( ??) and (??) is in the terms of two-

    dimensional signal vectors of the form

    sm= (

    EsAmc

    EsAms), m= 1, 2,...,M (3)

    Examples of signal space constellation for QAM are shown in Fig. ??. Note thatM= 4QAM is identical to M= 4PSK.

    2 Demodulation and Detection of QAM

    Let us assume that a carrier-phase offset is introduced in the transmission of the signal through the channel. In addition,

    the received signal is corrupted by additive white Gaussian noise. Hence,r(t)may be expressed as

    r(t) = AmcgT(t) cos(2fct + ) + AmsgT(t) sin(2fct + ) + n(t) (4)

    whereis the carrier-phase offset and

    n(t) =nc(t)cos2fct ns(t)sin2fct

    The received signal is correlated with the two phase-shifted basis functions

    1(t) = gT(t) cos(2fct + )

    2(t) = gT(t) sin(2fct + ) (5)

    as illustrated in Fig. ??, and the outputs of the correlators are sampled and passed to the detector. The phase-locked

    loop (PLL) shown in Fig.?? estimates the carrier-phase offsetof the received signal and compensates for this phaseoffset by phase shifting1(t)and2(t)as indicated in??. The clock shown in Fig. ?? is assumed to be synchronized

    1

  • 8/13/2019 lab_note4

    2/10

    Figure 1:M=16-QAM signal constellation.

    Serial-to-

    parallel

    converter

    Transmitting

    filter gT(t)

    Transmitting

    filter gT(t)

    Balanced

    modulator

    Balanced

    modulator

    90 o phase

    shift

    Oscillator

    + TransmittedQAM signalBinary

    data

    Figure 2: Functional block diagram of modulator for QAM

    to the received signal so that the correlator outputs are sampled at the proper instant in time. Under these conditions,

    the outputs from the two correlators are

    r1 = Amc+ nccos nssin r2 = Ams+ nccos + nssin (6)

    where

    nc = 12 T0

    nc(t)gT(t) dt

    ns = 1

    2

    T0

    ns(t)gT(t) dt (7)

    The noise components are zero-mean, uncorrelated Gaussian random variable with variance No/2.

    The optimum detector computes the distance metrics

    D(r, sm) =|r sm|2, m= 1, 2,...,M (8)

    2

  • 8/13/2019 lab_note4

    3/10

    Sampler

    Computes

    distance metrics

    D(sm

    )

    Sampler

    X

    X

    X

    X

    90 o phase

    shift

    PLL

    Clock

    gT(t)

    ReceivedSignal Output

    decision

    Figure 3: Demodulation and detection of QAM signal

    where r= (r1, r2)and sm is given by??.

    3 Probability of Error for QAM in an AWGN Channel

    In this section, we consider the performance of QAM systems that employ rectangular signal constellations. Rectan-

    gular QAM signal constellations have the distinct advantage of being easily generated as two PAM signals impressed

    on phase quadrature carriers. In addition, they are easily demodulated. For rectangular signal constellations in which

    M= 2k, wherek is even, the QAM signal constellation is equivalent to two PAM signals on quadrature carriers, eachhaving

    M = 2k/2 signal points. Because the signals in the phase quadrature components are perfectly separated

    by coherent detection, the probability of error for QAM is easily determined from the probability of error for PAM.

    Specifically, the probability of a correct decision for theM-ary QAM system is

    Pc= (1 PM)2 (9)

    wherePMis the probability of error of a

    M-ary PAM with one-half the average power in each quadrature signalof the equivalent QAM systems. By appropriately modifying the probability of error for M-ary PAM, we obtain

    PM = 2

    1 1

    M

    Q

    3

    M1EavNo

    (10)

    whereEav/No is the average SNR per symbol. Therefore, the probability of a symbol error for theM-ary QAM is

    PM= 1(1 PM)2 (11)

    We note that this result is exact for M= 2k

    whenk is even.

    MATLAB Perform a Monte Carlo simulation of an M=16-QAM communication system using a rectangular signalconstellation. The model of the system to be simulated is hown in Fig.??.

    Solution The uniform random number generator (RNG) is used to generate the sequence of information symbols

    corresponding to the 16 possible 4-bit combinations ofb1, b2, b3, b4. The information symbols are mapped intothe corresponding signal points, as illustrated in Fig. ??, which have the coordinates[Amc Ams]. Two Gaussian

    3

  • 8/13/2019 lab_note4

    4/10

    = 64= 32

    = 16

    = 8

    = 4

    Figure 4: Signal space diagram for QAM signals

    RNG are used to generate the noise components [nc ns]. The channel-phase shiftis set to 0 for convenience.Consequently, the received signal-plus-noise vector is

    r= [Amc+ nc Ams+ ns]

    The detector computes the distance metric given by ?? and decides in favor of the signal point that is closest to

    the received vector r. The error counter counts the symbol errors in the detected sequence. Fig. ?? illustrates

    the results of the Monte Carlos simulation for the transmission ofN= 10000symbols at different values of theSNR parameterEb/No, whereEb =Es/4is the bit energy. Also, shown in Fig. ??is the theoretical value ofthe symbol-error probability given by (??) and (??).

    echo on

    SNRindB1=0:2:15;

    SNRindB2=0:0.1:15;

    M=16;

    k=log2(M);for i=1:1:length(SNRindB1),

    smld_err_prb(i)=qam_sim(SNRindB1(i)); % simulated error value

    echo off;

    end;

    echo on;

    for i=1:length(SNRindB2),

    SNR = exp(SNRindB2(i)*log(10)/10); % signal-to-noise ratio

    4

  • 8/13/2019 lab_note4

    5/10

    1

    2

    3

    1 2 3-1-2-3

    -1

    -2

    -3

    Figure 5: Block diagram of an M=16-QAM system for the Monte Carlo simulation

    % theoretical symbol error rate

    theo_err_prb(i)=4*Qfunct(sqrt(3*k*SNR/(M-1)));

    echo off;

    end;

    echo on;% Plotting commands follow.

    semilogy(SNRindB1,smld_err_prb, *)

    hold

    semilogy(SNRindB2,theo_err_prb);

    grid on

    xlabel(E_b/N_o in dB)

    ylabel(Symbol Error Rate)

    5

  • 8/13/2019 lab_note4

    6/10

    function [p]=qam_sim(snr_in_dB)

    % [p]=qam_sim(snr_in_dB)

    % finds the probability of error for the given value of snr_in_dB,

    % SNR in dB.

    N=10000;

    d=1; % min. distance between symbolsEav=10*d2; % energy per symbol

    snr=10(snr_in_dB/10); % SNR per bit (given)

    sgma=sqrt(Eav/(8*snr)); % noise variance

    M=16;

    % Genreation of the data source follows.

    for i=1:N,

    temp=rand;

    dsource(i)=1+floor(M*temp);

    end;

    % Mapping to the signal constellation follows

    mapping=[-3*d 3*d;

    -d 3*d;d 3*d;

    3*d 3*d;

    -3*d d;

    -d d;

    d d;

    3*d d;

    -3*d -d;

    -d -d;

    d -d;

    3*d -d;

    -3*d -3*d;

    -d -3*d;

    d -3*d;

    3*d -3*d];

    for i=1:N,

    qam_sig(i,:)=mapping(dsource(i),:);

    end;

    % received signal

    for i=1:N,

    [n(1) n(2)]=gngauss(sgma);

    r(i,:)=qam_sig(i,:)+n;

    end;

    % detection and error probability calculation

    numoferr=0;

    for i=1:N,% Metric computation follows.

    for j=1:M,

    metrics(j)=(r(i,1)-mapping(j,1))2+ (r(i,2)-mapping(j,2))2;

    end;

    [min_metric decis]=min(metrics);

    if (decis=dsource(i)),

    numoferr=numoferr+1;

    6

  • 8/13/2019 lab_note4

    7/10

    end;

    end; p=numoferr/(N);

    0 5 10 1510

    7

    106

    105

    104

    103

    102

    101

    100

    Eb/N

    oin dB

    SymbolErrorRate

    Figure 6:M = 16-QAM signal constellation for the Monte Carlo simulation

    7

  • 8/13/2019 lab_note4

    8/10

    Lab Homework

    In this homework, we want to perform a Monte Carlo simulation of an M=16-QAM communication systems for theperformance of bit error rate (not a symbol error rate) for the SNR range of SNR=015 dB.

    Use the following hint: For this simulation, you have to generate not only the symbols but also the bits such as

    s0000=[3*d 3*d];

    s0001=[d 3*d];

    s0011=[-d 3*d];

    s0010=[-3*d 3*d];

    s1000=[3*d d];

    s1001=[d d];

    s1011=[-d d];

    s1010=[-3*d d];

    s1100=[3*d -d];

    s1101=[d -d];

    s1111=[-d -d];

    s1110=[-3*d -d];

    s0100=[3*d -3*d];s0101=[d -3*d];

    s0111=[-d -3*d];

    s0110=[-3*d -3*d];

    for i=1:1:N,

    temp=rand;

    if (temp

  • 8/13/2019 lab_note4

    9/10

    dsource1(i)=0;

    dsource2(i)=1;

    dsource3(i)=0;

    dsource4(i)=1;

    elseif (temp

  • 8/13/2019 lab_note4

    10/10

    dsource2(i)=1;

    dsource3(i)=1;

    dsource4(i)=1;

    end;

    end;

    Then, the received signal at the detector for theith symbol (in Matlab form) is

    n(1)=gngauss(sgma);

    n(2)=gngauss(sgma);

    if ((dsource1(i)==0) & (dsource2(i)==0) & (dsource3(i)==0) & (dsource4(i)==0)),

    r=s0000+n;

    elseif ((dsource1(i)==0) & (dsource2(i)==0) & (dsource3(i)==0) & (dsource4(i)==1))

    r=s0001+n;

    elseif ((dsource1(i)==0) & (dsource2(i)==0) & (dsource3(i)==1) & (dsource4(i)==0))

    r=s0010+n;

    elseif ((dsource1(i)==0) & (dsource2(i)==0) & (dsource3(i)==1) & (dsource4(i)==1))

    r=s0011+n;

    elseif ((dsource1(i)==0) & (dsource2(i)==1) & (dsource3(i)==0) & (dsource4(i)==0))r=s0100+n;

    elseif ((dsource1(i)==0) & (dsource2(i)==1) & (dsource3(i)==0) & (dsource4(i)==1))

    r=s0101+n;

    elseif ((dsource1(i)==0) & (dsource2(i)==1) & (dsource3(i)==1) & (dsource4(i)==0))

    r=s0110+n;

    elseif ((dsource1(i)==0) & (dsource2(i)==1) & (dsource3(i)==1) & (dsource4(i)==1))

    r=s0111+n;

    elseif ((dsource1(i)==0) & (dsource2(i)==0) & (dsource3(i)==0) & (dsource4(i)==0)),

    r=s1000+n;

    elseif ((dsource1(i)==1) & (dsource2(i)==0) & (dsource3(i)==0) & (dsource4(i)==1))

    r=s1001+n;

    elseif ((dsource1(i)==1) & (dsource2(i)==0) & (dsource3(i)==1) & (dsource4(i)==0))

    r=s1010+n;

    elseif ((dsource1(i)==1) & (dsource2(i)==0) & (dsource3(i)==1) & (dsource4(i)==1))

    r=s1011+n;

    elseif ((dsource1(i)==1) & (dsource2(i)==1) & (dsource3(i)==0) & (dsource4(i)==0))

    r=s1100+n;

    elseif ((dsource1(i)==1) & (dsource2(i)==1) & (dsource3(i)==0) & (dsource4(i)==1))

    r=s1101+n;

    elseif ((dsource1(i)==1) & (dsource2(i)==1) & (dsource3(i)==1) & (dsource4(i)==0))

    r=s1110+n;

    else

    r=s1111+n;

    end;

    Then, the correlation metrics will be followed.

    10