lab_note3

download lab_note3

of 8

Transcript of lab_note3

  • 8/7/2019 lab_note3

    1/8

    KEEE494: 2nd Semester 2009 Lab 3

    Lab 3: Baseband Digital Transmission

    1. Binary Signal Transmission Each bit is mapped into a corresponding signal waveform according to the rule

    0 s0(t) 0 t Tb1 s1(t) 0 t Tb

    where Tb = 1/R. Received signal over AWGN:

    r(t) = s(t) + n(t), i = 0, 1, 0 t Tbwhere n(t) is AWGN with power spectral density No/2 [W/Hz].

    Optimum Receiver for the AWGN Channel

    X

    X

    DetectorOutput Data

    Sample

    at t=Tb

    Figure 1: Cross-correlation of the received signal r(t) with the two transmitted signals

    Signal Correlator

    r0(t) =

    t0

    r()s0() d

    r1(t) =

    t0

    r()s1() d

    in the interval 0 t Tb, samples the two outputs at t = Tb, and feeds the sampled outputs to thedetector.

    The received signal is

    r(t) = s0(t) + n(t), 0 t TbDetermine the correlator outputs at the sampling instants.

    r0 =

    Tb

    0

    r(t)s0(t) dt

    =

    Tb0

    s20(t) dt +

    Tb0

    n(t)s0(t) dt

    = E+ n0

    1

  • 8/7/2019 lab_note3

    2/8

    and

    r1 =

    Tb0

    r(t)s1(t) dt

    = Tb

    0

    s0(t)s1(t) dt + Tb

    0

    n(t)s1(t) dt

    = n1

    where n0 and n1 are the noise components at the output of the signal correlators, that is,

    n0 =

    Tb0

    n(t)s0(t) dt

    n1 =

    Tb0

    n(t)s1(t) dt

    and E= A2Tb is the energy of the signal s0(t) and s1(t). We also note that the two signal waveformsare orthogonal, that is,

    Tb0

    s0

    (t)s1

    (t) dt = 0

    On the other hand, when s1(t) is the transmitted signal, the received signal is

    r(t) = s1(t) + n(t), 0 t TbIt is easy to show that, in this case, the signal correlator outputs are

    r0 = n0

    r1 = E+ n1

    As derived in the class, we showed that the statistics ofni for i = 1, 2 are given as

    E[ni] = 0

    Var[ni] =EN0

    2

    Therefore, when s0(t) is transmitted, the probability density functions ofr0 and r1 are

    p(r0|s0(t)) = 12

    e(r0E)2/22

    p(r1|s0(t)) = 12

    er2

    1/22

    Matched FilterThe matched filter provides an alternative to the signal correlator for demodulating the received signal r(t).A filter that is matched to the signal waveform s(t), where 0

    t

    Tb

    , has an impulse response

    h(t) = s(Tb t)

    Consequently, the signal waveform-say y(t)-at the output of the matched filter when the input waveformis s(t) is given by the convolutional integral

    y(t) =

    t0

    s()h(t ) d

    2

  • 8/7/2019 lab_note3

    3/8

    If we substitute for h(t ), we obtain

    y(t) =

    t0

    s()s(Tb t + ) d

    and if we sample y(t) at t = Tb, we obtain

    y(Tb) =

    Tb0

    s2(t) dt = E

    where Eis the energy of the signal s(t). Therefore, the matched filter output at the sampling instant t = Tbis identical to the output of the signal correlator.

    [Matched Filter] Consider the use of matched filters for the demodulation of the two signal waveformshown in Fig. 2 and determine the outputs.

    A

    s0(t)

    Tb

    0t

    A

    s1(t)

    Tb

    0t

    -A

    Figure 2: Signal waveforms s0(t) and s1(t) for a binary communication system

    The impulse responses of the two matched filters are

    h0(t) = s0(Tb t)h1(t) = s1(Tb t)

    as illustrated in Fig. 3 Note that each impulse response is obtained by folding the signal s(t) to obtains(t) and then delaying the folded signal s(t) by Tb to obtain s(Tb t).Now suppose the signal waveform s0(t) is transmitted. Then the received signal r(t) = s0(t) + n(t) ispassed through the two matched filters. The response of the filter with impulse response h0(t) to the signalcomponents s0(t) is illusrated in Fig. 4. Also, the response of the filter with impulse response h1(t) to thesignal component s0(t) is illustrated in Fig. 4. Hence, at the sampling instant t = Tb, the outputs of thetwo matched filters with impulse responses h0(t) and h1(t) are

    r0 = E+ n0

    r1 = n1

    respectively. Note that these outputs are identical to the outputs obtained from sampling the signal corre-

    lator outputs at t = Tb.

    Detector

    3

  • 8/7/2019 lab_note3

    4/8

    A

    h0(t)=s

    0(T

    b-t)

    Tb

    0t

    A

    h1(t)=s

    1(T

    b-t)

    Tb

    0t

    -A

    Figure 3: Impulse responses of matched filters for signals s0(t) and s1(t)

    y0(t)

    A2Tb

    Tb

    2Tb

    0t

    y1(t)

    Tb

    2Tb

    A2Tb/2

    -A2Tb/2

    t

    (a) (b)

    Figure 4: Signal outputs of matched filters when s0(t) is transmitted

    The detector output observes the correlator or matched filter outputs r0 and r1 and decides on whether thetransmitted signal waveform is s0(t) and s1(t), which correspond to the transmission of either a 0 or a 1,

    respectively. The optimum detectoris defined as the detector that minimizes the probability of error. Let us consider the optimum detector for the signal with equally probable and equal energies. The optimumdetector for these signals compares r0 and r1 and decides a 0 was transmitted when r0 > r1 and that a 1was transmitted when r1 > r0. Determine the probability of error.

    When s0(t) is the transmitted signal waveform, the probability of error is

    Pe = P(r1 > r0) = P(n1 > E+ n0) = P(n1 n0 > E)Since n1 and n0 are zero-mean Gaussian random variables, their difference x = n1n0 is also zero-meanGaussian. The variance of the random variable x is

    E[x2] = E[(n1 n0)2] = E[n21] + E[n20] 2E[n1n0]But E[n1n0] = 0 because the signal waveforms are orthogonal; that is,

    E[n1n0] = E

    Tb

    0

    Tb

    0

    s0(t)s1()n(t)n()dtd

    =N02

    Tb0

    Tb0

    s0(t)s1()(t ) dtd

    =No2

    Tb0

    s0(t)s1() dt

    = 0

    4

  • 8/7/2019 lab_note3

    5/8

    Therefore,

    E[x2] = 2

    ENo

    2

    = E/N0 =

    2x

    Hence, the probability of error is

    Pe =

    1

    2xE e

    x2/22x

    dx

    =12

    E/No

    ex2/2 dx

    = Q

    E

    No

    (1)

    The ratio E/No is called the signal-to-noise ratio (SNR).

    The derivation of the detector performance given in the example was based on the transmission of the

    signal waveform s0(t). The reader may verify that the probability of error that is obtained when s1(t)is transmitted is identical to that obtained when s0(t) is transmitted. Because the 0s and 1s in the datasequence are equally probable, the average probability of error is given by (1). This expression for the

    probability of error is evaluated by using the MATLAB script given next and is plotted in Fig. 5 as afunction of the SNR, where the SNR is displayed on a logarithmic scale (10log10 E/No). As expected,the probability of error decreases exponentially as the SNR increases.

    0 5 10 1510

    9

    108

    107

    106

    105

    104

    103

    102

    101

    100

    E/No

    [dB]

    Pb

    Figure 5: Probability of Error

    initial_snr=0;

    final_snr=15;

    snr_step=0.25;

    snr_in_dB=initial_snr:snr_step:final_snr;

    for i=1:1:length(snr_in_dB),

    snr=10(snr_in_dB(i)/10);

    5

  • 8/7/2019 lab_note3

    6/8

    Pe(i)=Qfunct(sqrt(snr));

    echo off;

    end;

    echo on;

    semilogy(snr_in_dB,Pe);

    grid on

    xlabel(E/N_o [dB])ylabel(P_b)

    function z=Qfunct(x)

    z = 0.5*erfc(x/sqrt(2));

    Monte Carlo Simulation of a Binary Communication SystemMonte Carlo computer simulations are usually performed in practice to estimate the probability of error

    of a digital communication system, especially in cases where the analysis of the detector performance

    is difficult to perform. We demonstrate the method for estimating the probability of error for the binary

    communication system described above. Use Monte Carlo simulation to estimate and plot Pe versus SNR

    Gaussian random

    number Generator

    +

    +

    Detector

    Gaussian random

    number Generator

    Compare

    Error counter

    Uniform random

    number generator

    Binary

    data source

    Output

    data

    Figure 6: Simulation model

    for a binary communication system that employs correlators or matched filters. The model of the system

    is illustrated in Fig. 6.

    echo on SNRindB1=0:1:12; SNRindB2=0:0.1:12; for

    i=1:length(SNRindB1),

    % simulated error ratesmld_err_prb(i)=ber_smld(SNRindB1(i));

    echo off;

    end; echo on; for i=1:length(SNRindB2),

    SNR=exp(SNRindB2(i)*log(10)/10);

    % theoretical error rate

    theo_err_prb(i)=Qfunct(sqrt(SNR));

    echo off;

    6

  • 8/7/2019 lab_note3

    7/8

    end; echo on;

    % Plotting commands follows

    semology(SNRindB1,smld_err_prb, *); hold

    semilogy(SNRindB2,theo_err_prb);

    function [p]=ber_smld(SNR_in_dB)% [p]=ber_smld(snr_in_dB)

    % BER_SMLD finds the probability of error for the given

    % snr_in_dB, signal-to-noise ratio in dB.

    %

    E=1; SNR=exp(snr_in_dB*log(10)/10);

    sgma=E/sqrt(2*SNR); % sigma, standard deviation of noise

    N=10000;

    % generation of the binary data source

    for i=1:N,

    temp=rand; % a uniform random varialbe over (0,1)

    if (tempr1)

    decis=0; % Decision in "0"

    else

    decis=1; % Decision is "1"

    end;

    if (decis= dsource(i))

    numoferr=numoferr+1; % If it is an error, increase the error counter

    end;

    end;

    p=numoferr/N; % probability of error estimate

    7

  • 8/7/2019 lab_note3

    8/8

    Lab Homework 3

    Suppose that two orthogonal signals shown in Fig. 3 are used to transmit binary information through an AWGN

    channel. the received signal in each bit interval of duration Tb is given by r(t) = si(t) + n(t) for i = 0, 1 and 0 t Tb. Suppose that the received waveform is sampled at a rate of10/Tb-that is, at ten samples per bit interval. Hence,in discrete time, the signal waveform s0(t) with amplitude A is represented by the ten samples (A,A,...,A), and thesignal waveform s1(t) is represented by the ten samples (A,A,A,A,A,A,A,A,A,A). Consequently, thesampled version of the received sequence when s0(t) is transmitted it is

    rk = A + nk, k = 1, 2,..., 10

    and when s1(t) is transmitted it is

    rk =

    A + nk, 1 k 5A + nk, 6 k 10

    where the sequence {nk} is i.i.d. zero mean, Gaussian with each random variable having the variance 2. Writea MATLAB routine that generates the sequence {rk} for each of the two possible received signals, and perform adiscrete-time correlation of the sequence {rk} with each of the two possible signals s0(t) and s1(t) represented bytheir sampled versions for different values of the additive Gaussian noise variance 2 = 0, 2 = 0.1, 2 = 1.0,

    and 2 = 2.0. The signal amplitude may be normalized to A = 1. Plot the correlator outputs at time instantsk = 1, 2, 3, ..., 10.

    8