Return to Video

4.4 - DFT, DFS, DTFT [21:37]

  • 0:01 - 0:05
    >> We now understand the Fourier transform of a finite length signal
  • 0:05 - 0:08
    namely, the Discrete Fourier Transform.
  • 0:08 - 0:09
    We are interested to see what happens
  • 0:09 - 0:12
    if the length of the signal grows and grows to infinity.
  • 0:12 - 0:14
    There are two ways to do this:
  • 0:14 - 0:17
    either we take the DFT and we look at what happens
  • 0:17 - 0:19
    as the length goes to infinity,
  • 0:19 - 0:23
    or we take a finite length signal, we periodize it,
  • 0:23 - 0:25
    and compute the discrete Fourier series,
  • 0:25 - 0:27
    and then let the period go to infinity.
  • 0:27 - 0:32
    In both cases, the limit will be the Discrete Time Fourier Transform,
  • 0:32 - 0:36
    which is the natural Fourier transform for infinite-length sequences.
  • 0:36 - 0:40
    This is a powerful, but more subtle object than the DFT,
  • 0:40 - 0:45
    and we will need to understand it quite in detail and with some care.
  • 0:45 - 0:52
    And equipped with a DTFT, we'll be able to think about sequences and their spectras.
  • 0:52 - 0:59
    Module 4.4. Discrete Fourier Transform , Discrete Fourier Series and Discrete Time Fourier Transform.
  • 1:01 - 1:07
    To move from the DFT, to the Discrete Fourier Series, into the Discrete Time Fourier Transform,
  • 1:07 - 1:12
    we are going to start by revisiting the Karplus-Strong algorithm from module two,
  • 1:12 - 1:19
    we're going to see that we can naturally extend the analysis of the DFT
  • 1:19 - 1:23
    to a larger class of signals, and this will lead to the DTFT,
  • 1:23 - 1:28
    and we're going to give an interpretation of this phenomenon.
  • 1:28 - 1:33
    Remember the Karplus-Strong algorithm: you have an input x[n]
  • 1:33 - 1:39
    and there is a feedback from the output with a delay factor z to the minus n,
  • 1:39 - 1:43
    so that's a delay of M samples and multiplication by α,
  • 1:43 - 1:46
    and this is added to the current input.
  • 1:46 - 1:48
    So we have a recursive equation,
  • 1:48 - 1:52
    given at the bottom that describes this Karplus-Strong algorithm.
  • 1:52 - 1:57
    Let's take a signal that is nonzero on exactly one period.
  • 1:57 - 2:03
    So it's nonzero, from 0 to M-1,
  • 2:03 - 2:05
    and for now, we pick α is equal to 1.
  • 2:05 - 2:11
    With this, the period will simply repeat, so the signal starts at 0
  • 2:11 - 2:17
    and we get the first period, x over bar 0 to x over bar M-1,
  • 2:17 - 2:24
    then this period is repeated a second time, a third time and so on, to infinity.
  • 2:24 - 2:28
    As an example, take a 32-tap sawtooth wave.
  • 2:28 - 2:35
    So the sawtooth, starts at -1 at 0, and goes up to +1 at 31.
  • 2:35 - 2:45
    The Discrete Fourier Transform of a length-32 sawtooth wave form can be computed by hand,
  • 2:45 - 2:47
    but we shall not do this here explicitly.
  • 2:47 - 2:50
    There is one value, however, that we can recognize immediately,
  • 2:51 - 2:53
    it's a value for k is equal to 0,
  • 2:53 - 2:58
    because the sawtooth is asymmetric around the x-axis, this will be 0.
  • 2:58 - 3:05
    The other values are computed numerically and are shown on this plot.
  • 3:06 - 3:09
    What if we take the DFT of two periods?
  • 3:09 - 3:12
    So we will repeat the sawtooth from 0 to 31
  • 3:12 - 3:17
    and then from 32 to 63, we have two periods here,
  • 3:17 - 3:20
    and we take a DFT now of size 64.
  • 3:22 - 3:28
    The 64 point DFT looks similar to the 32 point DTF,
  • 3:28 - 3:32
    except that all odd entries are actually exactly equal to 0.
  • 3:32 - 3:35
    So we have same shape of DFT,
  • 3:35 - 3:39
    however in between every nonzero value, there is a 0 value,
  • 3:39 - 3:43
    so there must be something going on that we need to understand.
  • 3:45 - 3:48
    Let's develop some intuition for the DFT of two periods.
  • 3:48 - 3:51
    So when we take the DFT of two periods,
  • 3:51 - 3:57
    we take inner products with the DFT basis vectors of lengths 64.
  • 3:57 - 4:02
    What we will see, is that the even inner product will be different from 0
  • 4:02 - 4:06
    and the odd inner product will be equal to 0.
  • 4:06 - 4:11
    For k is equal to 0, we take the inner product between the first basis vector of the DFT
  • 4:11 - 4:14
    and the sawtooth repeated twice.
  • 4:14 - 4:20
    The first basis vector of the DFT is simply the constant equal to 1 from 0 to 63.
  • 4:20 - 4:25
    And so, the inner product is twice the inner product on the intervals of length 32
  • 4:25 - 4:27
    and this we know, is equal to 0.
  • 4:27 - 4:30
    So, for k is equal to 0, the DFT, again, is equal to 0.
  • 4:34 - 4:39
    For k is equal to 1, the situation is very different.
  • 4:39 - 4:42
    The basis function has sines and cosine,
  • 4:42 - 4:47
    which have an integral period, positive and negative, as the blue function indicates.
  • 4:47 - 4:52
    And therefore, whatever happens on the first half from 0 to 31
  • 4:52 - 4:55
    is canceled by what happens in the second half.
  • 4:55 - 4:59
    So for k is equal to 1, the DFT coefficient is exactly equal to 0.
  • 5:02 - 5:04
    For k is equal to 2,
  • 5:04 - 5:09
    we see that the inner product on the first half of the interval, from 0 to 31,
  • 5:09 - 5:14
    and the second half, 32 through 63, is exactly the same inner product.
  • 5:14 - 5:19
    Therefore, it will be double the DFT of size 32.
  • 5:19 - 5:21
    So it will be nonzero and twice as big
  • 5:21 - 5:26
    as what we know already from the DFT of a sawtooth of length 32.
  • 5:29 - 5:32
    For k=3, we are again in the case of cancellation,
  • 5:32 - 5:37
    now, this is not so obvious as in the case of k=1.
  • 5:37 - 5:38
    But if you watch carefully,
  • 5:38 - 5:41
    you can see that the blue parts multiplied by the red signal
  • 5:41 - 5:44
    have, in pairs, the cancellation property
  • 5:44 - 5:49
    and therefore, the DFT for k=3 is again, going to be equal to 0.
  • 5:51 - 5:53
    Let us now prove this property.
  • 5:53 - 5:57
    So take the DFT, of L periods of the signal.
  • 5:57 - 6:01
    Call this capital X sub L of k.
  • 6:01 - 6:07
    This is a summation from 0 to LM-1, of the usual DFT formula here,
  • 6:07 - 6:12
    and k also goes from 0 to LM-1.
  • 6:12 - 6:15
    Now we split the sum into two parts,
  • 6:15 - 6:22
    one from 0 to L-1 and another one from 0 to M-1.
  • 6:22 - 6:25
    We do this by simply repeating the periods,
  • 6:25 - 6:29
    so write this as y of n plus p times M,
  • 6:29 - 6:33
    so these are the various, the L periods we have.
  • 6:33 - 6:36
    We do the same in the exponent,
  • 6:36 - 6:42
    then we notice that y[n+ pM] is of course, the same as y[n],
  • 6:42 - 6:47
    because our signal y[n] is actually periodic, so we can simplify this.
  • 6:47 - 6:50
    We split the exponents into the two parts,
  • 6:50 - 6:55
    the parts that is dependent on n, the one that is dependent on p.
  • 6:55 - 7:01
    This allows us to simplify the exponent of the second one to 2π over L
  • 7:01 - 7:04
    by simplifying the M.
  • 7:04 - 7:09
    Now we notice on the last line, that we can separate out the summation over p,
  • 7:09 - 7:11
    that's what we put between parentheses,
  • 7:11 - 7:17
    and the second part, which is now simply the DFT of one period,
  • 7:17 - 7:22
    so it's the summation from 0 to M-1.
  • 7:24 - 7:26
    Now comes the aha effect.
  • 7:26 - 7:32
    The sum between parentheses we have seen before, it is a finite geometric series.
  • 7:32 - 7:35
    So when k is a multiple of capital L,
  • 7:35 - 7:39
    then it's a sum from 0 to L-1, of the constant 1,
  • 7:39 - 7:43
    so it's equal to capital L, and otherwise it is exactly equal to 0.
  • 7:43 - 7:49
    This comes, if you remember, from the orthogonality proof we did for the DFT basis.
  • 7:50 - 7:55
    Therefore, we can write the DFT of XL of k:
  • 7:55 - 8:02
    it's equal to L times the DFT of one period, and it's equal to 0 otherwise.
  • 8:04 - 8:08
    With this, we are ready to talk about the Discrete Fourier Series.
  • 8:08 - 8:14
    So the DFT of multiple periods is uniquely determined by the DTF of a single period,
  • 8:14 - 8:16
    we have just proven this.
  • 8:16 - 8:21
    And the DFT synthesis, if we let it run forever, will generate a periodic signal.
  • 8:21 - 8:26
    So the Discrete Fourier Series is really very much like the DFT,
  • 8:26 - 8:30
    except that we explicitly periodize both time and frequency.
  • 8:30 - 8:36
    So we have a periodic time sequence and we have a periodic frequency sequence.
  • 8:36 - 8:41
    And that's the natural definition of a Discrete Fourier Series.
  • 8:41 - 8:44
    We will see that this is similar to the Continuous Time Fourier Series
  • 8:44 - 8:50
    that you might have seen in a course on mathematical analysis, on harmonic analysis.
  • 8:50 - 8:55
    This is a simple incarnation in the Discrete Time Domain of periodic signals
  • 8:55 - 8:58
    and periodic frequency domains.
  • 8:58 - 9:03
    The Discrete Fourier Series helps us in the case of shifts.
  • 9:03 - 9:08
    And remember, when we have finite-length signal, it's unclear how we should define a shift,
  • 9:08 - 9:14
    so we periodize the finite-length signals, that gives us x N periodic (?)
  • 9:14 - 9:18
    and then the DFS is X periodic,
  • 9:18 - 9:23
    and the Inverse Discrete Fourier Series of a shifted version,
  • 9:23 - 9:29
    which corresponds to a phase factor here, is exactly a shift by M.
  • 9:29 - 9:31
    Since it's an infinite periodic sequence,
  • 9:31 - 9:37
    we can easily shift without having to worry about the borders of one period.
  • 9:37 - 9:41
    This discussion of time shift is so important
  • 9:41 - 9:44
    that we are going to go through it one more time in detail.
  • 9:44 - 9:49
    So, assume you have an N-point finite-length signal x[n], with a DFT X[k],
  • 9:49 - 9:57
    how shall we define the IDFT of e to the -j, 2π over n times Mk, of this DFT X[k]?
  • 9:57 - 10:01
    Well, we can just calculate it, but what is the natural interpretation?
  • 10:01 - 10:05
    Well the natural interpretation is to build x tilde of n,
  • 10:05 - 10:08
    which is a periodized version of x[n], so you take x[n]
  • 10:08 - 10:12
    and the index is taken (?) module, capital N.////
  • 10:12 - 10:19
    Then, you calculate the DFT of X[k], which is equal to the DFT of x tilde.
  • 10:19 - 10:26
    The inverse DFT of X[k], multiplied by the shift factor, is inverse DFS, of X tilde of k,
  • 10:29 - 10:33
    which is, as we've just seen X tilde shifted by M,
  • 10:33 - 10:37
    which therefore is x of n minus M module N.
  • 10:37 - 10:43
    So all shifts of finite-length sequences can be seen as circular shifts,
  • 10:43 - 10:45
    as we have discussed in module 2.1,
  • 10:45 - 10:52
    but here they are implicit in the definition of the DFT and the inverse DFT.
  • 10:52 - 10:57
    Now, this was not really Karplus-Strong as we had introduced it,
  • 10:57 - 11:01
    because α was equal to 1, and we simply had a purely periodic signal.
  • 11:01 - 11:06
    So in general, α is smaller than 1, and so the single y[n] has a first period,
  • 11:06 - 11:11
    a second period that is weighted by α, a third one by α squared etcetera,
  • 11:11 - 11:16
    so it will have a geometric decay, so it is truly an infinite signal,
  • 11:16 - 11:18
    it's almost periodic, but not really.
  • 11:18 - 11:25
    And the question is, what would be a good spectral representation for such a signal?
  • 11:26 - 11:32
    What would be the natural definition of the DFT of a signal that gets longer and longer,
  • 11:32 - 11:35
    and what really happens when N goes to infinity?
  • 11:35 - 11:41
    Now the fundamental frequency in the DFT, is given by 2π/N
  • 11:41 - 11:44
    and it's multiplied by k, which is the frequency index.
  • 11:44 - 11:49
    So on the interval 0 to 2π, as N goes to infinity,
  • 11:49 - 11:55
    we get closer and closer frequency values of 2π over capital N.
  • 11:55 - 11:58
    In the limit, this will go towards a continuous frequency
  • 11:58 - 12:05
    and so we could define, formally a sum of x[n] multiplied by e to the jωn,
  • 12:07 - 12:10
    where ω is the limit of 2π over N,
  • 12:10 - 12:17
    when N goes to infinity multiplied by the frequency index k.
  • 12:17 - 12:22
    So this leads to a formal definition of what is called the Discrete Time Fourier Transform,
  • 12:22 - 12:27
    which is a natural Fourier Transform for infinite-length sequences.
  • 12:27 - 12:33
    So x[n] should belong to one of our Hilbert (?) spaces, so that's L2 of Z.
  • 12:33 - 12:39
    And we can define the function of ω, given formally by F of ω is equal to
  • 12:39 - 12:46
    the sum from minus infinity to plus infinity of x[n] times e to the -jωn.
  • 12:46 - 12:49
    Now that's a forward transform, so the key question is,
  • 12:49 - 12:55
    can we come back from that F(ω) and when it exists, and we are going to study it (?), when it doesn't,
  • 12:55 - 12:59
    when we have to be careful, the formal inversion would be
  • 12:59 - 13:06
    x[n] = 1 over 2π, the integral of 1 period of F(ω) times e jωn, dω
  • 13:07 - 13:08
    and n is over all integers.
  • 13:10 - 13:15
    Remember, F(ω) is going to be a 2π periodic function, why is that so?
  • 13:15 - 13:18
    Because the exponent is e to the -jωn.
  • 13:18 - 13:24
    If you add 2π to ω, nothing will change in the formal sum for F(ω).
  • 13:24 - 13:26
    And that's why, in the inversion formula,
  • 13:26 - 13:32
    we take the integral between -π and π.
  • 13:32 - 13:36
    Because of the periodicity, we typically write, not F(ω),
  • 13:36 - 13:41
    but the transform of x[n] as X of e to the jω.
  • 13:41 - 13:47
    This is not necessary, but it's really to be always conscious that X is a capital X,
  • 13:47 - 13:51
    a Discrete-Time Fourier Transform is indeed a 2π periodic function.
  • 13:51 - 13:57
    By convention, x of e to the jω is mapped to the interval, -πi to π.
  • 13:57 - 14:01
    Any other contiguous interval of length 2π would be fine as well,
  • 14:01 - 14:04
    since it's a periodic function.
  • 14:04 - 14:09
    Let us compute an example of a DTFT. The signal is shown here.
  • 14:09 - 14:14
    It's a one-sided decaying geometric series, so the definition is
  • 14:14 - 14:20
    α to the n with an α that is smaller than 1 in magnitude, times the step function un
  • 14:20 - 14:21
    So it starts at 0=1, and then decays exponentially towards 0, at infinity.
  • 14:26 - 14:32
    To compute the DTFT, we first write down the formal definition,
  • 14:32 - 14:37
    so it's the infinite some of x[n]e to the -jωn.
  • 14:37 - 14:43
    This sum is one-sided from 0 to infinity of α to the n, e to the -jωn.
  • 14:43 - 14:48
    We gather the terms α e to the -jω. raised to the nth power.
  • 14:48 - 14:51
    And now, we remember the magic formula,
  • 14:51 - 14:55
    which is a one-sided infinite sum of the geometric series,
  • 14:55 - 15:01
    it's 1 over 1 minus the term that is raised to the power,
  • 15:01 - 15:04
    which here is, αe to the -jω.
  • 15:04 - 15:06
    So we can see this is fairly easily to compute,
  • 15:06 - 15:13
    because in this example we of course know all the details and how to figure them out.
  • 15:13 - 15:16
    We can look at the square magnitude of this DTFT,
  • 15:16 - 15:19
    so that's X of e to jω, magnitude squared.
  • 15:19 - 15:26
    This is simply 1 over, and then we need to multiply the denominator by its complex conjugate,
  • 15:26 - 15:33
    which ends up being 1 plus α squared minus 2α cosω.
  • 15:33 - 15:35
    We would like now to plot this DTFT,
  • 15:35 - 15:39
    so this is slightly different from what we have done for the DFT.
  • 15:39 - 15:45
    We put the 0 frequency n in the middle and we plot from -πi to +π.
  • 15:45 - 15:51
    The positive frequencies go from 0 to π, the negative ones from 0 to -π.
  • 15:51 - 15:58
    Low frequencies are around the origin. High frequencies are towards π and -π.
  • 16:00 - 16:04
    Let us now plot the DTFT we have just calculated.
  • 16:04 - 16:09
    We see here the example for α is equal to 0.9,
  • 16:09 - 16:10
    so it has a maximum at the origin
  • 16:10 - 16:16
    and then decays rapidly towards π.
  • 16:16 - 16:18
    Now remember that the DTFT is periodic,
  • 16:18 - 16:23
    so here is the first period between -π and π.
  • 16:23 - 16:30
    We add the second period, a third period, the fourth period,
  • 16:33 - 16:40
    and we see now this periodic signal that will extend to infinity.
  • 16:40 - 16:42
    Now we are ready to really compute
  • 16:42 - 16:47
    the Discrete-Time Fourier Transform of a real Karplus-Strong signal.
  • 16:47 - 16:52
    So let's take the sawtooth wave of length 32 that we have seen before,
  • 16:52 - 16:58
    the equation is given here, and the graph is displayed at the bottom.
  • 16:58 - 17:03
    So if we look at the symbol y[n], it is built up from u[n], the step function,
  • 17:03 - 17:06
    so it's one-sided to the right,
  • 17:06 - 17:11
    then we have a repetition of the sawtooth, that's x overbar,
  • 17:11 - 17:13
    whereas the index is taken (?) module M.
  • 17:13 - 17:18
    And finally, there is a decay by α to the power of the number of periods,
  • 17:18 - 17:25
    this we can write as taking (?) n/M, and then taking the integer part.
  • 17:25 - 17:32
    To compute the DTFT, we first write formally the expression of the DTFT,
  • 17:32 - 17:35
    so the sum of yne to the -jωn.
  • 17:35 - 17:40
    Then, we split the infinite sum into two sums.
  • 17:40 - 17:44
    One which is over the period, that's going to be a one-sided infinite sum,
  • 17:44 - 17:47
    p from zero to infinity,
  • 17:47 - 17:52
    and a second sum, which is the sum over a period.
  • 17:52 - 17:55
    Then we have α to the p, because that's the decay.
  • 17:55 - 18:00
    Then we have x overbar multiplied by e to the -jω,
  • 18:00 - 18:02
    where we simply have written now,
  • 18:02 - 18:09
    the initial index decomposed into n+pM.
  • 18:09 - 18:13
    The next step is to separate these two summations because they don't interact
  • 18:13 - 18:19
    and we have the summation over p, which is the DTFT,
  • 18:19 - 18:22
    essentially of the sequence α to the p
  • 18:22 - 18:29
    and the DTFT of one period from 0 to capital N minus 1 of x overbar.
  • 18:29 - 18:32
    And so the expression is going to have two components,
  • 18:32 - 18:36
    one that we call A of e to the jωM, another one,
  • 18:36 - 18:43
    which we call X overbar, which is a DTFT of one period.
  • 18:44 - 18:50
    A to the e jω is easy, because that's a DTFT of the one-sided geometric series,
  • 18:50 - 18:54
    we had calculated it just before we show here in the picture.
  • 18:54 - 19:01
    This is taken to the nth power of e to the jω, so that rescales the frequency,
  • 19:02 - 19:05
    so the periodicity is going to be changed by this rescaling factor.
  • 19:05 - 19:12
    So we show here, first for M=1, then M=2, M=3,
  • 19:13 - 19:16
    and for example, M=12.
  • 19:16 - 19:21
    You can see now the repetition pattern is not a periodicity of 2π,
  • 19:21 - 19:27
    but the periodicity of 2 π divided by 12.
  • 19:27 - 19:33
    Now we need the DTFT of one period of the sawtooth, we can go through this exercise
  • 19:33 - 19:35
    and indeed it is left as an exercise.
  • 19:35 - 19:39
    You see here, the expression, it looks a little bit complicated,
  • 19:39 - 19:43
    but it is simple algebraic manipulation that lead to it.
  • 19:43 - 19:48
    So spectrum or the magnitude of the spectrum is shown at the bottom.
  • 19:48 - 19:51
    It has a 0 at the origins, that, of course, we know,
  • 19:51 - 19:58
    and then it has a very particular and decaying pattern with repetitions.
  • 19:58 - 20:00
    Now we can write out the total spectrum,
  • 20:00 - 20:05
    y of e to the jω is equal to the product A e to the jωM,
  • 20:05 - 20:06
    that's very important.
  • 20:06 - 20:13
    That changes the periodicity multiplied by the spectrum of x overbar,
  • 20:13 - 20:19
    and so we recognize this product, it has the repetition pattern and it has the shaping.
  • 20:19 - 20:26
    If we put the two together, we can see that the repetition pattern come from the periodicity,
  • 20:26 - 20:33
    so in this case for example, M (?) is equal to 32 and the shape is actually the spectral shape
  • 20:33 - 20:38
    and gives the timber of the signal.
  • 20:38 - 20:42
    We can now conclude what we have seen in this sub-module.
  • 20:42 - 20:46
    First, we considered a Fourier Transform for finite-length signals,
  • 20:46 - 20:48
    the so-called Discrete Fourier Transform.
  • 20:48 - 20:51
    We extended it to periodic sequences,
  • 20:51 - 20:56
    to have the Discrete Fourier Series, very closely related to the DFT.
  • 20:56 - 21:01
    And then we saw a Fourier Transform for infinite sequences,
  • 21:01 - 21:03
    that we called a Discrete Time Fourier Transform
  • 21:03 - 21:10
    and we introduced it as the extension or the limit of a Discrete Fourier Series
  • 21:10 - 21:12
    when the period goes to infinity.
  • 21:12 - 21:15
    At the very end, we took all this together
  • 21:15 - 21:20
    and we derived a DTFT for a realistic and complicated signal,
  • 21:20 - 21:24
    namely the Karplus-Strong, with a decay and an interesting spectrum.
  • 21:24 - 21:26
    This was a non trivial exercise,
  • 21:26 - 21:30
    but you could see by putting all the elements together that we have seen so far,
  • 21:30 - 21:32
    we managed to actually understand its spectrum.
Title:
4.4 - DFT, DFS, DTFT [21:37]
Description:

See "Chapter 4 Fourier Analysis" in "Signal Processing for Communications" by Paolo Prandoni and Martin Vetterli, available from http://www.sp4comm.org/ , and the slides for the entire module 4 of the Digital Signal Processing Coursera course, in https://spark-public.s3.amazonaws.com/dsp/slides/module4-0.pdf .

And if you are registered for this Coursera course, see https://class.coursera.org/dsp-001/wiki/view?page=week3

more » « less
Video Language:
English

English subtitles

Incomplete

Revisions