# Difference between CTFT and DTFT?

I have tried to read different articles but still confused in difference between continuous time Fourier transform and discrete time Fourier transform?

The difference is pretty quickly explained: the CTFT is for continuous-time signals, i.e., for functions $$x(t)$$ with a continuous variable $$t\in\mathbb{R}$$, whereas the DTFT is for discrete-time signals, i.e., for sequences $$x[n]$$ with $$n\in\mathbb{Z}$$.

That's why the CTFT is defined by an integral and the DTFT is defined by a sum:

$$X(j\Omega)=\int_{-\infty}^{\infty}x(t)e^{-j\Omega t}dt\tag{1}$$

$$X(e^{j\omega})=\sum_{n=-\infty}^{\infty}x[n]e^{-j\omega n}\tag{2}$$

Note that in both cases, the frequency variables $$\Omega$$ and $$\omega$$ are continuous variables.

There is also the discrete Fourier transform (DFT), which can be applied to finite length (or periodic) sequences:

$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi kn/N}\tag{3}$$

It is easily shown that DTFT and DFT are related as:

$$X\left(e^{j\omega}\right)\Bigg|_{\omega = 2 \pi\frac{k}{N}} = X[k]$$

when $$x[n]=0$$ for all $$n<0$$ or $$n\ge N$$.

Note that the DFT of the length $$N$$ sequence $$x[n]$$ is also a length $$N$$ sequence $$X[k]$$. The DFT is important because there exist efficient algorithms to compute $$(3)$$. This class of algorithms is called Fast Fourier Transform (FFT).

The DFT can be used to approximately compute samples of the DTFT and of the CTFT. For finite length sequences, the DFT computes (exact) samples of the DTFT. For longer (or infinitely long) sequences, there is always a truncation error caused by considering only a finite length window of the data. When approximating the CTFT, there are two error sources: the truncation error, and the aliasing error caused by sampling the continuous-time signal. Since a signal cannot be time-limited and band-limited at the same time, at least one of those two errors is non-zero.

I'll add a couple more facts, to sorta complete the definitions of things. As Matt represented the CTFT and DTFT, they are both shown as special cases of the Laplace Transform and Z Transform (respectively) evaluated on the border between the "stable region" and "unstable region" of the respective complex planes.

The Laplace Transform $$X^\mathscr{L}(s) \triangleq \mathscr{L}\Big\{x(t) \Big\} = \int_{-\infty}^{\infty}x(t)e^{-s t} \, \mathrm{d}t$$

is evaluated on the imaginary axis: $$s=j\Omega$$ to become the continuous-time Fourier Transform (CTFT):

$$X^\mathscr{L}(j\Omega) = X^\mathscr{L}(s)\Bigg|_{s=j\Omega} = \int_{-\infty}^{\infty}x(t)e^{-j\Omega t} \, \mathrm{d}t$$

And the Z Transform

$$X^\mathcal{Z}(z) \triangleq \mathcal{Z}\Big\{x[n]\Big\} = \sum_{n=-\infty}^{\infty}x[n]z^{-n}$$

is evaluated on the unit circle: $$z=e^{j\omega}$$ to become the discrete-time Fourier Transform (DTFT):

\begin{align} X^\mathcal{Z}(e^{j\omega})=X^\mathcal{Z}(z)\Bigg|_{z=e^{j\omega}} &= \sum_{n=-\infty}^{\infty}x[n](e^{j\omega})^{-n} \\ \\ &= \sum_{n=-\infty}^{\infty}x[n]e^{-j\omega n} \\ \end{align}

Here I am superscripting $$X^\mathscr{L}(s)$$ and $$X^\mathcal{Z}(z)$$ to emphasize the fact that they are different functions, and not the same function evaluated with different arguments $$s$$ or $$z$$ (or with $$j\Omega$$ or $$e^{j\omega}$$). Normally we leave off that clutter, so when $$X(\cdot)$$ is presented to you, you need to be clear from the context whether it's a Laplace Transform evaluated over the $$s$$-plane or a Z Transform evaluated over the $$z$$-plane.

Then there is a relationship between the CTFT and the DTFT, which is exactly the relationship between the Laplace Transform and the Z Transform. This comes from the relationship of the continuous-time signal $$x(t)$$ and its discrete-time counterpart $$x[n]$$.

$$x[n] \triangleq x(nT)$$

where $$T$$ is the sampling period and is the reciprocal of the sample rate $$f_\mathrm{s} \triangleq \frac{1}{T}$$ . The continuous-time representation of the ideally-sampled $$x(t)$$ is

\begin{align} x_\mathrm{s}(t) &\triangleq x(t) \cdot \left( T \sum_{n=-\infty}^{\infty} \delta(t-nT) \right)\\ &= T \sum_{n=-\infty}^{\infty} x(t) \delta(t-nT) \\ &= T \sum_{n=-\infty}^{\infty} x(nT) \delta(t-nT) \\ &= T \sum_{n=-\infty}^{\infty} x[n] \delta(t-nT) \\ \end{align}

Now $$x_\mathrm{s}(t)$$ is still a continuous-time function of $$t$$, even though it is non-zero only at discrete instances of time: $$t=nT$$, so the Laplace Transform or CTFT are the transform operations appropriate to it. That is:

\begin{align} X_\mathrm{s}(s) \triangleq \mathscr{L}\Big\{x_\mathrm{s}(t) \Big\} &= \int_{-\infty}^{\infty} x_\mathrm{s}(t) e^{-s t} \, \mathrm{d}t \\ \\ &= \int_{-\infty}^{\infty} T \sum_{n=-\infty}^{\infty} x[n] \delta(t-nT) e^{-s t} \, \mathrm{d}t \\ \\ &= T \sum_{n=-\infty}^{\infty} x[n] \ \int_{-\infty}^{\infty} e^{-s t} \delta(t-nT) \, \mathrm{d}t \\ \\ &= T \sum_{n=-\infty}^{\infty} x[n] e^{-s nT} \\ \end{align}

Now if we were, perhaps as a shorthand of notation (but there are other good reasons), to make the substitution: $$z \triangleq e^{sT}$$, the above summation looks just like the Z transform with an additional factor of $$T$$ multiplying:

\begin{align} \mathscr{L}\Big\{x_\mathrm{s}(t) \Big\}\Bigg|_{z=e^{sT}} = X_\mathrm{s}(s)\Bigg|_{z=e^{sT}} &= T \sum_{n=-\infty}^{\infty} x[n] e^{-s nT}\Bigg|_{z=e^{sT}} \\ \\ &= T \sum_{n=-\infty}^{\infty} x[n] z^{-n} \\ \end{align}

Now let's return to the use of the superscripts $$X^\mathscr{L}(\cdot)$$ and $$X^\mathcal{Z}(\cdot)$$ to make sure we don't confuse the functions of $$s$$ or $$z$$.

This says that the Laplace Transform of the ideally-sampled $$x(t)$$ is the same as the Z Transform of the samples $$x[n]$$ with a scaling factor of $$T$$ tossed in (which we will explain below) and the substitution of $$z \triangleq e^{sT}$$.

\begin{align} \mathscr{L}\Big\{x_\mathrm{s}(t) \Big\}\Bigg|_{z=e^{sT}} = X_\mathrm{s}^\mathscr{L}(s)\Bigg|_{z=e^{sT}} &= T \sum_{n=-\infty}^{\infty} x[n] e^{-s nT}\Bigg|_{z=e^{sT}} \\ \\ &= T \sum_{n=-\infty}^{\infty} x[n] z^{-n} \\ \\ &= T \mathcal{Z}\Big\{x[n]\Big\} \\ \\ &= T X^\mathcal{Z}(z) \\ \end{align}

Or relating the CTFT of the ideally sampled $$x_\mathrm{s}(t)$$ to the DTFT of the samples $$x[n]$$:

$$X_\mathrm{s}^\mathscr{L}(j\Omega) = T X^\mathcal{Z}(e^{j \omega})\Bigg|_{\omega = \Omega T}$$

What about that factor of $$T$$? This comes about by being careful with the pedagogy. It has been my opinion for 4 decades that nearly all of the Electrical Engineering discrete-time Signals and Systems books gets this pedagogy wrong and they end up placing this $$T$$ factor in with the passband gain of the ideal reconstruction filter, where it does not belong. In this answer (and some other answers I think) we can show that if the original $$x(t)$$ is uniformly sampled with a periodic train of dirac delta functions (something called the Dirac comb) and including this $$T$$ factor with the periodic train of dirac deltas, then we know that this periodic function, which can be represented as a Fourier Series, has Fourier coefficients that are all equal to $$1$$:

$$T \sum_{n=-\infty}^{\infty} \delta(t-nT) = \sum_{k=-\infty}^{\infty} 1 \cdot e^{j 2 \pi k t/T}$$

So

\begin{align} x_\mathrm{s}(t) &\triangleq x(t) \cdot \left( T \sum_{n=-\infty}^{\infty} \delta(t-nT) \right)\\ &= x(t) \cdot \sum_{k=-\infty}^{\infty} e^{j 2 \pi k t/T} \\ &= \sum_{k=-\infty}^{\infty} x(t) \cdot e^{j k (2 \pi/T) t} \\ \end{align}

What this does to the spectrum of the sampled function $$X_\mathrm{s}(j\Omega)$$ (leaving off the superscript $$\mathscr{L}$$) is that it causes the spectrum of the original function $$X(j\Omega)$$ to be repeated at intervals of $$\frac{2 \pi}{T}$$ and overlapped and added:

$$X_\mathrm{s}(j\Omega) = \sum_{k=-\infty}^{\infty} X \big(j(\Omega - k \tfrac{2 \pi}{T})\big)$$

The Sampling Theorem tells us that if the original $$x(t)$$ is bandlimited so that

$$X(j\Omega)=0 \qquad \text{for all } |\Omega| \ge \frac{\pi}{T}$$

then there is no overlapping of non-zero components and the baseband of $$X(j\Omega)$$ remains unchanged (which means that we can recover $$x(t)$$ without any aliases). That is

$$X(j\Omega) = X_\mathrm{s}(j\Omega) \qquad \text{for } |\Omega| < \frac{\pi}{T}$$

Note that now there is no scaling factor of $$\frac{1}{T}$$ in that relationship. In the baseband, the spectrum of the sampled $$x_\mathrm{s}(t)$$ is the same as the spectrum of $$x(t)$$. No conversion factor.

So we call this frequency (in the CTFT domain) of $$\frac{\pi}{T}$$ the (angular) Nyquist frequency. If all frequencies of consideration have absolute value below Nyquist, then we can say this about the CTFT of the original $$x(t)$$ and the DTFT of the samples of $$x(t)$$ that we call "$$x[n]$$":

$$X^\mathscr{L}(j\Omega) \, = \, T \, X^\mathcal{Z}(e^{j \omega})\Bigg|_{\omega = \Omega T} \qquad |\Omega|<\frac{\pi}{T}$$

That is the relationship of the CTFT of the original analog signal to the DTFT of the samples of that original analog signal if it were sampled properly. Note that the factor of $$T$$ is in there and it must be there, despite what pedagogy is used in explaining the Sampling Theorem. We call $$\Omega = 2 \pi f$$, the "angular frequency" in the CTFT (as opposed to "ordinary frequency", $$f$$) and we call $$\omega$$ the normalized angular frequency in the DTFT. In the units of this normalized angular frequency of the DTFT, then Nyquist is always $$\pm \pi$$ which corresponds to $$z=-1$$ on the unit circle. It is at that point that, for real signals $$x[n]$$ we wrap around from the most positive frequency to the most negative in the periodic spectrum of the DTFT, $$X(e^{j \omega})$$ . As a function of a real variable, $$\omega$$, then $$X(e^{j \omega})$$ is inherently periodic with period $$2 \pi$$, because the argument $$e^{j \omega}$$ is periodic with the same period.