43

I have read many articles about DTFT and DFT but am not able to discern the difference between the two except for a few visible things like DTFT goes till infinity while DFT is only till $N-1$. Can anyone please explain the difference and when to use what? Wiki says

The DFT differs from the discrete-time Fourier transform (DTFT) in that its input and output sequences are both finite; it is therefore said to be the Fourier analysis of finite-domain (or periodic) discrete-time functions.

Is it the only difference?

Edit: This article nicely explains the difference

OverLordGoldDragon
  • 8,912
  • 5
  • 23
  • 74
BaluRaman
  • 689
  • 3
  • 8
  • 12
  • 9
    The DTFT is a continuous function of frequency, but the DFT is a discrete function of frequency. – John May 29 '14 at 11:09
  • 1
    The key point is , DFT is sampled version of DFT and the rate is the length of DFT – nmxprime Nov 02 '14 at 03:17
  • 1
    @nmxprime You mean DFT is sampled version of DTFT? – endolith Aug 28 '16 at 16:51
  • 1
    @endolith Yes.it is – nmxprime Sep 03 '16 at 07:37
  • The article you linked (page 2) says that "CTFT gave us a discrete frequency spectrum". Isn't that wrong? I thought frequency was continuous in that case of continuous time aperiodic signal undergoing the Fourier Transform. – Aditya P Nov 20 '18 at 15:53
  • 1
    @AdityaP You are right, there is a mistake there. But overall, a very interesting and insightful article. – SmarthBansal Feb 23 '21 at 07:33
  • DFT: $$ X[k]=\sum_{n=0}^{N−1} x[n] e^{−j2\pi nk/N} $$ Its inverse will be: $$ x[n]=\frac{1}{N} \sum_{k=0}^{N−1} X[k] e^{j2\pi nk/N} $$ – user25761 Jan 05 '17 at 14:26

5 Answers5

25

Alright, I'm gonna answer this with an argument that "opponents" to my rigid nazi-like position regarding the DFT have.

First of all, my rigid, nazi-like position:

The Discrete Fourier Transform and Discrete Fourier Series are one-and-the-same.

The DFT maps one infinite and periodic sequence, $x[n]$ with period $N$ in the "time" domain to another infinite and periodic sequence, $X[k]$, again with period $N$, in the "frequency" domain. And the iDFT maps it back. and they're "bijective" or "invertible" or "one-to-one".

DFT: $$ X[k] = \sum\limits_{n=0}^{N-1} x[n] e^{-j 2 \pi nk/N} $$

iDFT: $$ x[n] = \frac{1}{N} \sum\limits_{k=0}^{N-1} X[k] e^{j 2 \pi nk/N} $$

That is most fundamentally what the DFT is. It is inherently a periodic or circular thing.

$$ x[n+N]=x[n] \qquad \forall n \in \mathbb{Z} $$ $$ X[k+N]=X[k] \qquad \forall k \in \mathbb{Z} $$

But the periodicity deniers like to say this about the DFT. It is true, it just doesn't change any of the above.

So, suppose you had a finite-length sequence $x[n]$ of length $N$ and, instead of periodically extending it (which is what the DFT inherently does), you append this finite-length sequence with zeros infinitely on both left and right. So

$$ \hat{x}[n] \triangleq \begin{cases} x[n] \qquad & \text{for } 0 \le n \le N-1 \\ \\ 0 & \text{otherwise} \end{cases} $$

Now, this non-repeating infinite sequence does have a DTFT:

DTFT: $$ \hat{X}\left(e^{j\omega}\right) = \sum\limits_{n=-\infty}^{+\infty} \hat{x}[n] e^{-j \omega n} $$

$\hat{X}\left(e^{j\omega}\right)$ is the Z-transform of $\hat{x}[n]$ evaluated on the unit circle $z=e^{j\omega}$ for infinitely many real values of $\omega$. Now, if you were to sample that DTFT $\hat{X}\left(e^{j\omega}\right)$ at $N$ equally spaced points on the unit circle, with one point at $z=e^{j\omega}=1$, you would get

$$ \begin{align} \hat{X}\left(e^{j\omega}\right)\Bigg|_{\omega = 2 \pi\frac{k}{N}} & = \sum\limits_{n=-\infty}^{+\infty} \hat{x}[n] e^{-j \omega n} \Bigg|_{\omega = 2 \pi\frac{k}{N}} \\ & = \sum\limits_{n=-\infty}^{+\infty} \hat{x}[n] e^{-j 2 \pi k n/N} \\ & = \sum\limits_{n=0}^{N-1} \hat{x}[n] e^{-j 2 \pi k n/N} \\ & = \sum\limits_{n=0}^{N-1} x[n] e^{-j 2 \pi k n/N} \\ & = X[k] \\ \end{align} $$

That is precisely how the DFT and DTFT are related. Sampling the DTFT at uniform intervals in the "frequency" domain causes, in the "time" domain, the original sequence $\hat{x}[n]$ to be repeated and shifted by all multiples of $N$ and overlap-added. That's what uniform sampling in one domain causes in the other domain. But, since $\hat{x}[n]$ is hypothesized to be $0$ outside of the interval $0 \le n \le N-1$, that overlap-adding does nothing. It just periodically extends the non-zero part of $\hat{x}[n]$, our original finite-length sequence, $x[n]$.

robert bristow-johnson
  • 20,661
  • 4
  • 38
  • 76
  • 4
    The accepted answer was good, but I found your answer to be more insightful. Thank you for providing the actual mathematical connection between the DTFT and DFT... especially the sampling of the spectra causing periodicity in the time-domain. That is a point I always forget. – rayryeng Feb 05 '15 at 16:40
  • Your second paragraph seems to imply that DFTs accept input sequences that are infinite in length. Has anyone ever performed an infinite-length DFT? – Richard Lyons May 22 '15 at 11:28
  • hey Rick, it's good to see you here from comp.dsp. i remember being greeted by @PeterK when i first sorta migrated over (but i will never leave comp.dsp). anyway, to the same degree that the DFS accepts an input sequence of infinite length is the degree that the DFT accepts an input that is of infinite length. all's i'm saying is that the DFT and the DFS are one-and-the-same. – robert bristow-johnson May 22 '15 at 14:46
  • 1
    @robert bristow-johnson. this was a beautiful explanation. my question may be bad but, by discrete fourier series, you are referring to the case where the input is a continuous periodic function that goes on infinitely in both directions, correct ? From what I remember say, from reading george silov's dover book, if you make the number of fourier coefficients large enough by using a fine enough grid of frequencies, then the fourier series can reproduce a period continuous function arbitrarily closely. this is the fs you're referring to, when you say they it is the same as DFT, correct ? thx. – mark leeds Oct 26 '17 at 06:52
  • by Discrete Fourier Series, i mean the same thing as the DFT and iDFT definitions shown in the answer:

    $$ X[k] = \sum\limits_{n=0}^{N-1} x[n] e^{-j 2 \pi nk/N} $$ $$ x[n] = \frac{1}{N} \sum\limits_{k=0}^{N-1} X[k] e^{j 2 \pi nk/N} $$

    and, for both $x[n]$ and $X[k]$, they are periodic with a period $N$:

    $$ x[n+N] = x[n] \qquad \forall n \in \mathbb{Z} $$ $$ X[k+N] = X[k] \qquad \forall k \in \mathbb{Z} $$

    and $N$ is a positive integer. that's all i mean by the DFS.

    – robert bristow-johnson Oct 26 '17 at 08:22
  • o.k. gotcha. the FS that I see is in math books ( atleast the one I have looked at ) uses f(x) because the input is a periodic continuous function rather than sample data but that's probably just semantics when applied to DSP. thanks.. – mark leeds Oct 26 '17 at 15:59
  • Hold on now. I'm finally putting all the pieces together. I assumed that "DFT samples DTFT" demands that $x$ be periodic over $(-\infty, \infty)$ - that one period and everything else is zeros also works, as I discovered and you affirmed in this answer, isn't that a major blow? You say "all theorems require it", yet the main one doesn't? Is your sole claim that iDFT extends $x$ periodically? Btw, to your other answer, no, circular convolution does not require periodic extension; can you visualize the convolution theorem? All that's needed is linearity and the shift property. – OverLordGoldDragon May 24 '23 at 20:11
  • In fact $x$ must be zero outside of $[0, N-1]$, else the DTFT very blatantly diverges, of which the DFT can't possibly be a sampling of... It took me hours to resolve all this nonsense I've been lead to believe. I'm reading the same words here and getting a very different interpretation after I figured it out. Digged all the way to distribution equality proofs. This is the effect of insisting on periodicity everywhere. You know the nuance yet pretend it doesn't exist. Just because of an unrelated "extending". – OverLordGoldDragon May 25 '23 at 01:55
  • I have a counter example for you, O... – robert bristow-johnson May 25 '23 at 01:55
  • So, suppose we, by definition, extend $x[n]$ as such: $$ \hat{x}[n] = \begin{cases} \frac{1}{N} \sum\limits^{N-1}_{k=0} X[k] \ e^{+j2\pi n k/N}, & 0 \le n \le N-1 \ \left(2 \right)^{-\lfloor n/N \rfloor}, & n \ge N \ -\left(2 \right)^{\lfloor n/N \rfloor}, & n < 0 \end{cases} $$

    What happens when you first create the DTFT of that (and it converges, no dirac deltas in this DTFT) and then sample the result with $N$ equally-spaced points around the unit circle like we do in this answer? What do you get for $\hat{X}\left(e^{j\omega}\right)\Bigg|_{\omega = 2 \pi\frac{k}{N}}$?

    – robert bristow-johnson May 25 '23 at 02:12
  • You're lucky I saw this reply, remember I'm not notified without @ with >1 responders -- reading – OverLordGoldDragon May 25 '23 at 02:16
  • Ok, "must be zero else diverges" is of course false, I misspoke there - meant as opposed to periodic. I don't know what the DTFT of that is, did you mean to use a positive exponent for $n \geq N$ so that it cancels with the $n < 0$? Corrected, it's "must be equivalently zero else DFT isn't sampling of DTFT" - and, okay, that's a valid, but I've yet to think of how meaningful, counter. I'm still slow with DTFT so tell me your intended result and I'll work on justifying it to myself. Also I can't understand the z transform stuff and it's not needed anyway – OverLordGoldDragon May 25 '23 at 02:23
  • When you uniformly sample in one domain, it always causes periodic extension in the other domain. So ask yourself what is:

    $$ \tilde{x}[n] \triangleq \sum\limits_{m=-\infty}^{\infty} \hat{x}[n-mN] $$ ?

    – robert bristow-johnson May 25 '23 at 02:27
  • If you want to talk to yourself, you can do that. Sampling causes periodic overlapped summing, not periodic extension. To your question, I don't know, I tried. You seem to be trying to set up a cancellation upon said overlap-adding, but it doesn't appear to work. It works with $1, n\geq N$ and $-1, n < 0$ though. As for what this has to do with anything, let's see. Make DTFT and sample. This makes $\hat x[n]$ periodic exactly the same as it would with originally zero extension. Relation to your periodicity claim is, of all things, circular. And diverges. – OverLordGoldDragon May 25 '23 at 03:03
  • @OverLordGoldDragon do you know what the floor(.) notation is? $\lfloor x \rfloor$ means the largest (or least negative) integer no larger than $x$. – robert bristow-johnson May 25 '23 at 04:33
  • Didn't think it'd matter, still sort of not there but let's say I messed up something else. (Make it exact if you wish). Yes I get the idea, stuff cancels. It's a good insight, but a side one. – OverLordGoldDragon May 25 '23 at 04:42
24

The discrete-time Fourier transform (DTFT) is the (conventional) Fourier transform of a discrete-time signal. Its output is continous in frequency and periodic. Example: to find the spectrum of the sampled version $x(kT)$ of a continous-time signal $x(t)$ the DTFT can be used.

The discrete Fourier transform (DFT) can be seen as the sampled version (in frequency-domain) of the DTFT output. It's used to calculate the frequency spectrum of a discrete-time signal with a computer, because computers can only handle a finite number of values. I would argue against the DFT output being finite. It is periodic as well and can therefore be continued infinitely.

To sum it up:

                DTFT                | DFT
       input    discrete, infinite  | discrete, finite *)
       output   contin., periodic   | discrete, finite *)

*) A mathematical property of the DFT is that both its input and output are periodic with the DFT length $N$. That is, although the input vector to the DFT is finite in practice, it's only correct to say that the DFT is the sampled spectrum if the DFT input is thought to be periodic.

Deve
  • 4,255
  • 17
  • 26
  • 1
    did you not mean that the DTFT input is infinite? – Lutz Lehmann May 29 '14 at 11:15
  • @LutzL It can be infinite in general, yes. I'll change that. What about the DFT output: would you rather call it finite or periodic? – Deve May 29 '14 at 11:22
  • i think output of DFT is N-periodic, finite sequence – BaluRaman May 29 '14 at 11:27
  • 1
    In the DFT, much depends on interpretation. From the technical point of view, it transforms finite to finite. From the point of view that it computes the coefficients of a trigonometric polynomial, one might say that it transforms infinite discrete periodic to finite. But one can shift the window of frequencies used to represent the input, and the amplitudes over all possible frequencies form again a periodic sequence. – Lutz Lehmann May 29 '14 at 11:38
  • 1
    To be more consistent I would put "periodic" instead of "finite" for the input of the DFT. This is a direct consequence of the DFT (output) being discrete. – Matt L. May 29 '14 at 14:10
  • If the input to the DFT is assumed to be a finite length window, then to preserve energy (Parseval), the output is also a finite length vector. The window is usually upon a very non periodic signal. – hotpaw2 May 29 '14 at 17:46
  • Thanks for all your comments. I tried to reflect them in my edited post. – Deve Jun 01 '14 at 12:45
  • The controversy on DFT , John Baptiste Fourier made all members of the royal society convinced saying the input to DFT is imagined-infinitive. It was the time when Laplace doubted Fourier of his theory – nmxprime Nov 02 '14 at 03:24
  • Mathematical, a fourier transform of a finite signal (in time), will be always infinite. This accures because of the high (up to infinite...) frequencies in the edges of the time signal. In fact, we usually use discrete signals in time, so (again, by mathematical definition) the fourier transform is periodic. Therefore, it's useless to handle with all the infinite periodic transform, so we use only one period. [This is not conflicted with Parseval's theorem because the values in high frequencies are very very low]. As mentioned, DFT can be referred as samples of the continuous DTFT. – Adiel Nov 02 '14 at 09:17
2

If we were to compute a continuous DTFT, sample one cycle of it uniformly, and perform an inverse DFT, we would obtain one cycle of a periodic summation of the original infinite, aperiodic time sequence. Conversely, if we were to compute one cycle of a periodic summation of the original infinite, aperiodic time sequence, and perform a DFT, we would obtain samples of one cycle of the continuous DTFT.

Bob K
  • 127
  • 8
1

If I am correct, even if DFT input is periodic, although the number of samples is finite, the mathematics behind it treats it as an infinite sequence which periodically commences the N samples after its termination. Please correct me if I am wrong.

lennon310
  • 3,590
  • 19
  • 24
  • 27
ubuntu_noob
  • 148
  • 4
  • some at comp.dsp that i've had arguments with might "correct" you, but they're wrong. there is no difference between the DFT and the Discrete Fourier Series. none whatsoever. – robert bristow-johnson Nov 01 '14 at 15:36
  • To help me understand what's being said here, I have a question regarding the output of the operation you call a "Discrete Fourier series". Is that output a sequence of numbers or a continuous function (an equation)? – Richard Lyons May 22 '15 at 12:04
1

Since DTFT output is continuous, it can not be processed with computers. So we have to convert this continuous signal into discrete form. It is nothing but DFT as a further advancement on FFT to reduce calculations.

lennon310
  • 3,590
  • 19
  • 24
  • 27