DSP Lecture 20-21

download DSP Lecture 20-21

of 24

Transcript of DSP Lecture 20-21

  • 7/30/2019 DSP Lecture 20-21

    1/24

    Lectures 20-21 EE-802 ADSP SEECS-NUST

    EE 802-Advanced Digital SignalProcessing

    Dr. Amir A. Khan

    Office : A-218, SEECS

    9085-2162; [email protected]

  • 7/30/2019 DSP Lecture 20-21

    2/24

    Lectures 20-21 EE-802 ADSP SEECS-NUST

    Lecture Outline

    Wrap-up of Last Lecture Linear Filtering Approach to Computation

    of DFT

  • 7/30/2019 DSP Lecture 20-21

    3/24

    Lectures 20-21 EE-802 ADSP SEECS-NUST

    Radix-2 DIT (Complexity Reduction)

    Total computations

    N/2.log2N

  • 7/30/2019 DSP Lecture 20-21

    4/24

    Lectures 20-21 EE-802 ADSP SEECS-NUST

    Radix-2 DIT Bit-reversed Input Ordering

    i/p Indx b2 b1 b0 b2' b1' b0' Bit-reversed orderInput placement

    x[0] 0 0 0 0 0 0 0 0

    x[1] 1 0 0 1 1 0 0 4

    x[2] 2 0 1 0 0 1 0 2

    x[3] 3 0 1 1 1 1 0 6

    x[4] 4 1 0 0 0 0 1 1

    x[5] 5 1 0 1 1 0 1 5x[6] 6 1 1 0 0 1 1 3

    x[7] 7 1 1 1 1 1 1 7

    x[0] goes in location 0; x[1] goes in location 4; x[6] goes in location 3,

  • 7/30/2019 DSP Lecture 20-21

    5/24

    Lectures 20-21 EE-802 ADSP SEECS-NUST

    Radix-2 DIT In-Place Computations

    A = a + WNr b

    B = a - WNr b

    Once (a,b) are used to calculate (A,B), there is no need for (a,b)

    Hence (A,B) results can be saved in the same memory location as (a,b)

    resulting in efficient memory utilization and the name in-place computation

    2N memory registers required

    Condition : inputs (sequence) /outputs (DFT coefficients) be stored in bit-

    reversed order

    a

    b

  • 7/30/2019 DSP Lecture 20-21

    6/24

    Lectures 20-21 EE-802 ADSP SEECS-NUST

    Direct DFT vs FFT Round-up

    Understanding DSP (Lyons)

  • 7/30/2019 DSP Lecture 20-21

    7/24

    Lectures 20-21 EE-802 ADSP SEECS-NUST

    Further Recommended Reading

    Understanding DSP (Lyons) Chapter 4 (Section 4.2: Hints on using FFTs in Practice)*

    Other FFT Algorithms

    Radix-4

    Split Radix FFT

    Other DFT algorithms (Discussion in Next lecture)

    Goertzel Algorithm (Tone-detector)

    Chirp Transform Algorithm

    * Highly recommended

  • 7/30/2019 DSP Lecture 20-21

    8/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    Linear Filtering/Convolution Approach to

    Computation of Fourier Transform

    The Geortzel Algorithm (Oppenheim)

    The Chirp-Transform Algorithm (Oppenheim)

  • 7/30/2019 DSP Lecture 20-21

    9/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    The Goertzel Algorithm

    Suitable if a particular frequency or a small number offrequencies need to be detected

    Algorithm exploits periodicity of phase factors

    Express computation of DFT as a linear filtering operation

    Define

    Using x[n]=0 for nN-1, DFT can be calculated as

    1

    2/2 kjNkNjkN

    N eeW

    1

    0

    1

    0

    1

    0

    ][][][N

    r

    rNk

    N

    N

    r

    kr

    N

    kN

    N

    N

    r

    kr

    N WrxWrxWWrxkX

    r

    rnk

    NkrnuWrxny ][

    Nn

    k nykX

  • 7/30/2019 DSP Lecture 20-21

    10/24

  • 7/30/2019 DSP Lecture 20-21

    11/24

  • 7/30/2019 DSP Lecture 20-21

    12/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    The Goertzel Algorithm-Complexity Reduction

    Complexity

    Real multiplications for poles 2 per input sample

    Real additions for poles 4 per input sample

    Where do we gain then?

    Implementation of zeros 1 complex mult. at Nth iter. 4 real multiplications

    4 real additions

    Total Complexity Poles+Zeros

    2N+4 = 2(N+2) real multiplications

    4N+4 = 4(N+1) real additions

    Multiplications reduced by half as compared to Direct Computation

    vk[n]

    nxnvnvN

    knv kkk

    21

    2cos2

    1][

    NvWNvnykX kk

    NkNn

    k

  • 7/30/2019 DSP Lecture 20-21

    13/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    Single Tone Detection Example (Lyons)

    Tone Detector

    To detect 30 KHz tone.Assume Sampling Frequency fs = 128KHz

    N = 64 point FFT

    Solution

    k = ftone/N fs = 15

    2Cos (2k/N) = 0.196

    -exp(-j2k/N)=-0.098 + j 0.995

  • 7/30/2019 DSP Lecture 20-21

    14/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    DTMF Tone Detection-Goertzel Algorithm

    Dual-Tone Multi Frequency (DTMF) signaling system uses a

    combination of two tones to represent a specific digit, character orsymbol

    1 2 3

    654

    7 8 9

    #0*

    A

    B

    C

    D

    1209Hz 1336Hz 1477Hz 1633Hz

    697Hz

    770Hz

    852Hz

    941Hz

    1 2 3

    654

    7 8 9

    #0*

    A

    B

    C

    D

    1336770770770770 133613361336

    Output

  • 7/30/2019 DSP Lecture 20-21

    15/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    DTMF Tone Detection-Goertzel Algorithm

    For tone detection, use either a filter bank (band-pass filters) or Goertzel

    algorithm (more efficient) Determine the value of k for using Goertzel Algorithm

    Minimum DTMF tone duration required is 40 ms, with a sampling rate of

    8kHz results in 0.04 x 8000 = 320 samples

    Standard DTMF number of samples in input tone, N = 205

    N

    kff sanalysis N

    f

    fk

    s

    tone

    Frequency k

    1633 421477 38

    1336 34

    1209 31

    941 24852 22

    770 20697 18

    Feed-back (pole) section would be repeated N=205 times

    Evaluation of Goertzel algorithm zero equation at k bins

    For detecting presence/absence of tone, we detect only

    the magnitude of the filter output (ignore the phase)

    xnvnvNknv kkk

    212cos2

    1][

    NvWNvnykX kk

    NkNnk

  • 7/30/2019 DSP Lecture 20-21

    16/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    Chirp Transform Algorithm

    Frequency resolution of FFT?

    Same as that of DFT = 2/N, with N the length of the input sequence.

    What should we do if resolution is not sufficient enough for agiven application?

    zero padding is an option

    Potential problem with zero padding? may increase the complexity unnecessarily

    Practically increased resolution is required only for a certain bandof frequencies

    Assume we need to determine the frequency of a sinusoid 0with

    good accuracy from a given N point sequence Compute DFT only around the frequency bins susceptible to

    capture 0 Chirp transform does exactly this job to compute DFT in a

    zoomed region

  • 7/30/2019 DSP Lecture 20-21

    17/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    Chirp Transform Algorithm

    Algorithm does not reduce the computational complexity over FFT

    But, allows computing DTFT over any equally spaced finite set of

    frequencies

    Consider x[n], an N point sequence with DTFT X(ej)

    Evaluate M samples of X(ejw

    ) equally spaced in frequency on theunit circle at frequencies

    Results in DFT when

    w 0 and M = N

    k = 0 + k where k=0,1,.M-1

    = 2k/M

  • 7/30/2019 DSP Lecture 20-21

    18/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    Chirp Transform Algorithm

    DTFT is sampled atw

    =w

    k

    Defining Was

    Chirp transform represents X(ejwk) as a convolution

    By substituting

    Defining

  • 7/30/2019 DSP Lecture 20-21

    19/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    Chirp Transform Algorithm

    Re-formulating for easier interpretation as convolution

    Convolution of g[n] with W-n/2

    Complex exponential with frequencyn

    Linearly increasing frequency signal called chirpused extensively in radars/sonars

  • 7/30/2019 DSP Lecture 20-21

    20/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    Chirp Transform Algorithm-FIR form

    Assuming that g[n] is of finite duration

    W is an infinite duration exponential

    For above equation

    Finite portion of W-n is used for conv

    Over interval n=0 M-1

    Portion of W-n required is

    -(N-1) to M-1

    Defining an FIR filter

  • 7/30/2019 DSP Lecture 20-21

    21/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    Chirp Transform Algorithm-Advantages

    Advantages N = M condition is not required as in FFT

    Neither N nor M needs to be a composite number (they can

    be prime numbers)

    Parameter 0 is arbitrary, thus providing flexibility

    The convolution sum involved in chirp transform can be

    implemented efficiently using FFT with a size

    M+N-1

  • 7/30/2019 DSP Lecture 20-21

    22/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    Chirp Transform with Causal FIR filter

    Non-causal

    Causal

    Delay h[n] by N-1 samples

    The Fourier Transform is thus advancing the output by N-1

  • 7/30/2019 DSP Lecture 20-21

    23/24Lectures 20-21 EE-802 ADSP SEECS-NUST

    Chirp Transform Algorithm - Example

    Example: Suppose we have a finite length sequence x[n] that is

    non-zero over the interval n=0,,25 and we wish to compute16 samples of DFT (Xej) at frequencies k = 2/27 +

    2k/1024 for k = 0,,15

    Solution

    Let M = 16 and N = 26, 0

    = 2/27 and = 2/1024

    For the Causal Impulse Response

    h[n] = [e-j2/1024](n-25)/2 for n=0,.40 (n= 0 to N+M-2)

    Output y[n] will be samples beginning at index n+25

    y[n+25] = X(ejwn)|wn = 2/27 + 2n/1024

    CTA Hi h R l ti N b d F

  • 7/30/2019 DSP Lecture 20-21

    24/24

    CTA- High Resolution Narrowband Frequency

    Analysis