07 Dft Fft Release

download 07 Dft Fft Release

of 55

Transcript of 07 Dft Fft Release

  • 8/13/2019 07 Dft Fft Release

    1/55

    Curtin University, Australia 7-1YH Leung (2005, 2006, 2007, 2008, 2012)

    THE DFT AND FFT

    1 The Discrete Fourier Transform (DFT)

    Recall discrete-time Fourier transform DTFT of a sequence [ ]x n defined by

    q q

    -

    =-

    = ( ) [ ]j jnn

    X e x n e (1)

    In practice, record length of [ ]x n usually finite. Suppose [ ]x n has length N,

    and with no loss of generality, suppose = -0, , 1n N . It then follows

    q q-

    -

    =

    = 1

    0

    ( ) [ ]N

    j jn

    n

    X e x n e (2)

    Next, suppose we know q( )jX e but not [ ]x n . It can be shown, since [ ]x n

    has length N, it is sufficientto know only q( )jX e , at Ndistinct frequency points

    q q -0 1, , N in the interval [ )0, 2q p , to determine [ ]x n1

    Discrete Fourier transform(DFT) defined by choosing q p= 2k k N, i.e.,

    12

    0

    [ ] [ ] , 0, , 1N

    j nk N

    n

    X k x n e k Np-

    -

    =

    = = - (3)

    Inverse DFT(IDFT) given by

    12

    0

    1[ ] [ ] , 0, , 1

    Nj nk N

    k

    x n X k e n NN

    p-

    +

    =

    = = - (4)

    DFT is simply DTFT of a length Nsequence, evaluated at

    Nequally-spaced frequency points

    1Basically, we need N equations to find N unknowns where the unknowns are [ ]x n . The resulting

    system of equations is assured to be consistent if q q -0 1, , N are distinct

  • 8/13/2019 07 Dft Fft Release

    2/55

    Curtin University, Australia 7-2YH Leung (2005, 2006, 2007, 2008, 2012)

    DFT is just another sequence of numbers. We put its argument in square

    brackets

    Appendix I shows DTFT q( )jX e can be recovered from DFT [ ]X k by

    interpolation:

    ( )( )

    2 1212 2

    20 2

    sin1( ) [ ]

    sin

    k NN kN jj N

    N kk N

    X e X k eN

    pq p qq

    q p

    - - - - -

    -=

    = (5)

    WARNINGA fundamental result in signal theory states a signal cannot be bandlimited

    and time-limited at the same time

    \ If ( )x t is time limited, then its sampling rate should be infinite. Alternatively,

    if ( )x t is bandlimited, then its sample sequence must have infinite length

    Great care must be exercised in using and interpreting the DFT

    The DFT Eq. (3) can be written in vector-matrix notation as follows

    2 2 2

    2 2 2

    2 2 2

    2 ( 1)

    2 4 2( 1)

    ( 1) 2( 1) ( 1)( 1)

    1 1 1 1[0] [0]

    1[1] [1]

    [2] [2]1

    [ 1] [ 1]1

    N N N

    N N N

    N N N

    j j j N

    j j j N

    j N j N j N N

    X x

    e e eX x

    X xe e e

    X N x Ne e e

    p p p

    p p p

    p p p

    - - - -

    - - - -

    - - - - - - -

    = - -

    (6)

    Matrix above called DFT matrix

    Above representation useful in analysis of signal processing systems which

    involve on-line calculation of the DFT (e.g. filterbanks and OFDM)

    Exercise. Express the IDFT Eq. (4) in vector-matrix notation. Corresponding

    matrix is called IDFT matrix

  • 8/13/2019 07 Dft Fft Release

    3/55

    Curtin University, Australia 7-3YH Leung (2005, 2006, 2007, 2008, 2012)

    Recall definition of DFT Eq. (3)

    p-

    -

    =

    = = - 1

    2

    0

    [ ] [ ] , 0, , 1N

    j nk N

    n

    X k x n e k N

    Suppose [ ]x n is specified for , ( 1), , ( 1)o o on n n n N = + + - . Definition of

    N-point DFT can be generalised as follows

    p

    + --

    =

    = = - 1

    2[ ] [ ] , 0, , 1o

    o

    n Nj nk N

    n n

    X k x n e k N (7)

    But

    p p ++ - -

    - -

    = == +

    ( )1 12 2

    0[ ] [ ]

    n m ko onkN N

    o

    n N Nj j

    on n mx n e x n m e

    p p p+

    -- -

    --

    = =

    = +1

    21

    0

    2 2[ ] [ ]

    o nk n ko nN

    o

    kN N

    Nj j

    on

    n Nj

    n n

    e x n n ex n e

    Therefore2

    [ ] [ ]n koN

    jX k e X k

    p-= (8)

    where { }1

    2

    0

    [ ] DFT [0], , [ 1] [ ]nkN

    Nj

    n

    X k x x N x n e p

    --

    =

    = - = (9)

    and = + = -[ ] [ ], 0, , 1ox n x n n n N (10)

    It can be readily verified inverse of generalised DFT given by

    { }1

    2

    0

    1[ ] [ ] [ ]

    Nj nk N

    ok

    x n n x n X k eN

    p-

    +

    =

    + = =

    1 2 2

    0

    [ ] [1

    [ ] , 0] , , 1n koN

    N j jo

    nk N

    k

    X k e e Nx n nx nN

    n p p

    -+

    =

    = = -

    + =

    (11)

    In view of Eq. (8), in the sequel we shall assume, with no loss of generality, that

    all sequences start at 0n=

  • 8/13/2019 07 Dft Fft Release

    4/55

    Curtin University, Australia 7-4YH Leung (2005, 2006, 2007, 2008, 2012)

    2 Properties of the DFT

    DFT is a finite sum, therefore always converge

    Since [ ]x n is finite-valued by assumption, [ ]X k also finite-valued

    DFT of a sequence is unique, i.e., given a length Nsequence [ ]x n , there is

    one and only one N-point DFT [ ]X k

    Since DTFT is periodic, so [ ]X k also periodic, with period N

    + = [ ] [ ],X k mN X k m (12)

    In practice, range of [ ]X k restricted to { } -0,1, , 1k N

    Inverse DFT also periodic with period N. Define

    p-

    +

    =

    = 1

    2

    0

    1[ ] [ ] ,

    Nj nk N

    k

    x n X k e nN

    (13)

    Can readily verify that

    + = [ ] [ ],x n mN x n m (14)

    and by uniqueness

    = = - [ ] [ ], 0, , 1x n x n n N (15)

    [ ]x n isperiodic extension of [ ]x n

    Fig. 1 Periodic extension

    0 N-1

    0 N-1

    [ ]x n

    [ ]x n

  • 8/13/2019 07 Dft Fft Release

    5/55

    Curtin University, Australia 7-5YH Leung (2005, 2006, 2007, 2008, 2012)

    Denote moda b byb

    a such that

    =[ ] [ ]N

    x n x n (16)

    Suppose [ ]x n and [ ]y n both have length N with DFTs [ ]X k and [ ]Y k

    respectively

    DFT

    [ ] [ ]x n X k

    DFT

    [ ] [ ]y n Y k

    Linearity + +DFT

    [ ] [ ] [ ] [ ]ax n by n aX k bY k

    Time shifting p-- DFT 2

    [ ] [ ] oj kn N

    o Nx n n X k e

    Frequency shiftingp -

    DFT2[ ] [ ]oj k n N o Nx n e X k k

    Conjugation * * -DFT

    [ ] [ ]N

    x n X k

    Time reversal * *- DFT

    [ ] [ ]N

    x n X k

    Circular convolution-

    =

    - 1

    DFT

    0

    [ ] [ ] [ ] [ ]N

    Nm

    x m y n m X k Y k

    Multiplication-

    =

    -1

    DFT

    0

    1[ ] [ ] [ ] [ ]

    N

    Nm

    x n y n X m Y k mN

    x n[ ] real *= -[ ] [ ]N

    X k X k

    x n[ ] real { } { }= -Re [ ] Re [ ]NX k X k

    x n[ ] real { } { }= - -Im [ ] Im [ ]NX k X k

    Parsevals relation- -

    = =

    = 1 1

    2 2

    0 0

    1[ ] [ ]

    N N

    n k

    x n X kN

    Duality -DFT[ ] [ ]N

    X n Nx k

    Note, for -0 ( 1)n N , - = -Nn N n

  • 8/13/2019 07 Dft Fft Release

    6/55

    Curtin University, Australia 7-6YH Leung (2005, 2006, 2007, 2008, 2012)

    3 Circular Convolution

    Suppose [ ]x n and [ ]y n both have length N

    The N-point circular convolution (or cyclicconvolution) of [ ]x n and [ ]y n is

    defined by

    1

    0

    [ ] [ ] [ ] [ ] [ ]NN

    Nm

    w n x n y n x m y n m-

    =

    = = - (17)

    where N denotes N-point circular convolution

    Example 1 { }3 01, 1, 0, 2 nx == - { } == 3 01, 0, 3, 2 ny

    First note that: 4 4 4 4 4 4 4 4 4 4 45 4 3 2 1 0 1 2 3 4 5

    3 0 1 2 3 0 1 2 3 0 1

    - - - - -

    Therefore

    0n= 4 4 4 4 4

    4

    0 1 2 3

    [ ] 1 1 0 2

    [ ] [ 0 ] [0] 1 [ 1 ] [3] 2 [ 2 ] [2] 3 [ 3

    [

    ] [1] 0

    [ ] [ ] 1 2 0 0

    0

    0

    0

    ]

    1

    m

    x m

    y m y y y y y y y y

    x m y m

    w

    -

    - = = - = = - = = = =

    - - -

    -

    1n = 4 4 4 4 4

    4

    0 1 2 3

    [ ] 1 1 0 2

    [ ] [ 1 ] [1] 0 [ 0 ] [0] 1 [ 1 ] [3] 2 [ 2

    [

    ]

    1

    [2] 3

    [ ] [

    1

    ] 0 1 0 6

    ]

    1 5

    m

    x m

    y m y y y y y y y y

    x m y m

    w

    -

    - = = = = - = = - = =

    - -

    2n= -

    - = = = = = = - = =

    -4 4 4 4 4

    4

    0 1 2 3

    [ ] 1 1 0 2

    [ ] [ 2 ] [2] 3 [ 1 ] [1] 0 [ 0 ] [0] 1 [ 1 ]

    2

    2 [3] 2

    [ ] [ ] 3 0 0

    ]

    4

    [

    2 7

    m

    x m

    y

    w

    m y y y y y y y y

    x m y m

    3n= 4 4 4 4 4

    4

    0 1 2 3

    [ ] 1 1 0 2

    [ ] [ 3 ] [3] 2 [ 2 ] [2] 3 [ 1 ] [1] 0

    [

    [ 0 ] [0] 1

    [ ] [ ] 2 3 0 2

    3

    1

    3

    3

    ]m

    x m

    y m y y y y y y y y

    x

    w

    m y m

    -

    - = = = = = = = =

    - -

    4n= -

    - = = = = = = = =

    - - -4 4 4 4 4

    4

    0 1 2 3

    [ ] 1 1 0 2

    [ ] [ 4 ] [0] 1 [ 3 ] [3

    4

    4 ] 2 [ 2 ] [2] 3 [ 1 ] [1] 0

    [ ] [ ] 14 0

    [ ]

    0 12

    m

    x m

    y m y y y y y y y y

    m y m

    w

    x

    Observe circular shiftingof { }3

    4 0[ ]

    my n m

    =- as nincreases

  • 8/13/2019 07 Dft Fft Release

    7/55

    Curtin University, Australia 7-7YH Leung (2005, 2006, 2007, 2008, 2012)

    Example 1 shows [ ]w n is periodic with period N. Follows since, for any k

    1 1

    0 0

    [ ] [ ] [ ( ) ] [ ] [ ] [ ]N N

    N Nm m

    w n kN x m y n kN m x m y n m w n- -

    = =

    + = + - = - = (18)2

    By convention, range of [ ] [ ] [ ]Nw n x n y n= is restricted to { }0,1, , 1n N -

    Circular convolution has another interpretation

    1

    0

    [ ] [ ] [ ] [ ] [ ] , 0, , 1NN

    m

    w n x n y n x m y n m n N -

    =

    = = - = - (19)

    where [ ]y n is periodic extension of [ ]y n

    Circular convolution equivalent to finding linear convolution of [ ]x n with periodic

    extension of [ ]y n and then keeping only first Npoints

    Fig. 2 Circular convolution as linear convolution with periodic extension

    As can be seen, for any given n, [ ]N

    y n m- and [ ]y n m- have same data

    points in summation region (yellow), thus explaining equivalence

    2 Alternatively, from circular convolution property of DFTs, since [ ]w n is inverse DFT of N-point DFT

    [ ] [ ] [ ]W k X k Y k = , therefore, by Eq. (13), [ ]w n is periodic with period N

    [ ]x m

    [ ]y m

    [ 1 ]N

    y m-

    [ ]y m

    [1 ]y m-

    [ ]N

    y m- [ ]y m-

    0n=

    1n =

    m

    m

    m

    m

    m

    m

    m

    [ 2 ]N

    y m- [2 ]y m-

    2n=

    m m

    0

    0 0

    0

    0

    00

    0

    0 1N-

    1N- 1N-

    1N-

    1N-

    1N-

    1N-1N-

    1N-

  • 8/13/2019 07 Dft Fft Release

    8/55

    Curtin University, Australia 7-8YH Leung (2005, 2006, 2007, 2008, 2012)

    We next derive direct relationship between linear and circular convolutions

    Suppose [ ]x n and [ ]y n both have length N. Denote by [ ]w n and [ ]cw n theirlinear and N-point circular convolutions, respectively. Then

    [ ] [ ]cr

    w n w n rN

    =-

    = - (20)

    Proof

    Let ( )jX e q

    and ( )jY e q

    be DTFTs of [ ]x n and [ ]y n , and [ ]X k and [ ]Y k be their N-point DFTs

    From properties of DTFTs, we have

    ( ) ( ) ( )j j jW e X e Y eq q q= (21)

    Suppose we sample ( )jW e q

    at N equally-spaced points from 0q= to 2p and denote this

    N-point DFT by [ ]oW k

    Clearly,

    2 2 2[ ] ( ) ( ) ( ) [ ] [ ]j k N j k N j k NoW k W e X e Y e X k Y k p p p= = = (22)

    and so IDFT of [ ]oW k is just N-point circular convolution of [ ]x n with [ ]y n , i.e.

    { }IDFT [ ] [ ]o cW k w n= (23)

    But, linear convolution of [ ]x n and [ ]y n has length 2 1N- . Therefore, points of [ ]oW k represent a sub-sampling of ( )

    jW e q

    Proof completes after application of the Time Aliasingresult Eq. (40), to be discussed later

    Alternatively, it can be shown directly (Problem 18), that Eqs. (19) and (20) are

    equivalent

    i.e.

    1

    0[ ] [ ] [ ]

    N

    m rx m y n m w n rN

    -

    = =-- = -

    (24)

  • 8/13/2019 07 Dft Fft Release

    9/55

    Curtin University, Australia 7-9YH Leung (2005, 2006, 2007, 2008, 2012)

    4 Zero-Padding

    Suppose 1[ ]x n is a 1N-point sequence. DTFT of 1[ ]x n given by, see Eq. (2)

    q q

    --

    ==

    1 1

    1 10( ) [ ]

    Nj jn

    nX e x n e (25)

    Next extend 1[ ]x n to 2N points by appending (padding) -2 1N N zeros to its

    end

    = -= = -

    1 1

    2

    1 2

    [ ] , 0, , 1[ ]

    0 , , , 1

    x n n Nx n

    n N N (26)

    Fig. 3 Zero padding

    DTFT of 2[ ]x n given by

    q q q q

    - - -- - -

    = = == = =

    2 1 11 1 1

    2 2 2 10 0 0

    ( ) [ ] [ ] [ ]

    N N Nj jn jn jn

    n n nX e x n e x n e x n e (27)

    Thus q q=2 1( ) ( )j jX e X e (28)

    i.e. 1[ ]x n and 2[ ]x n both have same underlying DTFT. Call this DTFTq( )jX e

    DFT of 1[ ]x n ( 2[ ]x n ) is simplyq( )jX e evaluated at 1N ( 2N ) equi-angular

    points about unit circle\ Since >2 1N N , so frequency resolution of 2[ ]X k greater than 1[ ]X k

    Can increasefrequency resolution byzero padding

    Note, by frequency resolution, we mean how closely spaced in q we compute

    DFT. Therefore, for an N-point DFT, its frequency resolution is given by

    2N

    pqD = (29)

    0

    x2[n]x1[n]

    N1-1 N2-10

  • 8/13/2019 07 Dft Fft Release

    10/55

    Curtin University, Australia 7-10YH Leung (2005, 2006, 2007, 2008, 2012)

    Do notconfuse frequency resolution with spectral resolution, to discuss later

    Example 2

    7( ) 0.0083cX j w p

    w=

    = . Therefore, can sample ( )cx t at w p p= =2 8 16s with acceptable aliasing.

    With p p= =2 16 0.125sT , we get =2 0.125 16 sample points

    16-point DFT plotted below on left. Right plot is 51-point DFT obtained by zero-padding [ ]x n

    Remarks

    (i) As discussed, 1[ ]x n and its zero-padded version 2[ ]x n both have same

    DTFT, i.e. 1 2( ) ( )j jX e X eq q=

    In contrast, 1 2[ ] [ ]X k X k , as can be seen from above example. In any

    event, 1[ ]X k has length 1N while 2[ ]X k has length 2N

    (ii) Zero-padding as described above also called post-pending. This differs

    from pre-pendingwhich appends zeros to the front of a sequence and

    then shifts the extended sequence right such that it starts at 0n=

    Suppose N is length of extended sequence and on is number of zeros

    pre-pended or post-pended. By time-shifting property of DFTs, one gets

    2pre-pend post-pend[ ] [ ]

    n koNjX k e X kp-= (30)

    0 t21

    1

    xc(t)

    ww

    w

    =

    2sin( 2)

    ( )2

    cX j

    0 0.25 0.5 0.75 1 1.25 1.5 1.75 20

    1

    2

    3

    4

    5

    6

    7

    8

    (x) 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2

    0

    1

    2

    3

    4

    5

    6

    7

    8

    (x)

  • 8/13/2019 07 Dft Fft Release

    11/55

    Curtin University, Australia 7-11YH Leung (2005, 2006, 2007, 2008, 2012)

    5 Zero-Padding the DFT

    A powerful concept in the Fourier analysis of signals is duality

    In simple terms, duality means: if we perform an operation in the time domain

    to get a certain result in the frequency domain, then performing the sameoperation in frequency will yield a mirrored result in time

    An example of duality is following DFT property:

    DFT[ ] [ ]x n X k

    DFT[ ] [ ]

    N

    X n Nx k -

    In this section, we consider the dual of zero-padding

    Let ( )cx t be a finite-duration continuous-time signal that is being sampled,

    and [ ]x n the resulting N-point sequence with DFT [ ]X k

    Suppose we have no access to ( )cx t , except its samples in [ ]x n , but wish

    to increase the sampling rate in order to get a closer look at ( )cx t . That is,

    we wish to interpolatebetween the samples of [ ]x n

    zero pad [ ]X k

    We coin above process zero-padding in frequency. Its dual relationship to

    zero-padding in timeis summarised below

    Zero pad [ ]x n to 1N N> points

    sample ( )jX e q with finer freq spacing1

    2 21 N N

    p pqD = <

    Zero pad [ ]X k to 2N N> points

    sample ( )cx t with finer sampling period2

    2NTN

    T T= <

    Question: How to zero-pad in frequency?

  • 8/13/2019 07 Dft Fft Release

    12/55

    Curtin University, Australia 7-12YH Leung (2005, 2006, 2007, 2008, 2012)

    First recall following result from Sampling

    Suppose ( )cx t is a continuous-time signal with Fourier transform ( )cX jw , and

    it is sampled with sampling period T. DTFT of sampled sequence [ ] ( )cx n x nT=

    given by

    21( ) ( )j c T Tk

    X e X j jkT

    q q p

    =-

    = - (31)

    Suppose next ( )cx t is sampled with sampling periods 1T and 2 1T T<

    Let 1[ ]x n and 2[ ]x n be resulting sample sequences, and 1( )jX e q and 2( )

    jX e q

    their respective DTFTs

    Figure below compares the DTFTs

    Fig. 4 DTFTs of sequences obtained with two different sampling periods

    Now, suppose ( )cx t is being sampled over the time interval 0 t t . It then

    follows that

    1 1 2 2N T N T t= = (32)

    where 1N is length of 1[ ]x n and 2N is length of 2[ ]x n

    ( )cX jw

    w0

    1( )jX e q

    0

    1

    11T

    0

    2( )jX e q

    2 1T T see Eq. (32) so 2[ ]X k has more zeros than 1[ ]X k

    Indeed, together with Eq. (35), we see that:

    To go from 1[ ]X k to the higher sampling rate 2[ ]X k , we scale 1[ ]X k by

    1 2 2 1T T N N = and zero-pad it in the middle mid-pending3

    We next consider situation when 1[ ]X k does not have zeros in its middle

    3 Mid-pending also ensures the expanded DFT satisfies [ ]X k = [ ]

    NX k* - , which is required by an

    N-point real sequence

  • 8/13/2019 07 Dft Fft Release

    14/55

    Curtin University, Australia 7-14YH Leung (2005, 2006, 2007, 2008, 2012)

    We begin by noting that since 1[ ]X k has 1N points between 0q= and 2q p= ,

    its kth point corresponds to

    11

    2, 0,1, , ( 1)k

    kk N

    N

    pq = = - (36)

    1N is odd

    Solving Eq. (36) for kq p= , the mid-point of the interval 0 2q p , we get

    1 2k N= which is not an integer, i.e. 1[ ]X k does not have a point at q p=

    Therefore, to mid-pend 1[ ]X k , we simply insert zeros between 1 1[( 1) 2]X N -

    and 1 1[( 1) 2]X N + which are DFT points immediately on either side of q p=

    Example 3 1( 5)N = { }4

    10

    , , , ,k

    X a b c c b* *=

    =

    { } 221

    20

    , , , 0, , 0, ,NN

    N kX a b c c b* *

    ==

    1

    N is even

    Solving Eq. (36) for kq p= , we get 1 2k N= which is now an integer, i.e.

    1[ ]X k has a point at q p=

    A method to mid-pend 1[ ]X k is to first observe that 1 1[ 2]X N is always real,

    whereupon we define 1 1 1 1[ 2] [ 2]X N X N- += = 1 1 12 [ 2]X N , and insert zeros

    between 1 1[ 2]X N- and 1 1[ 2]X N

    + 4

    Observe above technique preserves requirement that2

    2 2[ ] [ ]NX k X k*

    = -

    Example 4 1( 6)N = { }5

    10

    , , , , ,k

    X a b c d c b* *=

    =

    { } 221

    2 2 2 0, , , , 0, , 0, , ,

    NN d dN k

    X a b c c b* *=

    =

    4 Because of the splitting of 1 1[ 2]X N into 1 1[ 2]X N

    -and 1 1[ 2]X N

    +, the number of zeros we actually

    insert is one less than the number we originally wanted to insert

  • 8/13/2019 07 Dft Fft Release

    15/55

    Curtin University, Australia 7-15YH Leung (2005, 2006, 2007, 2008, 2012)

    Example 5 2 23

    2( ) ( ) ( )

    (2 )

    tc cx t t e u t X j

    jw

    w

    -= =+

    As can be seen, duration of ( )c

    x t is about 5 sec and its bandwidth is about 2.5 Hz

    Accordingly, we set sampling frequency to 5 Hz, or a sampling period of 0.2 sec, and we acquire

    (5 0.2) 1 26+ = samples. Denote these samples by 1[ ]x n

    In the following figure, we zero pad the DFT of 1[ ]x n to 80 points, and take the IDFT of the scaled

    and zero-padded DFT

    As can be seen, except for a slight erratic behaviour near 5t= , the interpolated sequence2

    [ ]x n does

    give us a closer look at ( )cx t

    The erratic behaviour near 5t= can be explained in terms of the fact that strictly, ( )cx t is not time-

    limited and what we have done is effectively apply a rectangular window to ( )cx t . More will be said

    about this temporal windowing in Section 9

    Finally, to conform with common usage, unless otherwise stated, in the sequel

    zero-padding shall mean zero-padding in time

    0 1 2 3 4 5

    0

    0.03

    0.06

    0.09

    0.12

    0.15

    t(sec)

    xc

    (t)

    0 0.5 1 1.5 2 2.50

    0.05

    0.1

    0.15

    0.2

    0.25

    0.3

    f(Hz)

    |X

    c(j2f)|

    0 1 2 3 4 5

    0

    0.03

    0.06

    0.09

    0.12

    0.15

    t(sec)

    x1[n]

    x2[n]

  • 8/13/2019 07 Dft Fft Release

    16/55

    Curtin University, Australia 7-16YH Leung (2005, 2006, 2007, 2008, 2012)

    6 Time Aliasing

    Suppose [ ]x n is an N-point sequence with DFT [ ]X k and DTFT q( )jX e

    Suppose we zero pad [ ]x n to 1N points and denote zero-padded sequence

    by 1[ ]x n and its DFT by 1[ ]X k

    We have seen 1[ ]X k can be thought of as DFT obtained by samplingq( )jX e at

    >1N Nequally-spaced frequency points

    Question What happens if we under-sampleq( )jX e at

  • 8/13/2019 07 Dft Fft Release

    17/55

    Curtin University, Australia 7-17YH Leung (2005, 2006, 2007, 2008, 2012)

    p

    ---

    = =

    =

    2

    2

    112 ( )

    220 0

    1[ ] [ ]

    NNj n m k N

    m k

    x n x m eN

    Now, p d-

    = =-

    = = = -

    2

    2

    12 2

    2

    2 0

    1, ,1[ ]

    0, otherwise

    Nj n k N

    k r

    n rN r e n rN

    N (38)

    d d

    =- =- =-

    \ = - - = * -

    2 2 2[ ] [ ] [( ) ] [ ] [ ]m r r

    x n x m n m rN x n n rN (39)

    i.e.

    =-

    = -2 2[ ] [ ]r

    x n x n rN (40)

    An application of Eq. (40) is shown below

    Fig. 5 Time aliasing

    As can be seen

    (i) If [ ]x n has (non-zero padded) finite length N and

  • 8/13/2019 07 Dft Fft Release

    18/55

    Curtin University, Australia 7-18YH Leung (2005, 2006, 2007, 2008, 2012)

    Example 6 { }5

    0[ ]

    nx x n

    ==

    0 1 5( ) [0] [1] [5]j j j jX e x e x e x eq q q q- - -\ = + + +

    Suppose we sample ( )jx e q

    at four frequency points to obtain the DFT:

    2 0 42[0] ( ) [0] [1] [2] [3] [4] [5]

    jX X e x x x x x xp= = + + + + +

    2 1 4 2 4 2 2 4 5 2 42[1] ( ) [0] [1] [2] [5]

    [0] [1] [2] [3] [4] [5]

    j j j jX X e x x e x e x e

    x jx x jx x jx

    p p p p - - - = = + + + +

    = - - + + -

    2 2 4 4 4 2 4 4 5 4 42[2] ( ) [0] [1] [2] [5]

    [0] [1] [2] [3] [4] [5]

    j j j jX X e x x e x e x e

    x x x x x x

    p p p p - - - = = + + + +

    = - + - + -

    2 3 4 6 4 2 6 4 5 6 42[3] ( ) [0] [1] [2] [5]

    [0] [1] [2] [3] [4] [5]

    j j j jX X e x x e x e x e

    x jx x jx x jx

    p p p p - - - = = + + + +

    = + - - + +

    IDFT of the resulting 4-point DFT is given by the 4 4 IDFT matrix

    2 2

    2 4 4 4 6 42 2

    4 4 8 4 12 42 2

    6 4 12 4 18 42 2

    [0] [0] 1 1 1 11 1 1 1

    [1] [1] 1 111 1

    4 4[2] [2] 1 1 1 11

    [3] [3] 1 11

    j j j

    j j j

    j j j

    x X

    x X j je e e

    x Xe e e

    x X j je e e

    p p p

    p p p

    p p p

    - - = = - - - -

    2

    2

    2

    2

    [0]

    [1]

    [2]

    [3]

    X

    X

    X

    X

    Thus

    { }

    { }{ }{ }

    2 2 2 2 24 [0] [0] [1] [2] [3] [0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5][0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5]

    4 [0] 4 [4]

    x X X X X x x x x x x

    x jx x jx x jxx x x x x x

    x jx x jx x jx

    x x

    = + + + = + + + + +

    + - - + + -+ - + - + -

    + + - - + +

    = +

    { }{ }

    { }{ }

    2 2 2 2 24 [1] [0] [1] [2] [3] [0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5]

    4 [1] 4 [5]

    x X jX X jX x x x x x x

    j x jx x jx x jx

    x x x x x x

    j x jx x jx x jx

    x x

    = + - - = + + + + +

    + - - + + -

    - - + - + -

    - + - - + +

    = +

    { }{ }{ }{ }

    2 2 2 2 2

    4 [2] [0] [1] [2] [3] [0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5]

    4 [2]

    x X X X X x x x x x x

    x jx x jx x jx

    x x x x x x

    x jx x jx x jx

    x

    = - + - = + + + + +

    - - - + + -

    + - + - + -

    - + - - + +

    =

    { }{ }

    { }{ }

    2 2 2 2 24 [3] [0] [1] [2] [3] [0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5]

    [0] [1] [2] [3] [4] [5]

    4 [3]

    x X jX X jX x x x x x x

    j x jx x jx x jx

    x x x x x x

    j x jx x jx x jx

    x

    = - - + = + + + + +

    - - - + + -

    - - + - + -

    + + - - + +

    =

  • 8/13/2019 07 Dft Fft Release

    19/55

    Curtin University, Australia 7-19YH Leung (2005, 2006, 2007, 2008, 2012)

    Remark

    Time aliasing can be viewed as another consequence of the duality that

    exists between the time and frequency domains in Fourier analysis

    Frequency Aliasing Time Aliasing

    ( )cX jw is bandlimited to Nw w [ ]x n is time limited to 0 ( 1)n N -

    Freq aliasing if ( )c

    x t sampled at

    2 (2 )NT p w>

    Time aliasing if ( )jX e q sampled at

    2 Nq pD >

    1( ) ( )s c s

    k

    X j X j jkT

    w w w

    =-

    = -

    2s Tw p=

    2 2[ ] [ ]r

    x n x n rN

    =-

    = -

    2 2N p q= D

  • 8/13/2019 07 Dft Fft Release

    20/55

    Curtin University, Australia 7-20YH Leung (2005, 2006, 2007, 2008, 2012)

    7 The Fast Fourier Transform (FFT)

    As noted earlier, DFT does not give true spectrum. So why bother with DFT?

    Ans. The Fast Fourier Transform (FFT)

    FFT is just a computationally efficient way of calculating the DFT. Also, com-

    paring Eqs. (3) and (4), we see it can be easily modified to compute the IDFT

    It is the speed of the FFT that makes it a popular and powerful signal

    processing tool

    Recall N-point DFT Eq. (3)

    p-

    -

    =

    = 1

    2

    0

    [ ] [ ]N

    j nk N

    n

    X k x n e , = -0, , 1k N

    To compute above directly will require

    2N complex multiplications

    -( 1)N N complex additions

    where 1 complex multiply = 4 real multiplies and 2 real adds

    1 complex add = 2 real adds

    In contrast, Cooley-Tukey radix-2 FFT algorithm, as implemented in MATLAB

    and many other similar software packages, requires only

    2( 2)logN N complex multiplications

    2logN N complex additions

    DFT FFT

    N real real real real

    8 256 240 48 72

    32 4,096 4,032 320 480

    128 65,536 65,280 1,792 2,688

    512 1,048,576 1,047,552 9,216 13,824

    2048 16,777,216 16,773,120 45,056 67,584

  • 8/13/2019 07 Dft Fft Release

    21/55

    Curtin University, Australia 7-21YH Leung (2005, 2006, 2007, 2008, 2012)

    Cooley-Tukey requires Nto be an integer power of 2

    There exist many other FFT algorithms, some even faster than Cooley-Tukey,but Cooley-Tukey remains most popular because of its ease in programming

    DFT/FFT (i) evaluates DTFT at Nfrequency points simultaneously

    (ii) requires all of [0]x to -[ 1]x N to be available before computation

    can start

    If interested in only a few frequency points, or if want to spread computational

    load over time interval when [0]x to -[ 1]x N are acquired, use Goertzel

    algorithm(see Appendix II)

  • 8/13/2019 07 Dft Fft Release

    22/55

    Curtin University, Australia 7-22YH Leung (2005, 2006, 2007, 2008, 2012)

    8 Linear Convolution with the DFT/FFT

    Question: Can we use DFT/FFT to compute, efficiently, the linear convolution of

    two sequences [ ]x n and [ ]y n ?

    8.1 Full Linear Convolution with Circular Convolution

    Figure below compares linear convolution with circular convolution

    Fig. 6 Linear vs circular convolution

    As can be seen, circular shifting in circular convolution introduces time aliasing

    (dashed green ovals)

    Time aliasing can be overcome by zero-padding(see Fig. 7 next page)

    Idea is to force a gap between the repeated patterns of [ ]y m in [ ]y m

    [ ]x m

    [ ]y m

    [1 ]y m-

    [ ]y m

    [1 ]y m-

    [ ]y m- [ ]y m-

    0n=

    1n=

    m

    m

    m

    m

    m

    m

    m

    [ ]y N m- [ ]y N m-

    n =

    m

    [ ]x m

    m

    1

    0

    [ ] [ ] [ ] [ ]N

    m

    x n y n x m y n m-

    =

    * = -1

    0

    [ ] [ ] [ ] [ ]NN

    m

    x n y n x m y n m-

    =

    = -

    m

    0

    0 0

    0

    0

    00

    0

    0 1N-

    1N- 1N-

    1N-

    1N-

    1N-

    1N-1N-

    1N- 0 1N-

  • 8/13/2019 07 Dft Fft Release

    23/55

    Curtin University, Australia 7-23YH Leung (2005, 2006, 2007, 2008, 2012)

    Fig. 7 Linear convolution from circular convolution with zero-padding

    It follows from Fig. 7 that

    If [ ]x n and [ ]y n both have length N, then to compute their linear convolution

    using DFT/FFT, we must zero pad them to at least (2 1)N- points

    [ ]x m

    [ ]y m

    [1 ]y m-

    zp[ ]y m

    zp[1 ]y m-

    [ ]y m- zp[ ]y m-

    0n=

    1n=

    m

    m

    m

    m

    m

    m

    m

    [ ]y N m- zp[ ]y N m-

    n N=

    m

    zp[ ]x m

    m

    1

    0

    [ ] [ ] [ ] [ ]N

    m

    x n y n x m y n m-

    =

    * = -2 2

    zp zp zp zp0

    [ ] [ ] [ ] [ ]

    2 1

    N

    N

    m

    x n y n x m y n m

    N N

    -

    =

    = -

    = -

    m

    0

    0 0 1N-1N-

    1N- 0 1N- 2 2N-

    0 0 1N-1N-

    0 0 1N-1N-

    0 0 1N-1N-

    2 2N-

    2 2N-

    2 2N-

    2 2N-

    2 2n = -

    [2 2 ]y N m- - zp[2 2 ]y N m- -

    m m0 0 1N-1N- 2 2N-

  • 8/13/2019 07 Dft Fft Release

    24/55

    Curtin University, Australia 7-24YH Leung (2005, 2006, 2007, 2008, 2012)

    Key points to explain why zero-padding works:

    (i) It follows from Discrete-Time Signals and Systems, Problem 2, that:

    { } { } { }1 1 2( 1)

    0 0 0[ ] , [ ] [ ]

    N N N

    n n nx x n y y n w x y w n

    - - -

    = = == = = * =

    i.e. if xand yboth have length N, then x y* has length (2 1)N-

    (ii) Circular convolution of two length (2 1)N- sequences will result in a length

    (2 1)N- sequence

    (iii) Points of zp[ ]y n m- for , , (2 2)m N N= - do not enter convolution sum

    since corresponding points of zp[ ]x m are zero (green regions)6

    (iv) Because of zero-padding, when 0 (2 2)n N - , zp[ ] [ ]y n m y n m- = -

    for 0 ( 1)m N - (yellow regions)7. More specifically, number of zerosappended to [ ]y n must cover length of [ ]x n , less 1

    In view of above discussion, it is not difficult to see that, more generally

    If [ ]x n has length P and [ ]y n has length L, then if we are to compute

    their linear convolution using the DFT, we must zero pad them to at least

    ( 1)L P+ - points

    6 Thus in Fig. 7,

    1 1 1

    zp zp zp zp zp zp zp0 0 0

    [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]NN N N

    m m m

    x n y n x m y n m x m y n m x m y n m- - -

    = = =

    = - = - = -

    7 Thus in Fig. 7,

    1 1

    zp0 0

    [ ] [ ] [ ] [ ], 0 2 2

    [ ] [ ]

    N N

    m m

    x m y n m x m y n m n N

    x n y n

    - -

    = =

    - = - -

    = *

  • 8/13/2019 07 Dft Fft Release

    25/55

    Curtin University, Australia 7-25YH Leung (2005, 2006, 2007, 2008, 2012)

    Example 7 Linear Convolution with DFT

    { }3

    01, 1, 0, 2

    nx

    == - { }

    ==

    3

    01, 0, 3, 2

    ny

    { }6

    zp 01, 1, 0, 2, 0, 0, 0

    nx

    == - { }

    6zp 0

    1, 0, 3, 2, 0, 0, 0n

    y=

    =

    It can be readily verified that

    { }6

    0[ ] [ ] 1, 1, 3,1, 2, 6, 4

    nx n y n

    =* = - -

    Now

    {

    }

    zp

    6

    0

    [ ] 2, 1.4254 0.0859, 2.4695 2.5386, 1.4559 1.5160,

    1.4559 1.5160, 2.4695 2.5386, 1.4254 0.0859k

    X k j j j

    j j j=

    = - - + -

    + - - -

    {

    }

    zp

    6

    0

    [ ] 6, 1.4695 3.7926, 0.4559 2.8653, 2.4254 0.3956,

    2.4254 0.3956, 0.4559 2.8653, 1.4695 3.7926k

    Y k j j j

    j j j=

    = - - - + +

    - - - - +

    {

    }

    zp zp

    6

    0

    [ ] [ ] [ ]

    12, 1.7687 5.5323, 8.3998 5.9185, 4.1310 3.1009,

    4.1310 3.1009, 8.3998 5.9185, 1.7687 5.5323k

    W k X k Y k

    j j j

    j j j=

    \ =

    = + - + -

    + - - -

    and { } { }6

    0[ ] IDFT [ ] 1, 1, 3, 1, 2, 6, 4

    nw n W k

    == = - -

    In above example, [ ]x n and [ ]y n were both zero-padded to 7 points. This is

    not commensurate with FFT. However, result in pp. 4 says we can also zero

    pad them to32 8 7= > points

    Example 8 { }3

    01, 1, 0, 2

    nx

    == - { }

    ==

    3

    01, 0, 3, 2

    ny

    { }7

    zp 01, 1, 0, 2, 0, 0, 0, 0

    nx

    == - { }

    7zp 0

    1, 0, 3, 2, 0, 0, 0, 0n

    y=

    =

    {

    }zp 7

    0

    [ ] 2, 1.1213 0.7071, 1 3, 3.1213 0.7071,

    0, 3.1213 0.7071, 1 3, 1.1213 0.7071k

    X k j j j

    j j j=

    = - - + -

    + - - +

    {

    }

    zp

    7

    0

    [ ] 6, 0.4142 4.4142, 2 2, 2.4142 1.5858,

    2, 2.4142 1.5858, 2 2, 0.4142 4.4142k

    Y k j j j

    j j j=

    = - - - + +

    - - - - +

    {

    }

    zp zp

    7

    0

    [ ] [ ] [ ]

    12, 2.6569 5.2426, 8 4, 8.6569 3.2426,

    0, 8.6569 3.2426, 8 4, 2.6569 5.2426k

    W k X k Y k

    j j j

    j j j=

    =

    = - + - - +

    - - + - -

    { } { }7

    0[ ] IDFT [ ] 1, 1, 3,1, 2, 6, 4, 0

    nw n W k

    = = = - -

  • 8/13/2019 07 Dft Fft Release

    26/55

    Curtin University, Australia 7-26YH Leung (2005, 2006, 2007, 2008, 2012)

    Next example illustrate more general result

    Example 9 { }1

    01, 1 nx == - { } ==3

    01, 0, 3, 2 ny

    Thus 2P= , 4L= , and we zero pad [ ]x n and [ ]y n to 1 5L P+ - = points:

    { }4

    zp 01, 1,0, 0,0

    nx

    == - { }

    4zp 0

    1, 0, 3, 2, 0n

    y=

    =

    Next, following the procedure

    {

    }

    zp

    4

    0

    [ ] 0, 0.6910 0.9511, 1.8090 0.5878,

    1.8090 0.5878, 0.6910 0.9511k

    X k j j

    j j=

    = + +

    - +

    {}

    zp

    4

    0

    [ ] 6, 3.0451 0.5878, 2.5451 0.9511,

    2.5451 0.9511, 3.0451 0.5878k

    Y k j j

    j j=

    = - - +

    - - +

    {

    }

    zp zp

    4

    0

    [ ] [ ] [ ] 0, 1.5451 3.3022, 4.0451 3.2164,

    4.0451 3.2164, 1.5451 3.3022k

    W k X k Y k j j

    j j=

    = = - - +

    - - +

    { } { }4

    0[ ] IDFT [ ] 1, 1, 3, 1, 2

    nw n W k

    = = = - - -

    It can be readily verified that

    [ ] [ ] [ ]x n y n w n* =

  • 8/13/2019 07 Dft Fft Release

    27/55

    Curtin University, Australia 7-27YH Leung (2005, 2006, 2007, 2008, 2012)

    8.2 Partial Linear Convolution with Circular Convolution

    Suppose [ ]x n has length P and [ ]y n has length L P>

    Figure below compares linear with L-point circular convolution of [ ]x n and

    [ ]y n where, for circular convolution, [ ]x n has been zero-padded to Lpoints

    Fig. 8 Linear convolution vs L-point circular convolution

    (i) Zero-padding [ ]x n sum in [ ]cw n applies only over first Ppoints

    (ii) For 0, , ( 2)n P= - , [ ] [ ]cw n w n because of time aliasing (dashed

    green oval) in summation region (yellow)

    (iii) For ( 1), , ( 1)n P L= - - , [ ] [ ]cw n w n= since [ ]y n m- and [ ]y n m-

    have same data points in (truncated) summation region

    (iv) For n L= , [ ]cw n again suffers from time aliasing but we do not compute

    [ ]cw L

    01P-

    [ ]x m

    m

    [ ]y m

    0

    m

    1

    0

    [ ] [ ] [ ]P

    m

    w n x m y n m-

    =

    = -

    1L -

    1 1

    zp zp0 0

    [ ] [ ] [ ] [ ] [ ]L P

    cm m

    w n x m y n m x m y n m- -

    = =

    = - = -

    01P-

    zp[ ]x m

    m0

    m1L -

    [ ]y m

    m

    [ ]y m-

    0 m0

    [ ]y m-

    0=n

    m

    [( 1) ]y P m- -

    0 m0

    [( 1) ]y P m- -

    1= -n P

    m

    [ ]y P m-

    0 m0

    [ ]y P m-

    =n P

    m

    [( 1) ]y L m- -

    0 m0

    [( 1) ]y L m- -

    1= -n L

    1L - 1L -1P- 1P-

  • 8/13/2019 07 Dft Fft Release

    28/55

    Curtin University, Australia 7-28YH Leung (2005, 2006, 2007, 2008, 2012)

    In summary

    First ( 1)P- points of circular convolution do not equal linear convolution

    Remaining ( 1)L P- + points of circular convolution equal linear convolution

    Partial linear convolution method does not find last ( 1) 1L P L P + - - = - points of linear convolution

    Example 10 { }1

    01, 1

    nx

    == - { }

    ==

    3

    01, 0, 3, 2

    ny

    Thus 2P= and 4L= . Zero-padding [ ]x n to 4L= points:

    { }3zp 01, 1, 0, 0 nx == -

    Accordingly

    { }3

    zp 0[ ] 0, 1 1, 2, 1 1

    kX k j j

    == + -

    { }3

    0[ ] 6, 2 2, 2, 2 2

    kY k j j

    == - + - -

    { }3

    zp 0[ ] [ ] [ ] 0, 4, 4, 4

    kW k X k Y k

    == = - -

    { } { }3

    0[ ] IDFT [ ] 1, 1, 3, 1

    nw n W k

    = = = - - -

    It can be readily verified that

    { }4

    0[ ] [ ] 1, 1, 3, 1, 2

    nx n y n

    =* = - - -

    Thus:

    1. Frst ( 1) 2 1 1P- = - = point of [ ]w n and [ ] [ ]x n y n* are not equal

    2. Next ( 1) 4 2 1 3L P- + = - + = points of [ ]w n and [ ] [ ]x n y n* are equal

    3. Last ( 1) 2 1 1P- = - = point of [ ] [ ]x n y n* is not found

  • 8/13/2019 07 Dft Fft Release

    29/55

    Curtin University, Australia 7-29YH Leung (2005, 2006, 2007, 2008, 2012)

    9 Implementation of LTI Systems with DFT/FFT

    Let [ ]x n be input to an LTI system with impulse response [ ]h n . Suppose [ ]h n

    has length Pand [ ]x n has length Q P

    May not be possible to use full linear convolution method to find output [ ]y n :

    (i) Computation can start only when all of [ ]x n has been gathered. This may

    lead to unacceptable delay

    (ii) DFT length can be very large if Q is large and such DFTs may be

    impractical to compute

    (iii) [ ]x n may have infinite length

    Two basic methods: Overlap-Addand Overlap-Save

    Overlap-add discussed below

    Overlap-save discussed in Appendix IV

  • 8/13/2019 07 Dft Fft Release

    30/55

    Curtin University, Australia 7-30YH Leung (2005, 2006, 2007, 2008, 2012)

    Overlap-Add Method

    First partition [ ]x n into Rsegments of length Leach

    1

    0[ ] [ ]

    R

    rrx n x n rL

    -

    == - (42)

    where [ ]x n has been zero-padded to RL points, [ ]rx n is rth segment

    [ ], 0 ( 1)[ ]

    0, otherwiser

    x n rL n Lx n

    + -=

    (43)

    P L Q (44)

    and = R Q L (45)

    It follows that

    { }1 1

    0 0

    [ ] [ ] [ ] [ ] [ ] [ ] [ ]R R

    r rr r

    y n x n h n x n rL h n x n rL h n- -

    = =

    = * = - * = - * (46)

    Or1

    0

    [ ] [ ]R

    rr

    y n y n rL-

    =

    = - (47)

    where [ ] [ ] [ ]r ry n x n h n= * (48)

    and linear convolution of Eq. (48) can be computed using full linear con-

    volution method

    (i) rth input segment [ ]rx n starts at 0n= while [ ]rx n rL- starts at n rL=

    (ii) rth output segment [ ]ry n starts at 0n= while [ ]ry n rL- starts at n rL= (iii) [ ]rx n , and so [ ]rx n rL- , has length L

    (iv) [ ]ry n , and so [ ]ry n rL- , has length ( 1)L P+ - where Pis length of [ ]h n

    Relationship between [ ]x n , [ ]rx n rL- , [ ]ry n rL- and [ ]y n illustrated in Fig. 9

  • 8/13/2019 07 Dft Fft Release

    31/55

    Curtin University, Australia 7-31YH Leung (2005, 2006, 2007, 2008, 2012)

    1

    0

    [ ] [ ]R

    rr

    x n x n rL-

    =

    = - [ ], 0 ( 1)

    [ ]0, otherwise

    r

    x n rL n Lx n

    + -=

    1

    0

    [ ] [ ]R

    rr

    y n y n rL-

    =

    = - [ ] [ ] [ ]r ry n x n h n= *

    Fig. 9 Overlap-add method

    Observe output segments longer than input segments and they overlap. They

    are added together as per Eq. (47) to form [ ]y n

    01P-

    [ ]h n

    n

    [ ]x n

    nL0 2L 3L

    0 [ ]x n 1[ ]x n L- 2[ 2 ]x n L-

    n0

    0[ ]y n

    2P L+ -

    n0 L

    1[ ]y n L-

    n

    2[ 2 ]y n L-

    2L0

    0

    [ ]y n

    L 2L

    n

    3L

    2 2P L+ -

  • 8/13/2019 07 Dft Fft Release

    32/55

    Curtin University, Australia 7-32YH Leung (2005, 2006, 2007, 2008, 2012)

    Example 11

    n 0 1 2

    [ ]h n 1 0 -1

    n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

    [ ]x n 1 1 -1 0 -2 2 0 -1 1 0 2 -1 -1 0 1

    Thus, length of [ ]h n is 3P= ,

    length of [ ]x n is 15Q= ,

    and length of [ ]y n is ( 1)P Q+ - = 3 15 1 17+ - =

    Suppose segment length is 6L = . Then,

    number of segments is R Q L = = 15 6 3 =

    length of output segments is ( 1) 6 3 1 8L P+ - = + - =

    and we zero pad [ ]x n to 3 6 18RL= = points.

    n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

    [ ]x n 1 1 -1 0 -2 2 0 -1 1 0 2 -1 -1 0 1 0 0 0

    0 [ ]x n 1 1 -1 0 -2 2

    0[ ]ny 1 1 -2 -1 -1 2 2 -2

    -1[ ]x n L 0 -1 1 0 2 -1

    -1[ ]n Ly 0 -1 1 1 1 -1 -2 1

    -2 [ 2 ]x n L -1 0 1 0 0 0

    -2 [ 2 ]n Ly -1 0 2 0 -1 0 0 0

    [ ]y n 1 1 -2 -1 -1 2 2 -3 1 1 1 -1 -3 1 2 0 -1

  • 8/13/2019 07 Dft Fft Release

    33/55

    Curtin University, Australia 7-33YH Leung (2005, 2006, 2007, 2008, 2012)

    Appendix I Derivation of DFT to DTFT Interpolation Formula

    Recall definition of DTFT Eq. (1)

    q q

    -

    =-= ( ) [ ]j jn

    nX e x n e

    If [ ]x n has finite length N, then

    q q-

    -

    =

    = 1

    0

    ( ) [ ]N

    j jn

    n

    X e x n e (49)

    Now, from Eq. (4)

    p

    p

    q q q

    q

    - - -- -

    = = =

    - --

    = =

    = =

    =

    2

    2

    1 1 1

    0 0 0

    1 1

    0 0

    1( ) [ ] [ ]

    1[ ]

    nkN

    nkN

    N N Njj jn jn

    n n k

    N Nj jn

    k n

    X e x n e X k e eN

    X k e eN

    (50)

    But

    ( ) ( )

    ( )

    ( )

    ( )

    ( ) ( )

    ( ) ( )

    ( )

    ( )

    ( )( )

    ( ) ( ){ }

    p

    pp

    p p q

    p q p q p q

    p q p q p q

    p q p q

    q p qqq

    q

    p q

    p q

    -

    - - -

    - - -

    - -

    - -- ---

    -= =

    -

    -

    --

    -

    - -= = =

    - -

    -=

    -

    -=

    -

    2

    22

    2 2

    2 2 22 2 2

    2 2 22 2 2

    2 22 2

    21 1

    0 0

    22

    2

    2

    1 1

    1 1

    sin

    sin

    kNknk

    NNk k N

    N N

    k N k N k N

    k N k N k N N N N

    k N k N N

    j N j k NN Nj nj jn

    j jn n

    j j j

    j j j

    k Nj

    k N

    N

    e ee e e

    e e

    e e e

    e e e

    je

    j

    (51)

    Substituting Eq. (51) into Eq. (50), yields Eq. (5)

    ( )( )

    2 1212 2

    20 2

    sin1( ) [ ]

    sin

    k NN kN jj N

    N kk N

    X e X k eN

    pq p qq

    q p

    - - - - -

    -=

    =

  • 8/13/2019 07 Dft Fft Release

    34/55

    Curtin University, Australia 7-34YH Leung (2005, 2006, 2007, 2008, 2012)

    Appendix II Goertzel Algorithm

    A.1 Basic Principle

    Consider following single-pole (complex) IIR filter (Goertzel cell)

    Fig. 10 Goertzel cell

    p= + -(2 )[ ] [ ] [ 1]oj k Ny n x n e y n (52)

    p -=

    - (2 ) 11

    ( )1 o

    j k NH z

    e z (53)

    p= (2 )[ ] [ ]oj k N nh n e u n (54)

    Appendix III shows that if (i) filter is initially at rest, i.e., - =[ 1] 0y

    (ii) [ ]x n is causal, i.e., =[ ] 0x n for < 0n

    and (iii) =[ ] 0x N

    thenp= 2[ ] [ ]oj k oy N e X k (55)

    i.e., above filter can be used to compute [ ]oX k (and only ok ) which is not

    surprising given its pole-zero structure

    Remarks

    (i) Goertzel cell spits outp2

    [ ]oj k

    oe X k at time =n N, and not = -1n N

    (ii) At =n N, we must set =[ ] 0x N

    (iii) Derivation in Appendix III indicates ok doesnot have to be an integer

    (iv) If ok , thenp =2 1oj ke and =[ ] [ ]oy N X k

    y[n]x[n]

    p2 oj k Ne

    p2 ok

    N

    z-plane

    -1z

  • 8/13/2019 07 Dft Fft Release

    35/55

    Curtin University, Australia 7-35YH Leung (2005, 2006, 2007, 2008, 2012)

    A.2 Efficient Implementation

    Recall Eq. (52)

    p= + -(2 )[ ] [ ] [ 1]oj k Ny n x n e y n

    1 real add and 1 complex multiply, or 3 real adds and 4 real multiplies, persampling period

    Now, Eq. (53) gives transfer function of Goertzel cell

    p -=

    - (2 ) 11

    ( )1 o

    j k NH z

    e z

    \

    { }

    p p

    p p p

    - -- -

    - - - - -

    - - = - - + +

    (2 ) (2 )1 1

    (2 ) 1 (2 ) (2 ) 1 2

    1 1( )

    1 1

    o o

    o o o

    j k N j k N

    j k N j k N j k N

    e z e z H z

    e z e e z z

    orp

    p

    - -

    - -

    -=

    - +

    (2 ) 1

    2 1 2

    1( )

    1 2cos

    o

    o

    j k N

    k

    N

    e zH z

    z z (56)

    y[n]x[n]

    p2 oj k Ne

    -1z

  • 8/13/2019 07 Dft Fft Release

    36/55

    Curtin University, Australia 7-36YH Leung (2005, 2006, 2007, 2008, 2012)

    p

    p

    - -

    - -

    -=

    - +

    (2 ) 1

    2 1 2

    1( )

    1 2cos

    o

    o

    j k N

    k

    N

    e zH z

    z z

    Fig. 11 Goertzel cell as 2nd order IIR filter

    LCCDE

    AR:p

    = + - - -2

    [ ] [ ] 2cos [ 1] [ 2]ok

    Nw n x n w n w n (57)

    MA:p

    -= - -

    2

    [ ] [ ] [ 1]ko

    Nj

    y n w n e w n p p

    = - - + -2 2

    [ ] cos [ 1] sin [ 1][ ] o ok k

    N Nw n w n j w ny n (58)

    Sampling periods 0 to N1:

    Goertzel cell in real form requires only 2 real adds/subtracts and 1 real

    multiply per sampling period to maintain AR section ( [ ]w n is real)

    Sampling period N:

    AR section now requires 1 less real add since =[ ] 0x N but MA section kicks

    in and requires 1 real add and 2 real multiplies

    2 real adds and 3 real multiplies

    y[n]x[n]

    p22cos o

    k

    N

    p-- 2 oj k Ne

    -1z

    -1z

    w[n]

  • 8/13/2019 07 Dft Fft Release

    37/55

    Curtin University, Australia 7-37YH Leung (2005, 2006, 2007, 2008, 2012)

    A.3 Continuous Operation

    Block Mode [ ]oX k every Nth sampling period

    Output response of Goertzel cell given by Eq. (65) of Appendix III

    p -

    =

    = (2 )( )0

    [ ] [ ] on

    j k N n m

    m

    y n x m e

    \ p p p- -

    - - - -

    = =

    - = = 2 2 21 1

    ( 1 ) ( 1)

    0 0

    [ 1] [ ] [ ]k k ko o o

    N N N

    N Nj N m j N j m

    m m

    y N x m e e x m e

    i.e.,p

    - -- =

    2( 1)

    [ 1] [ ]ko

    Nj N

    oe y N X k (59)

    Can extract [ ]oX k at 1n N= - by scaling output

    Fig. 12 Goertzel cell continuous operation, block mode

    At =n N, we reset filter, wait for [ ]x N , and proceed as before

    Next valid [ ]oX k available at 2 1, 3 1, ,n N N= - - etc.

    n = N1, 2N1, 3N1,

    x[n]

    n = 0, 1, 2, X[ko]

    p- -

    2( 1)

    koN

    j Ne

    N

    Np22cos o

    k

    N

    -1z

    -1z

    p-- 2 oj k Ne

    n = N1, 2N1, 3N1,

    x[n]

    n = 0, 1, 2, p2 oj k NeN

    Np22cos o

    k

    N

    -1z

    -1z

    X[ko]p- 2 oj ke

  • 8/13/2019 07 Dft Fft Release

    38/55

    Curtin University, Australia 7-38YH Leung (2005, 2006, 2007, 2008, 2012)

    Sampling periods 0 to N2: 2 real adds/subtracts and 1 real multiply

    Sampling period N1: 3 real adds/subtracts and 3 real multiplies ( ok )

    5 real adds/subtracts and 7 real multiplies ( ok )

    Sliding Mode [ ]oX k every sampling period

    Definep-

    -

    =

    = - - +21

    0

    [ , ] [ ( 1) ]ko

    N

    Nj m

    o o om

    X k n x n N m e (60)

    i.e. [ , ]o oX k n is DFT of the Nsuccessive samples - - [ ( 1)], , [ ]o ox n N x n

    Fig. 13 Grouping of data samples in sliding mode operation

    Now, from Eq. (65) of Appendix III

    p -

    =

    = (2 )( )0

    [ ] [ ] on

    j k N n m

    m

    y n x m e

    Therefore

    p p

    p p

    p

    p

    p p-

    - - -

    = =

    -- -

    = =

    -

    = - +

    -- -

    =

    - - = -

    = -

    =

    = - + + = - - +

    2 2

    2 2

    2

    2

    ( ) ( )2 2

    0 0

    ( ) ( )

    0 0

    ( )

    1

    1( 1 )

    0

    [ ] [ ] [ ] [ ]

    [ ] [ ]

    [ ]

    [ 1 ] , ( 1)

    k ko oo oN N

    k ko oN N

    koN

    koN

    n n Nj n m j n N mj k j k

    m m

    n n Nj n m j n m

    m m

    nj n m

    m n N

    Nj N k

    k

    y n e y n N x m e e x m e

    x m e x m e

    x m e

    x n N k e k m n N

    i.e.,

    p p

    p-

    - -

    =- - = - - +

    2 21( 1)2

    0[ ] [ ] [ ( 1) ]

    k ko oo N N

    Nj N j kj k

    ky n e y n N e x n N k e (61)

    nno-(N-1)

    Npoints

    x[n]

    no

    X[ko,no]

    X[ko,no-1]

  • 8/13/2019 07 Dft Fft Release

    39/55

    Curtin University, Australia 7-39YH Leung (2005, 2006, 2007, 2008, 2012)

    Substituting Eq. (60) into Eq. (61), we get

    p

    p -- - =2

    ( 1)2[ ] [ ] [ , ]

    koo N

    j Nj koy n e y n N e X k n (62)

    i.e.

    p p- -

    - - =

    2 2( 1)

    [ ] [ ] [ , ]

    k ko oN N

    j N j

    oe y n e y n N X k n (63)

    Fig. 14 Goertzel cell continuous operation, sliding mode

    Remarks

    (i) Sliding mode structure is basically FIR since it simply computes an N-point

    DFT

    \ Stable in theory

    But Goertzel cell embeds a recursive filter with a pole on unit circle, so can

    be unstable if pole actually outside unit circle due to coefficient round-offs

    A remedy is to put pole atp= 2 oj k Nz r e where ris just less than 1

    (ii) Block mode structure always stable because of periodic resets

    (iii) If ok , such thatp =2 1oj ke , then Eq. (62) yields the more efficient

    structure shown in Fig. 15

    p- -

    2( 1)

    koN

    j Ne

    p22cos o

    k

    N

    -1z

    -1z

    - +2Nz

    x[n] X[ko,n]

    -1z

    p2 oj k Ne

    p- 2 oj ke

  • 8/13/2019 07 Dft Fft Release

    40/55

    Curtin University, Australia 7-40YH Leung (2005, 2006, 2007, 2008, 2012)

    Fig. 15 Goertzel cell continuous operation, sliding mode, ok

    x[n]

    p2 oj k Ne

    p22cos o

    k

    N

    -1z

    -1z

    X[ko,n]

    Nz-

  • 8/13/2019 07 Dft Fft Release

    41/55

    Curtin University, Australia 7-41YH Leung (2005, 2006, 2007, 2008, 2012)

    Appendix III Derivation of Goertzel Algorithm

    Recallp= + -(2 )[ ] [ ] [ 1]oj k Ny n x n e y n

    p -=

    - (2 ) 11

    ( )1 o

    j k NH z

    e z

    andp= (2 )[ ] [ ]oj k N nh n e u n

    Suppose filter is initially at rest. Then

    p

    -

    =- =-

    = - = - (2 )( )[ ] [ ] [ ] [ ] [ ]oj k N n mm m

    y n x m h n m x m e u n m (64)

    But [ ]x n iscausal, i.e., =[ ] 0x m for < 0m . Also - =[ ] 0u n m for >m n

    Therefore p -

    =

    = (2 )( )0

    [ ] [ ] on j k N n m

    m

    y n x m e (65)

    and p -

    =

    = (2 )( )0

    [ ] [ ] oN

    j k N N m

    m

    y N x m e

    p p-

    =

    = 2 (2 )0

    [ ][ ] o oN

    j k j k N m

    m

    e x m ey N (66)

    Now, if =[ ] 0x N (67)

    then p p p-

    -

    =

    = =1

    2 (2 ) 2

    0

    [ ] [ ] [ ]o o oN

    j k j k N m j ko

    m

    y N e x m e e X k (68)

    where [ ]oX k is thok output of an N-point DFT

    y[n]x[n]

    p2 oj k Ne

    -1z

  • 8/13/2019 07 Dft Fft Release

    42/55

    Curtin University, Australia 7-42YH Leung (2005, 2006, 2007, 2008, 2012)

    Appendix IV Overlap-Save Method

    Method based on partial linear convolution method

    Idea is to partition [ ]x n into overlapping equal-length segments and use partial

    linear convolution method to determine from these segments, contiguous blocksof correct linear convolution terms

    The method: (Recall [ ]h n has length P and [ ]x n has length Q P )

    1. Choose segment length Lsuch that

    P L Q (69)

    2. Pre- and post-pend [ ]x n with ( 1)P- and { }( 1)R L P Q- + - zeros,respectively, where Ris number of segments

    ( 1) ( 1)R Q L L P = + - - + (70)

    i.e. construct the extended sequence ext[ ]x n where

    = = - =ext ext[0] [ 2] 0x x P (71)

    + - = -ext[ 1] [ ], 0 ( 1)x n P x n n Q (72)

    and + - = = - + + - =ext ext[ 1] [ ( 1) 2] 0x Q P x R L P P (73)

    3. Partition ext[ ]x n into overlapping L-point segments where successive

    segments overlap by ( 1)P- points. Thus, rth segment is

    + - + -=

    ext [ ( 1)], 0 ( 1)[ ]

    0, otherwiser

    x n r L P n Lx n (74)

    4. Compute L-point circular convolution of [ ]h n (zero-padded to L points)

    with [ ]rx n , discard first ( 1)P- points of convolution and retain last

    ( 1)L P- + points. Denote retained points by [ ]ry n , 0 ( )n L P -

    5. Abut [ ]ry n s to form output

    1

    0

    [ ] [ ( 1)]R

    rr

    y n y n r L P -

    =

    = - - + (75)

  • 8/13/2019 07 Dft Fft Release

    43/55

    Curtin University, Australia 7-43YH Leung (2005, 2006, 2007, 2008, 2012)

    Fig. 16 Overlap-save method

    Method called overlap-save since we overlap input segments and we save

    last ( 1)P- points of input segment [ ]rx n to use them as first ( 1)P- points

    of next input segment 1[ ]rx n+

    [ ]x n

    n0

    0[ ]x n- - +1[ ( 1)]x n L P

    - - +2[ 2( 1)]x n L P

    ext [ ]x n

    nL0

    n0

    0y

    01P-

    [ ]h n

    n

    - +1L P - +2( 1)L P

    n0

    1y

    n0

    2y

    n0

    [ ]y n

    -2P

  • 8/13/2019 07 Dft Fft Release

    44/55

    Curtin University, Australia 7-44YH Leung (2005, 2006, 2007, 2008, 2012)

    Example

    n 0 1 2

    [ ]h n 1 0 -1

    n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

    [ ]x n 1 1 -1 0 -2 2 0 -1 1 0 2 -1 -1 0 1

    Thus, length of [ ]h n is 3P= ,

    length of [ ]x n is 15Q= ,

    and length of [ ]y n is ( 1)P Q+ - = 3 15 1 17+ - =

    Suppose segment length is 6L = . Then,

    number of segments is ( 1) ( 1) 20 4 5R Q L L P = + - - + = =

    segments overlap by ( 1) 3 1 2P- = - = points

    length of output segments is 6L =

    we retain last ( 1) 6 3 1 4L P- + = - + = points of each output segment

    we pre-pend [ ]x n with ( 1) 3 1 2P- = - = zeros

    and we post-pend [ ]x n with { }( 1) 5(6 3 1) 15 5R L P Q- + - = - + - = zeros

    n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    ext [ ]x n 0 0 1 1 -1 0 -2 2 0 -1 1 0 2 -1 -1 0 1 0 0 0 0 0

    0 [ ]x n 0 0 1 1 -1 0

    0h x 1 0 1 1 -2 -1

    0 [ ]y n 1 1 -2 -1

    -1[ 4]x n -1 0 -2 2 0 -1

    1h x -1 1 -1 2 2 -3

    -1[ 4]y n -1 2 2 -3

    -2 [ 8]x n 0 -1 1 0 2 -1

    2h x -2 0 1 1 1 -1

    -2 [ 8]y n 1 1 1 -1

    -3 [ 12]x n 2 -1 -1 0 1 0

    3h x 1 -1 -3 1 2 0

    -3 [ 12]y n -3 1 2 0

    -4 [ 16]x n 1 0 0 0 0 0 4h x 1 0 -1 0 0 0

    -4 [ 16]y n -1 0 0 0

    n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

    [ ]y n 1 1 -2 -1 -1 2 2 -3 1 1 1 -1 -3 1 2 0 -1

  • 8/13/2019 07 Dft Fft Release

    45/55

    Curtin University, Australia 7-45YH Leung (2005, 2006, 2007, 2008, 2012)

    Problems

    1. Compute the DFT of each of the following finite-length sequences considered to be of

    length N(where Nis even):

    (a) [ ] [ ]d=n n

    (b) [ ] [ ], 0 1d= - -o ox n n n n N

    (c)1, even, 0 1

    [ ]0, odd, 0 1

    -= -

    n n Nx n

    n n N

    (d) 2

    2

    1, 0 1[ ]

    0, 1

    -= -

    N

    N

    nx n

    n N

    (e), 0 1

    [ ]0, otherwise

    -=

    na n Nx n

    2. Consider the finite-lengthsequence { }3 0[ ] 6, 5, 4, 3 nx n == . Determine the sequences

    (a) 1 4[ ] [ 2 ], 0 3x n x n n= -

    (b) 2 4[ ] [ ], 0 3x n x n n= -

    3. A finite-duration sequence [ ]x n of length 8 has the 8-point DFT [ ]X k shown below.

    A new sequence of length 16 is defined by

    [ 2], even[ ]

    0, odd

    x n ny n

    n

    =

    Sketch the 16-point DFT of [ ]y n .

    k

    [ ]X k

    0 1 2 3 4 5 6 70 1 2 3 4 5 6 7

  • 8/13/2019 07 Dft Fft Release

    46/55

    Curtin University, Australia 7-46YH Leung (2005, 2006, 2007, 2008, 2012)

    4. Two 8-point sequences 1[ ]x n and 2[ ]x n shown below have DFTs 1[ ]X k and 2[ ]X k

    respectively. Determine the relationship between 1[ ]X k and 2[ ]X k .

    5. Two finite-length sequences [ ]n and 1[ ]x n are shown below.

    TheN-point DFTs of these sequences, [ ]X k and 1[ ]X k , respectively, are related by

    2 2

    1[ ] [ ] Nj k

    X k X k ep

    =

    where N is an unknown constant. Can you determine a value of N consistent with

    the figures drawn for [ ]x n and 1[ ]n ? Is your choice for N unique? If so, justify

    your answer. If not, find another choice of Nconsistent with the information given.

    6. Consider the real finite-length sequence [ ]x n shown below.

    (a) Determine the finite-length sequence [ ]y n whose 6-point DFT is

    26

    4[ ] [ ]

    j kY k X k e

    p- =

    where [ ]X k is the 6-point DFT of [ ]x n

    (b) Determine the finite-length sequence [ ]w n whose 6-point DFT is

    { }[ ] Re [ ]W k X k =

    (c) Determine the finite-length sequence [ ]q n whose 3-point DFT is

    [ ] [2 ], 0,1, 2Q k X k k = =

    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

    a

    b

    c

    d

    e

    n n

    e

    d

    a

    b

    cx1[n] x2[n]

    0

    1

    2 3 4 5 6 7 0 1 2 3

    4

    5 6 7n n

    x [n] x1[n]1 1

    1- 1-

    1 1

    n

    [ ]x n

    0 1 2 3 4 5 6 7-1

    43

    21

  • 8/13/2019 07 Dft Fft Release

    47/55

    Curtin University, Australia 7-47YH Leung (2005, 2006, 2007, 2008, 2012)

    7. [ ]x n is a real-valued finite-length sequence of length 10 and is nonzero in the interval

    from 0 to 9, i.e.,

    [ ] 0, 0, 10

    [ ] 0, 0 9

    x n n n

    x n n

    = <

    ( )jX e q denotes the DTFT of [ ]x n , and [ ]X k denotes the 10-point DFT of [ ]x n .

    Determine a choice for [ ]n so that [ ]X k is real valued for all kand

    ( ) ( ) ,j jX e A eq aqq q p= <

    where ( )A q is real and a is a nonzero real constant.

    8. Let [ ]x n be a real-valued 5-point sequence whose 7-point DFT is denoted by [ ]X k .

    If { }Re [ ]X k is the 7-point DFT of [ ]g n , show that [0] [0]g x= , and determine therelationship between [1]g and [1]x .

    9. Suppose we have two 4-point sequences [ ]n and [ ]h n as follows:

    ( )2[ ] cos , 0,1, 2, 3

    [ ] 2 , 0,1, 2, 3

    n

    n

    x n n

    h n n

    p= =

    = =

    (a) Calculate the 4-point DFT [ ]X k .

    (b) Calculate the 4-point DFT [ ]H k .

    (c) Calculate 4[ ] [ ] [ ]y n x n h n= by doing the circular convolution directly.

    (d) Calculate [ ]y n of Part (c) by multiplying the DFTs of [ ]n and [ ]h n and

    performing an inverse DFT.

    10. Consider the two 4-point sequences { }31 0[ ] 1, 0, 2, 1 nx n == and { }3

    2 0[ ] 0, 1, 0,

    nx n a ==

    where a is unknown. Suppose the 4-point circular convolution of 1[ ]n and 2[ ]x n is

    given by

    { }43

    1 2 0[ ] [ ] [ ] 1, 1, 1, 1

    ny n x n x n

    == = - -

    Can you specify auniquely? If so, what is a? If not, give two possible values of a.

  • 8/13/2019 07 Dft Fft Release

    48/55

    Curtin University, Australia 7-48YH Leung (2005, 2006, 2007, 2008, 2012)

    11. In this exercise, we investigate the plausibility of the zero-insertion method described in

    the Lecture Notes for zero-padding in frequency, particularly when the original DFT

    has an even number of points.

    Consider the continuous-time signal

    ( ) sin 2 cos 4p p= +cx t A t B t

    Clearly, ( )cx t is periodic with period 1 sec and bandwidth 2 Hz. Suppose ( )cx t is

    sampled over 1 sec at 4, 5, 6 and 7 Hz with the first sample taken at 0=t to yield

    the 4-, 5-, 6- and 7-point sequences 4[ ]n , 5[ ]x n , 6[ ]n and 7[ ]n , respectively. Show

    that

    { }3

    4 0[ ] 0, 2 , 4 , 2

    == -

    kX k j A B j A

    { }45

    5 4 0[ ] 0, 2 , 2 , 2 , 2

    == -

    kX k j A B B j A

    { }56

    6 4 0[ ] 0, 2 , 2 , 0, 2 , 2

    == -

    kX k j A B B j A

    { }67

    7 4 0[ ] 0, 2 , 2 , 0, 0, 2 , 2

    == -

    kX k j A B B j A

    12. Consider the finite-length sequence { }5 0[ ] 1,1,1,1,1,1 == nx n . Let ( )X z be the z-

    transform of [ ]n . If we sample ( )X z at(2 4)p= j kz e , 0,1, 2, 3=k , we obtain

    (2 4)1[ ] ( ) p=

    = j kz e

    X k X z , 0,1, 2, 3=k .

    Sketch the sequence 1[ ]n obtained as the inverse DFT of 1[ ]X k

    13. Suppose 1[ ]x n is an infinite-length, stable (i.e., absolutely summable) sequence with

    z-transform given by

    1 113

    1( )

    1X z

    z-=

    -

    Suppose 2[ ]x n is a finite-length sequence of lengthN, and itsN-point DFT is given by22 1[ ] ( ) , 0,1, , 1j k Nz eX k X z k Np== = -

    Determine 2[ ]x n .

    14. Consider the two finite-length sequences { }31 0[ ] 1, 2, 1, 3 nx n == - - and 2[ ]x n =

    { }5 00, 2, 0, 0, 1, 1 n=- . What is the smallest N such that the N-point circularconvolution of 1[ ]n and 2[ ]n equals the linear convolution of these sequences, i.e.,

    such that 1 2 1 2[ ] [ ] [ ] [ ]Nn x n x n x n= * ?

  • 8/13/2019 07 Dft Fft Release

    49/55

    Curtin University, Australia 7-49YH Leung (2005, 2006, 2007, 2008, 2012)

    15. Determine a real sequence [ ]n that satisfies all of the following three conditions:

    Condition 1: The DTFT of [ ]n has the form

    1 2( ) 1 cos cos 2jX e A Aq q q= + +

    where 1 and 2 are some unknown constants.

    Condition 2: The sequence [ ] [ 3]x n nd* - evaluated at 2n= is 5.

    Condition 3: For the 3-point sequence { }2 0[ ] 1, 2, 3 nw n == , the result of the 8-point

    circular convolution of [ ]w n and [ 3]x n - is 11 when 2n= ; i.e.,

    7

    80 2

    [ ] [ 3 ] 11

    m n

    w m x n m

    = =

    - - =

    16. Two finite-length sequences 1[ ]x n and 2[ ]x n , which are zero outside the interval

    0 99n , are circularly convolved to form a new sequence [ ]y n .

    100

    99

    1 2 1 2 1000

    [ ] [ ] [ ] [ ] [ ] , 0 99k

    y n x n x n x k x n k n=

    = = -

    If, in fact, 1[ ]n is nonzero only for 10 39n , determine the set of values of n for

    which [ ]y n is guaranteed to be identical to the linearconvolution of 1[ ]x n and 2[ ]n .

    17. Consider two finite-duration sequences [ ]x n and [ ]y n . [ ]n is zero for 0n < , 40n ,

    and 9 30n< < , and [ ]y n is zero for 10n < and 19n > , as shown below.

    Let [ ]w n denote the linear convolution of [ ]x n and [ ]y n . Let [ ]g n denote the 40-point

    circular convolution of [ ]x n and [ ]y n :

    [ ] [ ] [ ] [ ] [ ]k

    w n x n y n x k y n k

    =-

    = * = -

    40

    39

    400

    [ ] [ ] [ ] [ ] [ ]k

    g n x n y n x k y n k== = -

    0

    0 9

    10 19

    30 39 n

    n

    [ ]y n

    [ ]x n

  • 8/13/2019 07 Dft Fft Release

    50/55

    Curtin University, Australia 7-50YH Leung (2005, 2006, 2007, 2008, 2012)

    (a) Determine the values of nfor which [ ]w n can be nonzero.

    (b) Determine the values of nfor which [ ]w n can be obtained from [ ]g n . Explicitly

    specify at what index values nin [ ]g n these values of [ ]w n appear.

    18. Suppose [ ]n and [ ]y n are two finite-duration sequences, both with the same length N.

    Show, directly, that

    1

    0

    [ ] [ ] [ ]N

    m r

    m y n m w n rN -

    = =-

    - = -

    where [ ]y n is the periodic extension of [ ]y n , and [ ]w n is the linear convolution of

    [ ]x n with [ ]y n .

    19. We want to implement the linear convolution of a 10,000-point sequence with an FIR

    impulse response that is 100 points long. The convolution is to be implemented by using

    DFTs and IDFTs of length 256.

    (a) If the overlap-add method is used, what is the minimum number of 256-point

    DFTs and the minimum number of 256-point IDFTs needed to implement the

    convolution of the entire 10,000-point sequence? Justify your answer.

    (b) If the overlap-save method is used, what is the minimum number of 256-point

    DFTs and the minimum number of 256-point IDFTs needed to implement the

    convolution of the entire 10,000-point sequence? Justify your answer.

    (c) Suppose the DFTs and IDFTs of Parts (s) and (b) are implemented using FFTs

    and IFFTs. Compare the number of arithmetic operations (multiplications and

    additions) required in the overlap-add method, the overlap-save method, and

    direct convolution.

    Other problems to attempt from Oppenheim and Schafer, Chapter 8:

    8, 11, 13, 14, 16, 18, 19, 26, 31, 32, 38, 53

  • 8/13/2019 07 Dft Fft Release

    51/55

    Curtin University, Australia 7-51YH Leung (2005, 2006, 2007, 2008, 2012)

    Answers

    1. (a) [ ] 1=X k (b) 2[ ] p-= oj kn NX k e

    (c)2, 0, 2

    [ ]0, otherwise

    ==

    N k NX k (d) 2

    2

    1

    2 , 0

    , odd[ ]

    0 , even

    p--

    ==

    j k Ne

    N k

    kX k

    k

    (e) 21

    1[ ]

    p-

    -

    -=

    N

    j k N

    a

    aeX k

    2. (a) { }3

    10

    [ ] 4, 3, 6, 5n

    x n

    =

    =

    (b) { }3

    2 0[ ] 6, 3, 4, 5

    nx n

    ==

    3.

    4. 2 1[ ] ( 1) [ ]kX k X k= -

    5. 5N =

    6. (a) { }5

    0[ ] 2, 1, 0, 0, 4, 3

    ny n

    ==

    (b) { }5

    3 32 2 0[ ] 4, , 1, 1, 1, nw n ==

    (c) { }2

    0[ ] 5, 3, 2

    nq n

    ==

    k

    [ ]Y k

    0 1 2 3 4 5 6 7 15

  • 8/13/2019 07 Dft Fft Release

    52/55

    Curtin University, Australia 7-52YH Leung (2005, 2006, 2007, 2008, 2012)

    7. We first establish the following result. Let [ ]Y k be the DFT of an arbitrary realN-point

    sequence. Define

    [ ] [ ] [ ]X k Y k Y k*= +

    Clearly, [ ]X k is real for all k. Now, from the properties of DFTs, the IDFT of [ ]X k is given by

    [ ] [ ] [ ] [ ] [ ] [ ] [ ]N N

    n y n y n y n y n y n y N n*= + - = + - = + -

    Accordingly, if [ ]X k is an N-point DFT and is real for 0 ( 1)k N - , then its

    IDFT [ ]n must satisfy

    [ ], 1 1[ ]

    arbitrary real , 0

    x N n n Nx n

    n

    - -= =

    In the context of this Problem, the above result means

    [1] [9]

    [2] [8]

    [3] [7]

    [4] [6]

    x

    x x

    x x

    x x

    =

    =

    =

    =

    and [0] and [5]are arbitrary but real.

    Next, recall our earlier work on linear phase FIR filters. The condition on ( )j

    X e q

    implies [ ]x n is linear phase. Therefore, [ ]x n must satisfy

    [ ] [ 1 ], 0 ( 1)x n x N n n N= - - -

    or in the context of this Problem,

    [0] [9]

    [1] [8]

    [2] [7]

    [3] [6]

    [4] [5]

    x

    x

    x x

    x x

    x x

    =

    =

    =

    =

    =

    Combining both sets of conditions on [ ]n , we see that [ ]x n must be a constant for

    0 ( 1)n N - .

    8. [0] [0]g x= ; 12

    [1] [1]g x=

    9. (a) { }4

    43

    0[ ] 1 0, 2, 0, 2

    kj

    kX k e

    p-

    == - =

    (b) { }2 4 6

    4 4 43

    0[ ] 1 2 4 8 15, 3 6, 5, 3 6

    k k kj j j

    kH k e e e j j

    p p p- - -

    == + + + = - + - - -

    (c)(d) { }3

    0[ ] 3, 6, 3, 6

    ny n

    == - -

  • 8/13/2019 07 Dft Fft Release

    53/55

    Curtin University, Australia 7-53YH Leung (2005, 2006, 2007, 2008, 2012)

    10. 1a = -

    11. Sampling ( )cx t at 4, 5 and 6 Hz, we get

    { }34 0[ ] , ( ), , ( ) == - - - nx n B A B B A B

    {}

    2 25 5 5 5 5

    42 25 5 5 5 0

    [ ] , sin cos , sin cos ,

    sin cos , sin cos

    p p p p

    p p p p

    =

    = - +

    - + - -n

    x n B A B A B

    A B A B

    {}

    1 16 2 2

    51 12 2 0

    [ ] , ( 3 ), ( 3 ),

    , ( 3 ), ( 3 )=

    = - -

    - - - -n

    x n B A B A B

    B A B A B

    DFTs can be found, after some algebra, through the DFT matrices

    4

    1 1 1 1

    1 1

    1 1 1 1

    1 1

    FFT - -

    - -

    - -

    =

    j j

    j j

    2 5 4 5 4 5 2 5

    4 5 2 5 2 5 4 55

    4 5 2 5 2 5 4 5

    2 5 4 5 4 5 2 5

    1 1 1 1 1

    1

    1

    1

    1

    FFT

    p p p p

    p p p p

    p p p p

    p p p p

    - -

    - -

    - -

    - -

    =

    j j j j

    j j j j

    j j j j

    j j j j

    e e e e

    e e e e

    e e e e

    e e e e

    3 2 3 2 3 3

    2 3 2 3 2 3 2 3

    2 3 2 3 2 3 2 3

    3 2 3 2 3 3

    6

    1 1 1 1 1 1

    1 1

    1 1

    1 1 1 1 1 1

    1 1

    1 1

    FFT

    p p p p

    p p p p

    p p p p

    p p p p

    - -

    - -

    - -

    - -

    -

    - - -

    -

    =

    j j j j

    j j j j

    j j j j

    j j j j

    e e e e

    e e e e

    e e e e

    e e e e

    12. { }3

    1 0[ ] 2, 2, 1, 1

    nx n

    ==

    13. ( ) ( )131 12 3

    1[ ] Nnx n

    -=

    14. 9N=

  • 8/13/2019 07 Dft Fft Release

    54/55

    Curtin University, Australia 7-54YH Leung (2005, 2006, 2007, 2008, 2012)

    15. From Condition 1, we can write

    1 2 2 21 2 2 2

    ( ) 1 cos cos 2 1 ( ) ( )A Aj j j j jX e A A e e e eq q q q qq q

    - -= + + = + + + + (1)

    Comparing the above expression with the definition of the DTFT

    ( ) [ ]j jn

    n

    X e x n eq q

    -

    =-

    = (2)

    we see that [ ]x n is the non-causal finite-length sequence

    { }2 1 1 22

    2 2 2 2 2[ ] , , 1, ,

    A A A A

    nx n

    =-= (3)

    Next, from Condition 2

    ( ) ( )2 2

    [ ] [ 3] [ 3] [ 1] 5n n

    x n n x n xd= =

    * - = - = - = (4)

    Combining (3) and (4), we get

    [ 1] [1] 5x x- = = (5)

    and 1 10A = (6)

    Finally, with reference to Condition 3, we first remark that [ 3]x n- is a causal 6-point

    sequence

    { }2 1 1 25

    2 2 2 2 0[ 3] 0, , , 1, ,

    A A A A

    nx n

    =- = (7)

    Therefore, the linearconvolution of [ 3]x n- with the causal 3-point sequence [ ]w n will

    yield a causal 3 6 1 8+ - = point causal sequence. Moreover, from our study on

    the relationship between linear and circular convolutions, we see the 8-point circular

    convolution of [ 3]x n- with [ ]w n will equal their linear convolution. In other words,

    8[ ] [ 3] [ ] [ 3]w n x n w n x n* - = - (8)

    It can be shown, using the table method to calculate linear convolutions, that

    { }7

    0[ ] [ 3] 0, , 5 2 , 11 3 , 22, 13 , 15 2 , 3

    nw n x n a a a a a a

    =* - = + + + + (9)

    where 2[ 2] [2] 2a x x A= - = = . Hence, from Condition 3

    2[ ] [ 3] 5 2 11

    nw n x n a

    =* - = + = (10)

    23 or 6a A = = (11)

    Summarising

    { }2 2[ ] 3, 5, 1, 5, 3 nx n =-=

    16. 39 99n

  • 8/13/2019 07 Dft Fft Release

    55/55

    17. (a) 10 28n and 40 58n

    (b) [ ] [ ]g n w n= for 19 39n , and [ ] [ 40]g n w n= + for 0 9n

    19.Multiplications Addtions

    Overlap-add 528,384 798,813

    Overlap-save 536,576 804,864

    Direct convolution 1,009,900 999,801