Dsp Processors III

download Dsp Processors III

of 80

Transcript of Dsp Processors III

  • 7/28/2019 Dsp Processors III

    1/80

    DSP PROCESSORS-III

  • 7/28/2019 Dsp Processors III

    2/80

    Module 3

  • 7/28/2019 Dsp Processors III

    3/80

    Syllabus

    Digital Filters

    IIR

    FIR

    Adaptive filters DIT and DIF algorithms

  • 7/28/2019 Dsp Processors III

    4/80

    Discrete-time system

    Discrete-t ime systemhas discrete-time input and output signals

  • 7/28/2019 Dsp Processors III

    5/80

  • 7/28/2019 Dsp Processors III

    6/80

  • 7/28/2019 Dsp Processors III

    7/80

    A discrete-time filter is a discrete-time system that passescertain frequency components and stops others.

    A Digital filter can be either an IIR or FIRfilter.

    An IIRfilter usually requires less cost, i.e., less computationand memory.

    However, an FIRfilter usually has better performance,

    especially in the phase response( a generalized linear phase isrequired).

    Discrete-Time Filters

  • 7/28/2019 Dsp Processors III

    8/80

    IIR filter

    IIR filter have infinite-duration impulseresponses, hence they can be matched to analog

    filters, all of which generally have infinitely longimpulse responses.

  • 7/28/2019 Dsp Processors III

    9/80

  • 7/28/2019 Dsp Processors III

    10/80

    Analysis of Ideal Filters

    Consider an ideal low pass filter.

    Over period (-, ), the frequency response of an ideal low passfilter is defined as

    .

    otherwise,0

    ||),jexp()(H

    c

    Let xi(n)=Aiexp (jin) be a frequency component of the input signal.

    Then, the corresponding output signal of this filter is

    yi(n)=Ai exp (jin) H (i).

    If|i| c, thenyi(n)=Aiexp [ji (n-)].

    ie, xi(n) is passed with a constant delay .

  • 7/28/2019 Dsp Processors III

    11/80

    .

    n,

    n,)n(

    )n(sin

    )n(h

    c

    c

    If|i|>c, thenyi(n)=0.

    ie, xi(n) is stopped.

    The impulse response of the ideal low pass filter is

    Since h(n)0 for n

  • 7/28/2019 Dsp Processors III

    12/80

  • 7/28/2019 Dsp Processors III

    13/80

    Prototype Analog Filters

    IIR filter design techniques rely on existing analogfilters to obtain digital filters.

    We designate these analog filters asprototype filters.

    The prototypes widely used in practice

    Butterworth lowpass Chebyshev lowpass (Type I and II)

  • 7/28/2019 Dsp Processors III

    14/80

    Butterworth Lowpass Filter

    This filter is characterized by the property that itsmagnitude response is flatin both passband and

    stopband.

    Moderate phase distortion

    N

    c

    a jH 22

    1

    1|)(|

    The magnitude-squared response of an N-order lowpassfilter

  • 7/28/2019 Dsp Processors III

    15/80

    0 10 20 30 40 50 60 70 80 90 1000

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    N=1

    N=2

    N=200

    N=100

    Plot of the magnitude-squared response

  • 7/28/2019 Dsp Processors III

    16/80

    Properties of Butterworth Filter

    Magnitude Response

    |Ha(0)|2 =1

    |Ha(jc) |2 =0.5, for all N

    |Ha(j)|2monotonically decrease for Approaches to ideal filter when N

  • 7/28/2019 Dsp Processors III

    17/80

  • 7/28/2019 Dsp Processors III

    18/80

    Chebyshev Lowpass Filter

    Chebyshev -I filtersHave equirippleresponse in thepassband

    Chebyshev -II filtersHave equirippleresponse instopband

    Butterworth filters

    Have monotonic response in both bands

    We note that by choosing a filter that has an equripple ratherthan a monotonic behavior, we can obtain a low-orderfilter.

    (The maximum delay, in samples, used in creating eachoutput sample is called the orderof the filter )

    Therefore Chebyshev filters provide lower orderthan

    Buttworth filters for the same specifications.

  • 7/28/2019 Dsp Processors III

    19/80

    Chebyshev -I filters

    Chebyshev -II filters

  • 7/28/2019 Dsp Processors III

    20/80

    The magnitude-squared response of Chebyshev -I filter

    xx

    xxNxT

    T

    jH

    N

    c

    N

    a

    1)),(cosh(cosh

    10)),(coscos()(

    1

    1|)(|

    1

    1

    22

    2

    N is the order of the filter, Epsilon is the passband ripple factor

    (a) For 0

  • 7/28/2019 Dsp Processors III

    21/80

  • 7/28/2019 Dsp Processors III

    22/80

    Observations

    At x=0 (or =0);

    |Ha(j0)|2 = 1; for N odd;

    = 1/(1+2); for N even

    At x=1 (or = c);

    |Ha(j1)|2 =1/(1+2);for all N.

    For 0

  • 7/28/2019 Dsp Processors III

    23/80

  • 7/28/2019 Dsp Processors III

    24/80

  • 7/28/2019 Dsp Processors III

    25/80

  • 7/28/2019 Dsp Processors III

    26/80

    Impulse Invariance Transformation

    The digital filter impulse response look similar to that of a frequency-selective analog filter.

    basic principle is sampling of impulse response of an analog filter

    Sample ha(t) at some sampling interval T to obtain h(n)

    h(n)=ha(nT)

    Sincez = e jwon the unit circle ands = j on the imaginary axis,we have the following transformation from thes-plane to thez-plane:

    z=e sT

    also,

    and

    Tjjw eeorTw

    k

    ak

    T

    jsH

    T

    zH21

    )((Frequency-domainaliasing

    formula)

  • 7/28/2019 Dsp Processors III

    27/80

    Complex-plane mapping in impulse invariance transformation

  • 7/28/2019 Dsp Processors III

    28/80

    Properties:

    Sigma < 0, maps into |z| 0, maps into |Z| >1 (outside of the Unit circle)

    Causality and Stability are the same without changing Aliasing occur if filter not exactly band-limited

    Let digital lowpass filter specifications be wp ws Rp and As

  • 7/28/2019 Dsp Processors III

    29/80

    Let digital lowpass filterspecifications be wp,ws,Rp and As.

    To determine H(z) , first design an equivalent analog filter and then

    mapping it into the desired digital filter.

    Design Procedure:

    1. Choose Tand determine the analog frequencies:

    p =wp/T, s = ws/T

    2. Design an analogfilter Ha(s) using the specifications with one of theprototypes of the previous section.

    3. Using partial fraction expansion, expand Ha(s) into

    4. Now transform analog poles {pk} into digital poles {epkT} to obtain the

    digital filter

    Nk

    k

    ka

    ps

    RsH

    1)(

    N

    k Tp

    k

    ze

    RzH

    k1 1

    1

    )(

    Ad

  • 7/28/2019 Dsp Processors III

    30/80

    Advantages

    It is astable design and the frequencies and w are linearlyrelated.

    Disadvantage

    We should expect some aliasingof the analog frequencyresponse, and in some cases this aliasing is intolerable.

    This design method is useful only when the analog filter isessentially band-limited to a lowpass or band pass filter in

    which there are no oscillations in the stopband.

    i i f i

  • 7/28/2019 Dsp Processors III

    31/80

    Bilinear Transformation

    transforms continuous-time system representationsto discrete-time and vice versa

    This mapping is the besttransformation method.

    It maps positions on the j axis, in the s-plane to theunit circle in the z-plane

    For every feature in the frequency response of the analogfilter, there is a corresponding feature, with identical gain

    and phase shift, in the frequency response of the digital

    filter basic principle: application of the trapezoidal formula for

    numerical integration of differential equation

    2/1

    2/1

    1

    121

    1

    sT

    sT

    zz

    z

    Ts

  • 7/28/2019 Dsp Processors III

    32/80

    Complex-plane mapping in bilinear transformation

  • 7/28/2019 Dsp Processors III

    33/80

    Observations

    Sigma < 0|z| < 1,

    Sigma = 0|z| = 1,

    Sigma > 0|z| > 1

    The entire left half-plane maps into the inside of theUnit circle. This is a stabletransformation.

    The imaginary axis maps onto the Unit circle in aone-to-one fashion. Hence there is no aliasingin the

    frequency domain.

    Relation of to is nonlinear = 2tan-1(T/2) = 2tan(/2)/T;

    Given the digital filter specifications wp ws Rp and As we want to

  • 7/28/2019 Dsp Processors III

    34/80

    Given the digital filter specifications wp,ws,Rp and As, we want to

    determine H(z).

    The design steps:

    1. Choose a value forT. this is arbitrary, and we may set T = 1.

    2. Prewarp the cutoff freq. wp and ws;

    ie, calculate p and s usingp = 2/T*tan(wp/2), s = 2/T*tan(ws/2)

    3. Design an analog filter Ha(s) to meet the specifications.

    4. Finally set

    And simplify to obtain H(z) as a rational function in z-1

    1

    1

    112)(

    zz

    THzH a

  • 7/28/2019 Dsp Processors III

    35/80

    Advantage of the bilinear Transformation

    It is a stable design There is no aliasing

    There is no restriction on the type of filter that canbe transformed.

    FIR FILTER

  • 7/28/2019 Dsp Processors III

    36/80

    FIR FILTER

    A finite impulse response filter is a type of a digital filter.

    The impulse response is 'finite' because it settles to zero ina finite number of sample intervals. The impulse response of an Nth order FIR filter lasts for

    N+1 samples, and then dies to zero.

    Properties: Inherently stable - all the poles are located at the origin

    and thus are located within the unit circle.

    Require no feedback- any rounding errors are notcompounded by summed iterations. This also makesimplementation simpler.

    can be designed to be linear phase - which means the phasechange is proportional to the frequency.

    Disadvantage:

  • 7/28/2019 Dsp Processors III

    37/80

    Disadvantage:

    considerably more computation power is required comparedwith a similar IIR filter.

    This is especially true when low frequencies are to be affected

    by the filter.

    Design methods:

    Window design method Frequency Sampling method Weighted least squares design

    Minimax design Equiripple design

  • 7/28/2019 Dsp Processors III

    38/80

    Window design method

    Simplest FIR filter design is window function technique Specific window should be chosen according to desiredconstraints

    the impulse response of the causal FIR filter isobtained by windowing the ideal filter.

  • 7/28/2019 Dsp Processors III

    39/80

    windowing hd(n), we can obtain the impulse response of a

    causal FIR lowpass filter. ie,

    h(n) = hd(n) w(n)

    where w(n) is a window function and is equal to 0 for n

  • 7/28/2019 Dsp Processors III

    40/80

  • 7/28/2019 Dsp Processors III

    41/80

    Window functions

    The rectangular window is defined as

    .otherwise,0

    1Nn0,1)n(w

    The Bartlett window is defined as

    .

    otherwise,0

    1Nn1)/2(N),1N/(n22

    2/)1N(n0),1N/(n2

    )n(w

  • 7/28/2019 Dsp Processors III

    42/80

    .otherwise,0

    1Nn0,

    1N

    n2cos5.05.0

    )n(w

    The Hamming window is defined as

    .

    otherwise,0

    1Nn0,1Nn2cos46.054.0

    )n(w

    The Blackman window is defined as

    .

    otherwise,0

    1Nn0,1N

    n4cos08.0

    1N

    n2cos5.042.0

    )n(w

    The Hann window is defined as

  • 7/28/2019 Dsp Processors III

    43/80

    Bartlett WindowRectangular Window

    Hann Window

  • 7/28/2019 Dsp Processors III

    44/80

    Blackman Window

    Hamming Window

  • 7/28/2019 Dsp Processors III

    45/80

    It can be seen that when the length of the window is fixed, a narrow

    transition band corresponds to large ripples

    Type of Window

    Width of

    Transition Band

    Peak Amplitude

    of Ripples

    Rectangular 4/N -21dB

    Bartlett 8/(N-1) -25dB

    Hann 8/(N-1) -44dBHamming 8/(N-1) -53dB

    Blackman 12/(N-1) -74dB

    Features of Commonly Used Windows.

  • 7/28/2019 Dsp Processors III

    46/80

    The Kaiser window is defined as

    .

    otherwise0,

    1Nn0,)(I

    1

    1N

    n21I

    )n(w

    0

    2

    0

    Here, I0() is the zero-order modified Bessel function of the first kindand is a shape parameter.

    should be selected to obtain a good tradeoff between the width of

    the transition band and the amplitudes of the ripples.

  • 7/28/2019 Dsp Processors III

    47/80

    The windowing method is carried out in the following

    steps:

    1. Determine the type of the window according to the

    specification for the amplitudes of the ripples.

    2. Find the length of the window according to the

    specification for the width of the transition band.

    3. Find

    4. Determine the impulse response of the causal FIR lowpass

    filter

    Ad ti filt

  • 7/28/2019 Dsp Processors III

    48/80

    Adaptive filter An adaptive filter is a filter that self-adjustsits

    transfer function according to an optimizingalgorithm.

    Because of the complexity of the optimizingalgorithms, most adaptive filters are digital filters

    that perform digital signal processing and adapt theirperformance based on the input signal.

    In IIR and FIR filters process parameters are

    known in advance or variation is assumed to beknown

    Adaptive filters are best suited when signalconditions are slowly changing or there is large

    uncertainty and filter has to compensate for that

    Basic adaptive filter:

  • 7/28/2019 Dsp Processors III

    49/80

    Here the adaptive filter output y is compared with adesired signal d to yield a error signal e which is fed

    back to adaptive filterCoefficients of adaptive filter is adjusted or optimized

    using a least mean square algorithm based on theerror signal

    Adaptive filter

    d

    x

    +

    -

    e

    y

    p

    Output of adaptive filter:

  • 7/28/2019 Dsp Processors III

    50/80

    p p

    y(n)= wk(n) x(n-k)

    where wk(n) represent N weights for a specific time n.

    The performance measure is based on the error signal.

    The error signal, e(n) = d(n)-y(n)

    The weights of wk(n) are adjusted such that a mean squared

    error function is minimized

    Mean square error function is E[e2

    (n)],where E represents theexpected value

    K=0

    N-1

    Least mean square algorithm:

  • 7/28/2019 Dsp Processors III

    51/80

    Least mean square algorithm:

    The simple and effective means of updating the weightswithout averaging or differentiating

    Wk(n+1) = wk(n)+2e(n). x(n-k) , k=0,1,,N-1Where x(n) is the input and is adaptive step size.

    For each time n, weight wk(n) is updated or replaced bynew coefficients, unless the error function is zero.

    After the output y(n), error signal e(n) and wk(n) areupdated for a specific time n, new sample is taken and theadaptation process is repeated

    Applications of adaptive filters

  • 7/28/2019 Dsp Processors III

    52/80

    Applications of adaptive filters

    Noise cancellation

    Signal prediction

    Adaptive feedback cancellation

    Echo cancellation

    For noise cancellation:

  • 7/28/2019 Dsp Processors III

    53/80

    For noise cancellation:

    The basic adaptive structure is modified for a noisecancellation system

    Adaptive filter

    d+n

    n

    +

    -

    e

    The desired signal d is corrupted by noise n.

    The input to the adaptive filter is noise n that is correlated with noise n (noise

    n could come from same source as n but modified by environment) The output y is adapted to noise n

    When this happens the error signal approaches to desired signal d.

    The overall output is e and not the adaptive filter output y.

    y

    For system identification:

  • 7/28/2019 Dsp Processors III

    54/80

    y

    The same input u is given to the unknown system (plant) and to theadaptive filter.

    The error signal e is the difference between response d and the filter

    output y. The error signal e is fed to the adaptive filter and is used to update thefilter coefficients, until y = d

    When this happens the adaption process is finished and e approaches tozero.

    Thus the unknown system is modeled.

    Signal Prediction:

  • 7/28/2019 Dsp Processors III

    55/80

    Signal Prediction: Used to provide a prediction of the present value of a random signal

    This is like interference cancellation, but the adaptive filter uses adelayed version of the primary signal as the reference.

    Parameters

    u = input of adaptive filter = delayed version of random signal

    y = output of adaptive filter

    d = desired response = random signal

    e = d - y =estimation error = system output

    DFT

  • 7/28/2019 Dsp Processors III

    56/80

    DFT

    The discrete Fourier transform (DFT) is one of the

    specific forms of Fourier analysis.

    It transforms one function into another, which is calledthefrequency domain representation of the original

    function (the time domain).

    IDFT does the inverse operation

    But the DFT requires an input function that is discrete andwhose non-zero values have a limited (finite) duration.

    Such inputs are often created by sampling a continuousfunction, like a person's voice

  • 7/28/2019 Dsp Processors III

    57/80

  • 7/28/2019 Dsp Processors III

    58/80

    The FFT is based on the divide-and-conquer paradigm

  • 7/28/2019 Dsp Processors III

    59/80

  • 7/28/2019 Dsp Processors III

    60/80

  • 7/28/2019 Dsp Processors III

    61/80

  • 7/28/2019 Dsp Processors III

    62/80

  • 7/28/2019 Dsp Processors III

    63/80

  • 7/28/2019 Dsp Processors III

    64/80

  • 7/28/2019 Dsp Processors III

    65/80

  • 7/28/2019 Dsp Processors III

    66/80

  • 7/28/2019 Dsp Processors III

    67/80

  • 7/28/2019 Dsp Processors III

    68/80

  • 7/28/2019 Dsp Processors III

    69/80

  • 7/28/2019 Dsp Processors III

    70/80

    The DIF FFT is the transpose of the DIT FFT

  • 7/28/2019 Dsp Processors III

    71/80

    The DIF FFT is the transposeof the DIT FFT

    To obtain flowgraph transposes:

    Reverse direction of flowgraph arrows Interchange input(s) and output(s)

    DIT butterfly: DIF butterfly:

    Comparing DIT and DIF structures:

  • 7/28/2019 Dsp Processors III

    72/80

    Comparing DIT and DIF structures:

    DIT FFT structure: DIF FFT structure:

    Steps involved in DIF FFT algorithm:

  • 7/28/2019 Dsp Processors III

    73/80

    Data shuffling not required N=2p & input is separated into two parts .

    The first set consists of first N/2 input samples with n ranging from0 to N/2-1

    Second set consists of the remaining N/2 input samples with n

    ranging from N/2 to N-1

    X(k) is decimated into even & odd numbered points (DIF)decomposing an N point DFT into 2 N/2Point DFTs

    The procedure is repeated till we get a 2-point DFT.

    The 2-point DFT is then converted to butterfly to get the completestructure.

  • 7/28/2019 Dsp Processors III

    74/80

  • 7/28/2019 Dsp Processors III

    75/80

  • 7/28/2019 Dsp Processors III

    76/80

    DIF or DIT?

  • 7/28/2019 Dsp Processors III

    77/80

    In terms of computational work load, both perform exactlythe same number of butterflies.

    Each butterfly requires exactly one complex multiply andtwo complex adds.

    The most significant difference between simple DIF

    and DIT algorithms is that DIF starts with normalorder input and generates bit reversed order output.

    In contrast, DIT starts with bit reversed orderinput and generates normal order output.

    So use DIF for the forward transform and DIT forthe inverse transform

    Advantages:

  • 7/28/2019 Dsp Processors III

    78/80

    g

    (i) Reasonably good saving in terms of computation, i.e. it

    is efficient

    (ii) Short Program required

    (iii) Easy to understand

    Disadvantages:

    (i) A relatively large number of operations still required,

    especially multiplications

    (ii) Problem of the generation of WNfor n=0,1,2,N-1.

    Applications of FFT

  • 7/28/2019 Dsp Processors III

    79/80

    Applications of FFT

    Linear convolution

    (1) Append zeros to the two sequences of lengthsNand

    M, to make them of lengths an integer power of two

    that is larger than or equal toM+N-1.(2) Apply FFT to both zero appended sequences

    (3) Multiply the two transformed domain sequences

    (4) Apply inverse FFT to the new multiplied sequence

  • 7/28/2019 Dsp Processors III

    80/80

    THE END