Sie sind auf Seite 1von 6

CTFT, DTFT and DFT, A Practical Approach

Tunc Arlsan
You should know the theory of Fourier Transform (FT) by heart for better
understanding of the frequency domain and its relationships. However, it is also
useful to see the big picture to grasp the idea of sampling and FT relationship.
Thus, here is a practical approach to CTFT, DTFT and DFT.

CTFT

Lets consider a cosine signal with frequency f = 20;


x(t) = cos(2f t).

(1)

This signal is of infinite extent in time domain and the Fourier transform of it
will then have finite extent (in other words, this signal is band limited).
Obviously when we take the Fourier transform of this signal we will end up
with 2 peaks in the frequency domain; However, both the time domain x(t) and

90

0.6

80

0.4

70

0.2

60

Amplitude

Amplitude

1
0.8

0
-0.2

50
40

-0.4

30

-0.6

20

-0.8

10

-1
0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

-80

Time (s)

-60

-40

-20

20

40

60

80

100

Frequency (Hz)

(a) Time domain signal.

(b) CTFT of the time domain signal.

the CTFT of it X(f ) are continuous functions. Thus they can not be stored in
computers. We need to sample them.

DTFT

Since we have the time domain signal at our hand, we can start the sampling
process with it. We sample the time domain signal x(t) with a sampling period
Ts as follows;
x(nTs ) = cos(2f nTs ), n = 0, 1, 2, 3, ....

(2)

One can say that x(nTs ) is also a somewhat continuous signal (since it covers
n Z) however, it is not because n does not belong to the R. Now that
we have a sampled time domain signal, we can try to take the FT of it. We
use discrete time fourier transform (DTFT). DTFT is found by calculating the
following sum;

X
x(nTs )ejn ,
(3)
X() =
n=

where [0, 2]. An important characteristic of DTFT is that it is periodic


with 2. DTFT of the example cosine signal with f = 20 and Fs = 1/Ts = 200
Hz is then as follows;

90

0.6

80

0.4

70

0.2

60

Amplitude

Amplitude

1
0.8

0
-0.2

50
40

-0.4

30

-0.6

20

-0.8

10

-1
20

40

60

80

100

120

140

160

180

200

Sample Number

0.2

0.4

0.6

0.8

1.2

Normalized Frequency (

(a) Sampled time domain signal.

1.4

1.6

1.8

(b) DTFT of the time domain signal.

Here we sampled the time domain with Fs = 200 Hz, however, the frequency
domain is still continuous ( takes real values between [0 2]). This has several
implications. The most important one is that, when we sample a signal with a
sampling frequency Fs , we are unable to correctly capture the frequency characteristics of the signal that have frequency components more than F2s . This
is also called the Nyquist-Shannon sampling theorem. Aliasing occurs when a
signal is sub sampled. A real life example of this is in Figs. 3a and 3b. Another
important thing is that the DTFT is periodic with 2. Thus the Fig. 2b actually
goes to with its own duplications. This periodic behavior in the frequency
domain comes from the theory of DTFT and is not explained here.

(a) Properly sampled image.

(b) Sub sampled image has pattern problems due to aliasing.

DTF

Now that we sampled the time domain signal and we were able to take the FT
of it using DTFT, we are going to sample the spectrum of the signal using DFT.
DFT is calculated using the following equation;
X[k] =

N
1
X

x[n]ej2kn/N ,

(4)

n=0

where k = 0, 1, 2, ..., K 1 is the sampled frequency axis and x[n] = x[nTs ] with
total number of N samples. The following graphs are the DFT of the same
cosine signal with f = 20 Hz. As you can see from Fig. 4b, the spectrum is now

90

0.6

80

0.4

70

0.2

60

Amplitude

Amplitude

1
0.8

0
-0.2

50
40

-0.4

30

-0.6

20

-0.8

10

-1

0
20

40

60

80

100

120

140

160

180

200

Sample Number

20

40

60

80

100

120

140

160

180

Sampled Frequency (K = 200)

(a) Sampled time domain signal.

(b) DFT of the time domain signal.

sampled and we can store these values without a problem in a computer.

200

Thus we can conclude the relationship between CTFT, DTFT and DFT as
follows;
CT F T (f1 ) = DT F T[0 2] (1 = 2

f1
f1
) = DF T (k1 = K ),
Fs
Fs

(5a)

f1
f1
) = DF T (k1 = K K ), (5b)
Fs
Fs
where f1 is one of the frequency components of the signal of concern, Fs is the
sampling frequency and is assumed to be Fs > 2Fmax and K is the size of the
DFT and is assumed to be K = N = Fs . With these equations, you can easily
calculate the positions of the frequency components of a signal in CTFT, DTFT
and DFT domains.
As an example, for signal in Eq. (1) with Fs = 200 and K = 200,
CT F T (f1 ) = DT F T[0 2] (1 = 2 2

4
4.1

CT F T (20) = DT F T[0 2] (0.2) = DF T (20),

(6a)

CT F T (20) = DT F T[0 2] (1.8) = DF T (180),

(6b)

Important Remarks
Frequency F as a Fractional Number

Lets consider the case where f = 20.3 Hz instead of 20 for Eq. (1) and try
to take its DFT with K = 200. As you can see we observe a DFT with some

80
70

Amplitude

60
50
40
30
20
10
0
20

40

60

80

100

120

140

160

180

200

Sampled Frequency (K = 200)

Figure 5: DFT of the time domain signal with f = 20.3 Hz.


distorted shape. Why does this happen? Lets try to apply the Eq. (5a) and
(5b) with f = 20.3 and K = 200. The result should be, k1 = 20.3 and k2 =
200 20.3 = 179.7. However, since DFT is a sampled version of DTFT, k can
not take fractional values, only integers. Then what computer does is, simply
ceils or floors the k value and then compensates the rest of the DFT calculation
accordingly. If you are to solve the exact DFT with the DFT equation, you can
see this more clearly.
4

4.2

DFT Size K > N

90

90

80

80

70

70

60

60

Amplitude

Amplitude

What happens if we have a sampled signal with Fs = 200 Hz and 200 samples
of it but we take K = 400 as size of DFT in MATLAB? As you can see, there is

50
40

50
40

30

30

20

20

10

10
0
20

40

60

80

100

120

140

160

180

200

Sampled Frequency (K = 200)

50

100

150

200

250

300

350

400

Sampled Frequency (K = 400)

(a) DFT of the time domain signal with (b) DFT of the time domain signal with
K = 200.
K = 400.

a distortion at the output of the DFT with K = 400. This has to do with how
MATLAB implements the DFT. First of all, we already know that when we take
the FT of a discontinuous signal, we observe the so called Gibbs effect which
creates ripples at the spectrum. We have a cosine signal with total number of
samples 200, when MATLAB is ordered to take DFT of it with K = 400, it
simple adds 0s to the end of the signal with a total of K N of them. This
is effectively windowing the cosine signal with a rectangular window and it
creates a discontinuity. We also know that the FT of a rectangular window is a
sinc function which has rippes around the origin. Thus a distorted DFT shape
instead of two perfect impulses.
4.2.1

DFT of a Realizable Filter

The previous behavior of the DFT is similar to adding a windowing function to


a filter. In the lectures you have seen that you can create an ideal filter using:
sin[n]
, n = 0, 1, 2, ...
(7)
n
However, this filter is of infinite extent in n and is not realizable in computers
since we dont have infinite memory. What we do is, we apply a window function, such as a rectangular window, to this filter. These window functions also
create discontinuities at the time domain (n domain) which also results with
the Gibbs effect and creates the ripples at the frequency domain instead of
perfectly shaped rectangles and transition bands. Thus in order to store a
filter on a computer (or any other signal), we sacrifice a bit from its
time and frequency properties. This is called design and is heart
of engineering.
h[n] = sinc[n] =

4.3

DFT Size K < N

This is up for you to search and learn.

Conclusion

FT is a powerful tool to learn more about a signal and play with its properties.
But with power, comes great responsibility. When you are sampling a signal or
taking FT, be careful.

Das könnte Ihnen auch gefallen