Professional Documents
Culture Documents
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5.1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5.3
5.4
5.9
5.12
5.12
5.14
5.15
5.19
5.23
5.24
5.25
5.27
5.29
5.31
5.31
5.2
x[n] = xa (nTs )
Sampling
xa (t)
x[n]
xps [n]
Bandlimited:
Time-limited:
Sinc interpolation
Rectangular window
FT
DTFT
DFT
DTFS
X[k] = X ()|= 2 k
N
Sampling
Bandlimited:
PSfrag replacements
X ()
X[k]
Time-limited:
Rectangular window
Dirichlet interpolation
Sa
pl
le
rc
ni
Ci
tC
it
irc
Un
X(z)
Uniform Time-Domain Sampling
x[n] = xa (nTs )
P
X () = T1s k= Xa /(2)k
(sum of shifted scaled replicates of Xa ())
Ts
Recovering xa (t) from
x[n]
for bandlimited xa (t), where Xa (F ) = 0 for |F | Fs /2
F
Xa (F ) = Ts rect Fs X (2F Ts ) (rectangular window to pick out center replicate)
P
s
xa (t) = n= x[n] sinc tnT
, where sinc(x) = sin(x) /(x). (sinc interpolation)
Ts
le
Xa (F )
DTFS
ck =
1
N
PN 1
2
N kn =
n=0 xps [n] e
PN 1
2
N kn
, k =
k=0 ck e
1
2
N X(z)|z=e N k
2
N k
xps [n] =
Uniform Frequency-Domain
Sampling
X[k] = X () 2 , k = 0, . . . , N 1
=
X[k] = N ck
PN 1
1
2
N kn
xps [n] = P
k=0 X[k] e
N
5.3
Overview
Why yet another transform? After all, we now have FT tools for periodic and aperiodic signals in both CT and DT! What is left?
DTFT
One of the most important properties of the DTFT is the convolution property: y[n] = h[n] x[n] Y() = H() X (). This
property is useful for analyzing linear systems (and for filter design), and also useful for on paper convolutions of two sequences
h[n] and x[n], since if the sequences are simple ones whose DTFTs are known or are easily determined, we can simply multiply
the two transforms and then look up the inverse transform to get the convolution.
What if we want to automate this procedure using a computer? Right away there is a problem since is a continuous variable that
runs from to , so it looks like we need an (uncountably) infinite number of s which cannot be done on a computer.
For example, we cannot implement the ideal lowpass filter digitally.
This chapter exploit what happens if we do not use all the s, but rather just a finite set (which can be stored digitally). In general
this will entail irrecoverable information loss. Fortunately, not always though! (Otherwise DSP would be a more academic subject.)
Any signal that is stored in a computer must be a finite length sequence, say x[0], x[1], . . . , x[L 1] . Since there are only L signal
time samples, it stands to reason that we should not need an infinite number of frequencies to adequately represent the signal. In
fact, exactly N L frequencies should be enough information.
(We will see when we discuss zero-padding that for some purposes N 2L is an appropriate number of frequencies.)
Main points
By the end of Chapter 5, we will know (among other things) how to use the DFT to convolve two generic sampled signals stored
in a computer. By the end of Ch. 6, we will know that by using the FFT, this approach to convolution is generally much faster
than using direct convolution, such as M ATLABs conv command.
Using the DFT via the FFT lets us do a FT (of a finite length signal) to examine signal frequency content. (This is how digital
spectrum analyzers work.)
Chapter 3 and 4 especially focussed on DT systems. Now we focus on DT signals for a while.
The discrete Fourier transform or DFT is the transform that deals with a finite discrete-time signal and a finite or discrete number
of frequencies.
Which frequencies?
k =
2
k,
N
k = 0, 1, . . . , N 1.
For a signal that is time-limited to 0, 1, . . . , L 1, the above N L frequencies contain all the information in the signal, i.e., we
N 1
can recover x[n] from X 2
.
N k
k=0
However, it is also useful to see what happens if we throw away all but those N frequencies even for general aperiodic signals.
Discrete-time Fourier transform (DTFT) review
Recall that for a general aperiodic signal x[n], the DTFT and its inverse is
X () =
x[n] en ,
x[n] =
n=
1
2
X () en d .
N
1
X
k=0
ck e N kn where ck =
N 1
2
1 X
x[n] e N kn .
N n=0
5.4
Definition(s)
The N -point DFT of any signal x[n] is defined as follows:
PN 1
2
N kn ,
4
k = 0, . . . , N 1
n=0 x[n] e
X[k] =
??
otherwise.
Almost all books agree on the top part of this definition. (An exception is the 206 textbook (DSP First), which includes a
front to make the DFT match the DTFS.)
But there are several possible choices for the ?? part of this definition.
1
N
out
1. Treat X[k] as an N -periodic function that is defined for all integer arguments k Z.
This is reasonable mathematically since
X[n + N ] =
N
1
X
x[n] e
2
N (k+N )n
N
1
X
n=0
x[n] e
( 2
N kn+2kn)
n=0
N
1
X
x[n] e N kn = X[k] .
n=0
This is reasonable from a practical perspective since in a computer we have subroutines that take an N -point signal x[n]
and return only the N values X[0], . . . , X[N 1], so trying to evaluate an expression like X[k] will cause an error in a
computer.
The book seems to waver somewhat between the first two conventions.
These lecture notes are based on the middle convention: that the N -point DFT is undefined except for k {0, . . . , N 1}. This
choice is made because it helps prevent computer programming errors.
Given X[k] for k {0, . . . , N 1}, the N -point inverse DFT is defined as follows:
1 PN 1
2
N kn ,
n = 0, . . . , N 1
k=0 X[k] e
N
x
[n] =
??,
otherwise.
Here the natural choice for the ?? part depends on the type of signal is under consideration.
If x[n] is a finite length signal, supported on 0, . . . , L 1, where L N , then we interpret the inverse DFT as
1 PN 1
2
N kn ,
n = 0, . . . , N 1
k=0 X[k] e
N
x[n] =
0,
otherwise.
This definition is the most important one since our primary use of the DFT is for length L signals with L N .
N 1
In this case the inverse is named appropriately, since we really do recover x[n] exactly from {X[k]} k=0 . The proof of this is
essentially identical to the proof given for the self-consistency of the DTFS.
If x[n] is a N -periodic signal, then we really should use the DTFS instead of the DFT, but they are so incredibly similar that
sometimes we will use the DFT, in which case we should interpret the inverse DFT as follows
x[n] =
N 1
2
1 X
X[k] e N kn .
N
k=0
N 1
2
1 X
X[k] e N kn ,
N
k=0
where xps [n] 6= x[n] in this case. (Nevertheless, it may be that xps [n] x[n] for n = 0, . . . , N 1 so the DFT can be useful
even in this case.
5.5
Examples
Example. x[n] = [n] +0.9 [n 6]. What is L? L = 7. Let us use N = 8. (Powers of 2 are handy later for FFTs.)
X[k] =
N
1
X
x[n] e N kn =
7
X
x[n] e
2
8 kn
n=0
n=0
7
X
n=0
2
8 k6
DFT Example
1
0.8
x[n]
0.6
0.4
0.2
0
0.2
3
n
|X[k]|
1.5
0.5
X[k]
0.5
0.5
Alternative approach to finding X[k]. First find X(z), then sample around unit circle. X(z) = 1 + 0.9z 6 , so
2
X[k] = X(z) 2 k = 1 + 0.9 e 8 k .
z=e
Picture .
N 1
{X[k]}k=0
x[n] =
where X[k] =
1,
0,
k = k0
otherwise
N 1
2
1 2 k0 n
1 X
e N
.
X[k] e N kn =
N
N
k=0
If k0 {0, . . . , N 1} , then
1 2 k0 n DFT
[k k0 ] .
e N
N
N
N 1
0,
otherwise,
N 1
2
1 X
1 2 k0 n
1 2 (N k0 )n
2
2
X[k] e N kn =
e e N
+
e
e N
=
cos
k0 n + .
N
N
N
N
N
k=0
5.6
Example. Find the 8-point DFT of the signal x[n] = 6 cos2 4 n .
h
i
2
2
2
2
Expanding: x[n] = 3 + 3 cos 2 n = 3 + 23 e 8 2n + 23 e 8 2n = 81 24 + 12 e 8 2n + 12 e 8 (82)n .
So by coefficient matching, we see that X[k] = {24, 0, 12, 0, 0, 0, 12, 0} .
Example. Complex exponential signal with frequency that is an integer multiple of 2
N .
2
k0 n
0 n
2
N
=e
for n = 0, . . . , N 1, where 0 = N k0 and k0 is an integer.
Suppose x[n] = e
Find the N -point DFT of x[n].
X[k] =
N
1
X
x[n] e N kn =
n=0
N
1
X
e N k0 n e N kn =
n=0
N
1
X
e N (kk0 )n =
n=0
N,
0,
k = k0 + lN, l Z
otherwise.
Thus
DFT
x[n] = e N k0 n X[k] = N
N
where N [n] =
l=
[k k0 lN ] = N N [k k0 ],
l=
[n lN ].
Example. Complex exponential signal with frequency that is not an integer multiple of 2/N .
Suppose x[n] = e0 n for n = 0, . . . , N 1, where 0 6= 2
N k0 for any integer k.
Find the N -point DFT of x[n].
X[k] =
N
1
X
e0 n e
2
N kn
n=0
N
1
X
(0 2
N k)
n=0
n
N
2
1 e(0 N k)
1e
(0 2
N k)
1 e0 N
1 e(0 N k)
0 n
X[k] =
If 0 / 2
N is non-integer, then e
N
1 e0 N
1 e(0 N k)
N
1
X
n=0
en
sin(N/2)
, 6= 0
N sinc N
.
= = e(N 1)/2 Rr (), where Rr () =
sin(/2)
2
N,
=0
X[k] = X ()
= 2
N k
2
k 0 .
= 2 R
N
When 0 = 2
N k0 , then the sinc is sampled only at the peak and the nulls, which gives the Dirac impulse form above.
Otherwise the sinc is sampled at many nonzero values, which gives the messy form above.
5.7
PN 1
x[n] e N kn .
PL1
If x[n] is a L-point signal, i.e., it is nonzero only for n = 0, 1, . . . , L1, then the DTFT simplifies to X () = n=0 x[n] en .
n=
n=0
Example. Find the signal x[n] that has the following spectrum, with 0 = /2.
2
1
3
0 2
4
0
1 3 2
3
1
<
,
0 2
2 2
0
2
It seems it would be painful to find x[n] via the inverse DTFT integral!
X () =
2 < 0 0
0,
periodic
otherwise.
Simpler (approximate!) approach: sample X (), then compute inverse DFT (using FFT).
Challenging DTFT H()
0.8
0.25
0.2
0.4
x[n]
0.2
x[n]
H()
0.6
0.15
0.1
0
0.1
0.05
0.2
0
2
0.8
0.75
0.05
Samples, N=16
0
15
0.1
0
ps
0.4
0.2
0.2
0.15
0.05
0.75
0.05
2
0
0
0
8
4
x 10
0.1
Error
0.6
H(2/N k)
0.2
0.25
0
2
0
After "fftshift", for N=16
15
1
4
sinc3
1
4n
5.8
xps [n] =
l=
x[n lN ] .
4 n,
0,
0n3
so L = 4.
otherwise,
-2
x [n], N = 6
6 ps
xps [n], N = 3
5 6
3
2
2
-6
-1
x[n mod N ], N = 3
6
4
3
2
2
-6
Why is this important? Because the following two processes are equivalent only if L N .
N 1
N -point inv DFT xps [n]
x[n] DTFT X () sample X 2
N k
k=0
x[n]
N -point DFT
5.9
5.1
Frequency domain sampling: Properties and applications
Recall that the DTFT X () is periodic, and that this periodicity arose because of the time-domain sampling.
Now suppose we sample the DTFT at the N particular frequencies given above (think: to store digitally):
X
2
2
x[n] e N kn , k = 0, 1, . . . , N 1.
k = X () 2 =
X
N
= N k
n=
Picture of [0, 2) with sample locations and values, and around unit circle too.
Questions arise:
I. How is X
N 1
N 1
k=0
Before doing math, think about duality. Earlier we considered sampling a CT signal, which led to replication in frequency domain,
and recovery possible if signal bandlimited (finite support in replicated domain). Now we are sampling in the frequency domain.
We explore this by manipulating and re-interpreting the formula for X 2
N k .
First break up the infinite summation into the intervals . . . (2N.. N 1) (N.. 1) (0..N 1) (N..2N 1) (2N..3N 1) . . .
2
k
X
N
= X ()
l0 NX
+N 1
X
l0 =
=
=
=
= 2
N k
x[n] e N kn
n=
2
x[n0 ] e N kn
(split up sum)
n0 =l0 N
N
1
X
X
l0 = n=0
N
1
X
X
x[n + l0 N ] e N k(n+l N ) (n = n0 l0 N 0 )
2
l0 = n=0
N
1
X
X
n=0
l=
0
X
2
4 X
2
kn
xps [n] e N
x[n lN ] .
k =
where xps [n] =
X
N
n=0
l=
The above relationship holds for any aperiodic DT signal whose DTFT exists. It is true N N and k Z.
I call xps [n] the N -point periodic superposition of x[n].
The signal xps [n] is N -periodic, i.e., clearly xps [n + N ] = xps [n] .
DFT
2
N k
5.10
N
1
X
ck e N kn where ck =
k=0
1
X
N
N 1
2
1 X
xps [n] e N kn .
N n=0
2
N k
2
k .
N
Thus, we can recover the periodic signal xps [n] from the DTFT samples X
xps [n] =
, we see that
2
N k
N 1
k=0
N 1
2
2
1 X
X
k e N kn .
N
N
k=0
However, recovery of xps [n] from X
N 1
DTFT samples X 2
.
N k
k=0
2
N k
N 1
k=0
does not alone ensure that we can recover the original signal x[n] from the
To address this, we must further study how xps [n] relates to x[n].
Recall from Ch. 4 that time-domain sampling yields a DT frequency spectrum that is a sum of shifted replicates of the CT frequency
spectrum of xa (t).
Similarly, here we are considering frequency-domain sampling, and the result is that the periodic
signal x ps [n] consists of a sum
P
of shifted replicates of the discrete-time signal x[n], as described by the relationship x ps [n] = l= x[n lN ] .
5.11
1
Example. Suppose x[n] = an u[n] where |a| < 1, for which X () =
. This is not a time-limited signal.
1
a
e
Now suppose we take N samples of this DTFT at X 2
(equally spaced around the unit circle).
N k = X ()
2
=
Then we synthesize xps [n] from those samples via inverse DFT. What will xps [n] look like?
From the above equation, for n = 0, . . . , N 1:
xps [n] =
l=
x[n lN ] =
l=
anlN u[n lN ] = an
an mod N
1aN
l=
bn/N c
alN u[n lN ] = an
alN = an
l=
l=
x[n]
0.5
12
12
12
12
x[nN]
0.5
x[n2N]
0.5
x[n+N]
0.5
xps[n]
0.5
alN =
an
.
1 aN
. Does xps [n] = x[n]? No, but as N , xps [n] x[n] for any fixed n 0.
The problem is time-domain aliasing; the time-domain replicates overlap before summing.
0
X
10
15
20
This time aliasing arises from our attempt to form a signal from a finite number of values of .
For this aperiodic non time-limited signal, no finite set of k s will allow perfect reconstruction of x[n].
5.12
Time-limited signals
There is an important special case where the time-domain replicates do not overlap. That case is time-limited signals.
By convention, we say x[n] is time-limited with duration L if x[n] is nonzero only in the interval 0, 1, . . . , L 1.
Result II.
If x[n] is time-limited to duration L, then if N L, then there is no overlap in the replicates when forming x ps [n] from
2 N 1
X N k k=0 .
Result III. Thus, if x[n] is time-limited with duration L N , (called adequate frequency sampling) then we can recover x[n]
from xps [n] by simply extracting the appropriate values:
x[n] =
0nL1
otherwise.
xps [n],
0,
From the recovered x[n] we could use the DTFT formula to find X () for any , meaning we have gone from the samples
2 N 1
X N k k=0 back to the continuous X () (in the time-limited case). It is also possible to recover X () directly from the
samples using the Dirichlet interpolation formula - see text.
5.1.2
The discrete Fourier transform (DFT)
For the rest of this chapter, our primary focus will be time-limited signals x[n], which are nonzero only for n = 0, . . . , L 1.
For such signals, the DTFT simplifies to
X () =
L1
X
x[n] en .
n=0
or for convenience
X[k] =
N
1
X
= 2
N k
x[n] e N kn ,
n=0
L1
X
x[n] e N kn
n=0
k = 0, . . . , N 1,
where the upper limit is changed to N with no effect since x[n] = 0 for n = L, . . . , N 1.
The above expression is called the discrete Fourier transform or (DFT).
The DFT is always defined, since it is a finite sum!
Since x[n] is time-limited, we can recover it from xps [n], which in turn can be recovered from the DTFS synthesis equation.
Thus we have the inverse DFT or (IDFT):
x[n] =
1
N
0,
PN 1
k=0
X[k] e N kn ,
n = 0, . . . , N 1
otherwise.
The above pair of equations can be implemented easily on a computer since there is just a finite sum. Fortunately, we can implement
the sums cleverly using the fast-Fourier transform (FFT), as discussed in Ch. 6.
Although the ranges of the indices only run from 0 to N 1, the expressions are defined for any integer k and n.
5.13
skim
WN = e N
then we can rewrite the DFT and IDFT formulas as:
X[k] =
N
1
X
n=0
N 1
1 X
X[k] WNkn ,
N
k=0
1
0
NW X
(see text).
Graduate students should study the matrix-vector form, since it is very useful for theoretical analysis of many SP methods.
5.1.4 Relationship of the DFT to other transforms
DTFS Suppose we take any signal x[n] and form its N -point circular extension, i.e., x[n mod N ]. Since x[n mod N ] is N periodic, it has a DTFS representation with some coefficients ck . Those coefficients are related to the N -point DFT of x[n] as
follows:
1
ck =
X[k] .
N
DTFS
P
Suppose we take any signal x[n] and form its N -point periodic superposition, i.e., x ps [n] = l= x[n lN ] . Since xps [n]
is N -periodic, it has a DTFS representation with some coefficients ck . Those coefficients are related to the DTFT of x[n] as
follows:
2
1
X
k .
x[k] =
N
N
If in addition x[n] has length L N , then the DTFS coefficients are related to the N -point DFT of x[n] as follows: c k =
1
N X[k] .
DTFT
If x[n] is an L-point signal with L N then X[k] = X () 2 .
=
z-transform
If x[n] is an L-point signal with L N then X[k] = X(z)
2 k
z=e N
If x[n] is an L-point signal with L N , then we can express X(z) in terms of X[k] (see text):
X(z) =
N 1
1 z N X
X[k]
.
2
N
1 e N k z 1
k=0
If x[n] is an L-point signal with L N , then we can express X () in terms of X[k]. (Left to reader.)
Fourier series of continuous time periodic signal
see text. DFT values X[k] related to aliased version of the CT Fourier coefficients.
5.14
X[k] =
N
1
X
x[n] e N kn ,
n=0
k = 0, . . . , N 1.
Since this is a finite sum, it is well defined for any signal x[n], be it time-limited, periodic, or aperiodic.
The expression for X[k] is certainly mathematically well defined for any integer k, and on paper it is sometimes useful to think
about all integers k. However, the DFT is periodic with period N :
k.
X[k + N ] = X[k],
n = 0, . . . , N 1.
k=0
This expression is also mathematically well defined for any integer n, but on paper it is also sometimes useful to think about all
integers n. However, the IDFT is also periodic with period N :
xi [n + N ] = xi [n],
n.
Thus, again, in a computer we would only bother to compute this sum for n = 0, . . . , N 1. Again an N -point input and N -point
output.
Now we discuss the properties of the DFT and the IDFT for various types of DT signals x[n].
1. For any DT signal x[n], we have
x[n] = xi [n], for n = 0, . . . , N 1,
so the inverse DFT is aptly named. If you take the DFT of any DT signal, be it time-limited, not time-limited, periodic, or
aperiodic, and then compute the IDFT, the IDFT xi [n] will agree with the original signal x[n] over the interval n = 0, . . . , N 1.
N 1
2. If x[n] is a periodic signal with period N , then it has a DTFS representation with some coefficients {c k }k=0 where
X[k] = N ck .
In this case x[n] = xi [n] for all n.
3. If x[n] is time-limited to 0, . . . , L 1 where L N , then in addition to Property 1, we have
X[k] = X () 2 .
=
If x[n] is not time-limited, then there is still a relationship between X[k] and X (), but it is fairly complicated and not easily
interpreted. Most of the time we do want to be able to directly interpret the DFT values X[k]s as frequency components, so we
focus on time-limited signals.
In the time-limited case, we can recover the original signal from xi [n] by simply taking
xi [n], n = 0, . . . , N 1,
x[n] =
0,
otherwise.
Since we will focus mainly on time-limited signals in the context of the DFT, for simplicity we will replace the x i [n] in the IDFT
N 1
with just x[n]. But one should keep in mind that the IDFT formula really gives a periodic extension of {x[n]} n=0 , and to truly
recover x[n] using the IDFT you would set to zero all the values other than n = 0, 1, . . . , N 1.
5.15
5.2
Properties of the DFT, IDFT
X[k] =
N
1
X
n=0
x[n] e N kn ,
k = 0, . . . , N 1.
x[n] =
N 1
2
1 X
X[k] e N kn ,
N
k=0
n = 0, . . . , N 1.
The above formula is easy to see by plugging in to the DFT definition and simplifying the complex exponential.
xi [n + N ] = xi [n] n
This formula may seem surprising, since supposedly we are dealing with time-limited signals! Frequency-domain sampling leads
to periodic replication in the time domain. To recover the original time-limited signal from the above formulas, we would just
use n = 0, . . . , N 1 and zero the rest. In a computer we essentially only care about 0 to N 1 anyway, so the signal periodicity
is mainly a theoretical property, except as it impacts convolution below.
So mathematically we are dealing with N -periodic sequences, even though practically we are thinking of it as finite-length.
Another way of thinking about it: suppose you give me two finite-length sequences and ask me to convolve them. All you really
care is that I give you back the correct answer (and quickly); it does not matter to you as the client that the convolution algorithm
that I use may be based on ideas involving periodic signals, as long I as return to you the correct answer.
Remember, one of our goals here is to develop a (much) faster convolution method than the brute-force conv approach. It so
happens that periodic signals play an important role in the derivation and analysis, but by using the final results appropriately, we
will also end up with a very practical method that works even for non-periodic time-limited signals.
Linearity
DFT
5.16
Symmetries
The next set of properties of the DFT describes what happens when the signal x[n] has certain symmetries. Hence we first need to
appropriately define symmetries in the context of periodic sequences.
A signal x[n] is called N -point circularly even iff its N -point circular extension, x[n mod N ], is even.
Equivalently, a signal x[n] is N -point circularly even iff x[n mod N ] = x[n mod N ] .
Example. x[n] = {4, 3, 2, 1}.
Is this signal 4-point circularly even? No, since x[n mod N ] is not even.
Is this signal 6-point circularly even? Yes, as the following figure illustrates.
Is it 8-point circularly even? No, for N = 8 it is not circularly even, since x[n mod N ] is not even for N = 8.
Timelimited signal x(n)
L=6
L=6
x(n)
x(n)
1
0
15
10
0
n
10
15
0
15
0
n
10
15
10
15
3
x((n))N
x((n))
2
1
0
15
10
3
2
1
10
2N
5
N
0
n
10
N
15
2N
0
15
2N
10
5
N
0
n
5
N
2N
5.17
A simple test for whether a sequence is N -point circularly even is to draw it around a circle (in N evenly spaced points).
3
n=1
n=0
n=N-1
If the sequence is the same whether you read it out CW or CCW, then it is circularly even.
By considering the points around the circle, we conclude the following.
An signal is N -point circularly even iff x[N n] = x[n], n = 1, . . . , N 1, where x[0] is arbitrary.
An signal is N -point circularly odd iff x[N n] = x[n], n = 1, . . . , N 1, with x[0] = 0.
Decomposing an N -point sequence into circularly even and circularly odd components:
xce [n] =
1
2
x[n]
n = 1, . . . , N 1
n=0
n = 1, . . . , N 1
n=0
Example. x[n] = {4, 3, 2, 1} with N = 4 = xce [n] = {4, 2, 2, 2}, xco [n] = {0, 1, 0, 1} circle pictures
If x[n] is real, then (cf. Hermitian symmetry of DTFT) its DFT has circular Hermitian symmetry:
X[k] = X [k mod N ] .
Proof. It follows by the following periodicity argument, since k mod N = k + lN for some l Z:
"N 1
# "N 1
# N 1
X
X
X
2
2
(k mod N )n
2
(k)n
N
N
X [k mod N ] =
x[n] e
x[n] e N kn = X[k] .
=
x[n] e
=
n=0
n=0
n=0
N
1
X
x[n] e N kn = x[0] +
N
1
X
x[n] e N kn = x[0] +
n=1
n=0
N
1
X
N
1
X
n0 =1
2
n0 =0
If x[n] is real and circularly even, then X[k] is also real and circularly even.
There are many such relationships, as summarized in the following diagram.
x[n]
X[k]
xce
R [n]
l
ce
XR
[k]
+
+
xce
I [n]
l
XIce [k]
+
+
+ xco
I [n]
.
&
%
co
XR
[k] + XIco [k]
xco
R [n]
Note: (5.2.31) looks different than (4.3.37) only because the order of terms differs.
x[N n0 ] e N k(N n )
5.18
We will use x[n mod N ] to denote circular time-reversal. Like the textbook, we may sometimes
use the convenient shorthand
= x[0] rather than x[N ].
x[n mod N ] = x[N n]. But note that this shorthand is imprecise since x[n mod N ]
n=0
Specifically:
x[0],
x[N n],
x[n mod N ] =
(periodic),
n=0
n = 1, . . . , N 1
otherwise.
DTFT
DFT
Circular time-shift
Again we must be careful, since time-shifting a time-limited sequence would yield a sequence that is not limited to 0 to N 1.
Instead, we first take the periodic extension of the signal, time-shift that, and then pick out the values from 0 to N 1. This is
called a N -point circular time-shift. It is equivalent to writing the sequence CCW around a circle, and then reading the values
CCW starting from point l.
Example. If x[n] = {10, 11, 12, 13, 14} and N = 6 and l = 2, then x[n l mod N ] = {14, 0, 10, 11, 12, 13}. Picture of circle
DFT
DFT
Complex conjugate
DFT
x [n] X [k mod N ]
N
DFT
x [n mod N ] X [k]
N
Parsevals theorem
N
1
X
n=0
x[n] y [n] =
N 1
1 X
X[k] Y [k]
N
k=0
N
1
X
n=0
|x[n]| =
N 1
1 X
2
|X[k]|
N
k=0
5.19
Recall that one of the most important DTFT properties is that if Y() = H() X () then y[n] = x[n] h[n], so convolution in the
time domain becomes simply multiplication in the transform domain. What about for the DFT?
5.2.2
Multiplication of two DFTs and circular convolution
DFT
DFT
Suppose h[n] H[k] and x[n] X[k], where h[n] is time-limited with M N and x[n] is time-limited with L N .
(For now think of x[n] and h[n] as two generic signals; they need not be an input and a filter.)
Suppose we multiply the two sets of DFT coefficients:
4
k = 0, . . . , N 1,
N 1
and then take the N -point inverse DFT of {S[k]}k=0 to get {s[n]}k=0 . How does s[n] relate to h[n] and x[n]?
The resulting s[n] is not the ordinary convolution of h[n] and x[n], but rather the N -point circular convolution of h[n] and x[n],
denoted s[n] = h[n]
N x[n].
N
1
X
m=0
in words as follows.
Take one of the two sequences, e.g., h[n], and form its N -point circular extension h[n mod N ].
Perform ordinary convolution of that extended signal h[n mod N ] with the time-limited signal x[n].
We need only bother to compute the results for n = 0, . . . , N 1.
Example. Circular convolution (using DFT): x[n] = {2, 0, 3, 1}, h[n] = {10, 20, 30, 40}.
Find s[n] = h[n]
4 x[n], i.e., N = 4.
Note that since s[n] is the IDFT of S[k] = H[k] X[k], it is periodic with period N = 4.
If asked to do it manually, one can either use the above time domain recipe, or manually compute X[k] and H[k] and multiply, and
then manually compute inverse DFT.
5.20
Input information:
H[k] =
N
1
X
h[n] e
2
N kn
X[k] =
n=0
s[n] =
N
1
X
n=0
N
1
X
1
N
x[n] e N kn
2
S[k] e N kn .
k=0
X
1 X 2 km
1,
m
=
0,
N,
2N,
.
.
.
=
e N
[m lN ] = [n mod N ] .
=
0, otherwise
N
k=0
l=
PN 1
m0 =0
h[m0 ]
l= [n
m0 lN ] .
N 1
N 1
2
1 X
1 X
2
kn
s[n] =
S[k] e N =
H[k] X[k] e N kn (IDFT and S[k] defn)
N
N
k=0
k=0
" N 1
#
# "N 1
N
1
X
2
2
2
1 X X
0
h[m0 ] e N km
=
x[m] e N km e N kn (DFT defn)
N
m=0
k=0 m0 =0
"
#
N
1
N
1
N
1
X
X
X
2
1
0
h[m0 ]
e N k(nmm ) (exch. sums)
x[m]
=
N
m=0
m0 =0
k=0
"
#
N
1
N
1
X
X
X
h[m0 ]
[n m m0 lN ] (exp. sum prop.)
x[m]
=
m=0
N
1
X
m=0
m0 =0
l=
= h[n]
N x[n] = x[n]
N h[n] defn of
N
In summary, if s[n] = IDFTN (DFTN (x[n]) .* DFTN (h[n])), then
DFT
s[n] = h[n]
N x[n] S[k] = H[k] X[k] .
N
5.21
Reversed Signal 2
Product
40
30
h((0-m))
10
90
20
x(m)
-20
40
h((1-m))
n=1
10
0
3
20
s(0) = 20 + 90 - 20 = 90
Signal 1
n=0
20
120
30
40
-30
-1
10
h((2-m))
n=2
20
30
30
40
60
-40
s(2) = 60 + 30 - 40 = 50
30
20
h((3-m))
10
40
60
n=3
80
-10
s(3) = 80 + 60 - 10 = 130
5.22
Remember we set out to find a faster way to do convolution. Did it work? Ordinary linear convolution for the above signals can
be computed using:
y = conv([2 0 3 -1], [10 20 30 40]) which yields
y[n] = h[n] x[n] = {20, 40, 90, 130, 70, 90, 40} .
The result has L + M 1 = 4 + 4 1 = 7 nonzero values. All other values are zero.
Note that y[n] 6= s[n], i.e., 4-point circular convolution of x[n] and h[n], which can be computed rapidly by FFTs, did not result
in the linear convolution of x[n] and h[n]. Fortunately this can be fixed using zero-padding.
How are s[n] and y[n] related? s[n] is a time-domain aliased version of y[n]; a sum of 4-point shifted replicates of y[n]:
s[n] =
l=
y[n lN ] =
l=
(x h)[n lN ].
If N L and N M (which is true in above example), then x[n] and h[n] are sampled adequately, so H[k] = H 2
N k and
X[k] = X 2
= Y()|= 2 k , and hence s[n] will be the N -point periodic superposition of
N k . So S[k] = H() X ()|= 2
N k
N
the inverse DTFT of Y() = H() X (), i.e., the N -point periodic superposition of y[n] = h[n] x[n].
-4
...
20 40 90 130
70 90 -40
20 40 90 130
70 90 -40
20 40 90 130
y[n+4]
y[n]
y[n-4]
70 90 -40
...
...
4
x((n))
x(n)
3
2
0
6
10
h(n)
10
10
10
2
n
10
20
1
0.8
0.6
0.4
0.2
0
6
2
1
1
0
6
15
10
5
0
6
10
20
4
x((n))
y(n)
15
10
5
0
6
0
6
10
20
s(n) = x(n) (8) h(n)
h(n)
2
1
0.8
0.6
0.4
0.2
0
6
2
n
10
15
10
5
0
6
5.23
N
1
X
"N 1
X
x[n]
h[n] ,
n=0
n=0
n=0
# "N 1
X
which is a similar property to that for ordinary linear convolution, except here the sums are finite.
Circular correlation
DFT
Circular autocorrelation
DFT
2
rxx (l) = x[l]
N x [l mod N ] |X[k]|
N
Time-domain multiplication
DFT
x[n] y[n]
N
1
X[k]
N Y [k]
N
Read
n=l
DFT
(l).
rxy
=
=
Thus
N
1
X
n=0
"
y[n l mod N ]
x[n]
Ex
Ey
#2
N 1
N 1
1 X
2
1 X
2
2
[x[n]] +
[y[n l mod N ]] p
Ex n=0
Ey n=0
E x Ey
rxy [l]
.
2 2p
Ex Ey
"N 1
X
n=0
p
p
Ex Ey rxy [l] Ex Ey .
Summary
If y[n] = x[n n0 ] x[n n0 mod N ] then DFT gives Y [k] = X[k] e N kn0 . Multiplying: X[k] Y [k] = |X[k]| e N kn0 ,
taking phase gives 2
0 = slope/ 2
N kn0 which (after unwrapping) is a line in k, so find slope and n
N . Multiply by Ts to estimate
delay (related to distance to target).
Note periodic ambiguity (tracking).
5.24
5.3
Linear filtering methods based on the DFT
5.3.1 Use of the DFT in linear filtering
DFT-based filtering always performs a circular convolution. This is a property of the math; usually it is not our desired operation.
But by zero-padding adequately, circular convolution and linear convolution can yield the same result.
Goal: find y[n] when:
x[n] h[n] y[n] = h[n] x[n]
x[n] time limited to 0, . . . , L 1
h[n] time limited to 0, . . . , M 1 (FIR)
PL1
Brute force approach (about LM multiplies required): y[n] = k=0 x[k] h[n k] .
What range of n? y[n] is time limited to n = 0, . . . , (L + M 1) 1.
Since y[n] is a L + M 1 point signal, we can reconstruct y[n] from N L + M 1 samples of its DTFT, i.e.,
N 1
2
1 X
y[n] =
Y [k] e N kn , where Y [k] = Y() 2 .
N
= N k
k=0
Y [k] = Y()
X[k] = X ()
= 2
N k
= 2
N k
= H() X ()
= 2
N k
and H[k] = H()
= 2
N k
where X[k] is the N -point DFT of x[n]? Yes, because x[n] is time-limited to L N , and h[n] is time-limited to M N . Thus
Y [k] = H[k] X[k],
and we have the following simple recipe for performing linear convolution using DFTs.
Convolution via DFT
zero pad x[n] to N L + M 1 elements
zero pad h[n] to N L + M 1 elements
compute N -point DFT X[k] of x[n]
compute N -point DFT H[k] of h[n]
multiply: Y [k] = X[k] H[k], k = 0, . . . , N 1
compute inverse DFT of Y [k] to get y[n]
In M ATLAB:
x
h
X
H
Y
y
=
=
=
=
=
=
[2 0 3 -1]
[10 20 30 40]
fft(x,8) % tells to compute an 8-point DFT
fft(x,8)
H .* X
ifft(y)
Brief way:
y = ifft(fft([2 0 3 -1], 8) .* fft([10 20 30 40], 8))
This returns 8 values. What is the last value? 0 because L + M 1 = 7
Key point: with zero-padding the general time-domain aliasing phenomena is still present, but the signal values that are timealiased are all zero, so they cause no detrimental effect! We have thus tricked a circular convolution into performing something
that gives the same answer as linear convolution.
5.25
5.3.2
Filtering of long data sequences
We have mentioned that signals stored in a computer must have finite length. But finite can still be very large.
sec
Example: music CD: L = 44.1kHz 70 min 60 min
2channels 400 106 samples!
How can we digitally filter such signals if RAM smaller than signal data? Goal: linear convolution.
Options for filtering in M ATLAB. Each has a role. Which option is best depends on L and on form of system description (h[n] or
H(z) or H()).
1. Direct convolution y[n] =
Pn
k=0
x[n k] h[k]
y = conv(x,h)
Given FIR h[n] (length M )
x[n] can be arbitrarily large - read sequentially from storage.
LM multiplies
appropriate if M log2 L
N
X
k=1
ak y[n k] +
M
X
k=0
bk x[n k],
y = filter(b,a,x)
Given H(z) rational (or pole-zero etc.)
Usually N, M small relative to L
L(N + M ) multiplies
= fftfilt(h,x)
Given h[n] or H[k]
L
N log2 N ) = O(L log2 N ) multiplies
O( N
appropriate when h[n] much shorter than x[n]
5.26
5. Zero-padded DFT/FFT from frequency response H(), using the fact that Y() = H() X ()
Hv = ?
y = ifft(fft(x,N) .* Hv)
Given H() but finding h[n] is painful
Exact only if h[n] is FIR and N L + M 1, but for sufficiently large N , often a reasonable approximation.
How large of N ? Need N L + M0 1, where M0 is approximate length of significant nonzero part of h[n].
O(N log2 N ) multiplies
What should Hv be? It should be H(k ), k = 0, . . . , N 1, where k =
2
N k.
Example. Suppose we have a signal x[n] and we wish to apply the following filter:
H() =
e16 ,
0,
|| /4
/4 < || .
On paper no problem: take DTFT of x[n], multiply by H(), take inverse DTFT, gives exact y[n] if no math errors.
1,
|| /4
0,
/4 < ||
Because |H()| =
0,
< || < 7/4
1,
7/4 || 9/4
..., ....
What is the catch? y[n] is not exact. Why not? IDFT of H[k] has length N , so N + L 1 > N so y[n] always
undersampled, no matter what N is, so always time-domain aliasing in y[n]. But if N is large enough relative to the effective
length of y[n], then time-domain aliasing can be made minimal. Again need N > L + M 0 1, where M0 is the approximate
length of h[n].
Desired magnitude response
0.4
0.2
0.1
0.1
20
30
40
50
60
Filtering by DFT using sampled H()
70
80
90
3
N=80
2
1
0
0
0.3
N=32
0.2
0.2
ifft(fft(x,N) .* Hk)
h[n lN]
|H[k]| = |H(k)|
31
0.8
0.1
0
0
0
16
n
ifft(fft(x) .* Hk)
0.4
10
0.6
2
1
0.2
0.6
h[n]
|H()|
y[n]
0.3
0.8
0.1
16
n
31
10
20
30
40
50
60
70
80
90
3
N=128
2
1
0
0
10
20
30
40
50
60
70
80
90
5.27
5.4
Frequency analysis of signals using the DFT
Suppose you are working with an analog device (such as a microphone, or a pressure sensor in an automobile, etc.) that produces
a signal xa (t), and you would like to examine its frequency spectrum Xa (F ).
Three options: analytical, analog, digital
Analytical.
2
If xa (t) has a simple analytical form, such as xa (t) = et , then one can use integration or tables and FT properties to find Xa (F ).
Analog spectrum analyzer
xa (t)
cos(F0 t)
| |2 dt energy in band
x
a (t)
Bandlimited
Signal
Sampler
Anti-Alias
Filter
DTFT
X ()
DFT/FFT
X[k]
x[n]
xa (t)
Consider first the hypothetical top path, i.e., imagine that we could really compute X ().
1 X
/(2) k
X () =
.
Xa
Ts
Ts
k=
For an ideal anti-alias filter, there is no overlap of the replicates in the above sum, so
F
F
Xa (F ) = Ts X 2
rect
.
Fs
Fs
Thus if we could compute X (), then we could display X () with an appropriate horizontal axis as X a (F )!
However, let us suppose that x[n] is time-limited to 0, . . . , L 1, and then suppose we compute a N -point DFT of x[n] for N L.
Since x[n] is time-limited:
2
k ,
k = 0, . . . , N 1.
X[k] = X
N
However, we have seen above that X () is related to Xa (F ) for |F | Fs /2. So X[k] is also related to Xa (F ).
k related to k by k = 2
N k
related to F by = 2F/Fs for |F | Fs /2, or F =
2 Fs
Combining:
Fk =
k
N Fs ,
kN
N Fs ,
for [, ]
k = 0, . . . , N/2 1
k = N/2, . . . , N 1
5.28
fftshift
X ()
Xa (F )
1
1/T
After sampling
Fs/2
N=10
0 1 2 3 4 5 6 7 8 9 k
k-N:
PSfrag replacements
-5 -4 -3 -2 -1
-N/2
(N-1)/2
N-1
We would like to express this width in terms of the analog signal spectrum.
=
= 2u/Fs so F = Fs 2
Fs
L
1
LTs .
F =
1
LTs
so spectral width is the inverse of the total sampling time! longer time means finer spectral resolution.
Example: audio, suppose we would like 22Hz resolution. Then 22 = 1/(LTs ) so L = Fs /22Hz = 44kHz/22Hz = 2000 samples
needed.
5.29
l=
t lTs
,
x[l] sinc
Ts
n
X
x[l] sinc(n/M l) .
Ts =
M
l=
This is the ultimate upsampling method, but it requires excessive amounts of computation.
How do the spectra of x[n] and y[n] relate to xa (t)?
Xa (F )
1 6
Fs /2
Fs /2 F
X ()
Fs 6
Y()
MFs 6
FFT-based approach
/M 0 /M
A more efficient way is to take an N-point DFT, and zero-pad in the frequency domain! Why zero pad? Because of the pictures of
X () and Y() above!
Y [k] =
1
1
X[0] X[1], . . . , X[N/2 1], X[N/2], [(M 1)N 1 zeros], X[N/2], X[N/2 + 1], . . . , X[N 1] .
2
2
Take M N -point IDFT of Y [k] and scale by M . Yields sinc-like interpolation of x[n], where y[nM ] = x[n].
In M ATLAB this is performed using the interpft command as follows:
signal length, e.g., N = 3 * length(x) for upsampling by 3.
5.30
Example.
% fig_interp.m
% illustrate FFT-based interpolation
N = 8;
n=0:N-1;
x = 0.5 + (n > N/4 & n < 3*N/4); % simply boxcar signal
clf, subplot(211)
stem(n, x, filled), stem_fix
xlabel n, ylabel x[n]
axis([0 N 0 2])
M = 4;
X = fft(x);
middle = X(N/2+1)/2;
Y = M * [X(1:N/2) middle zeros(1, (M-1)*N-1) middle X(N/2+2:end)];
y = reale(ifft(Y));
t = linspace(0, N, N*2*M);
xt = 0.5 + sinc(t-3) + sinc(t-4) + sinc(t-5);
subplot(212)
plot(0:length(y)-1, y, o, t*M, xt, --)
legend(y[n], x(t))
xlabel n, ylabel y[n]
axis([0 M*N 0 2])
title FFT-based interpolation of x[n]
hold on
stem(n*M, x, filled), stem_fix
hold off
% savefig fig_interp
2
x[n]
1.5
1
0.5
0
4
n
y[n]
x(t)
y[n]
1.5
1
0.5
0
10
15
20
25
30
5.31
5.5
Summary
For a time-limited signal x[n] with L samples, the N -point DFT is an invertible transform that computes samples of the DTFT
X () of x[n].
The DFT can be used for filtering, via zero-padding and multiplication of DFT coefficients. This approach is particularly useful
because of the FFT.
x[n]
X
DTFS analysis
N -point periodic superposition
N 1 DTFS synthesis
x[n lN ]
{ck }k=0
xps [n]
xps [n] =
l=
N 1
2
IDFT
X
k
xps [n]
N
k=0
N 1
2
DFT
IDFT
x[n] X
k
x[n mod N ]
N
k=0
Sample
DTFT
x[n] X ()
X[k] = X
and
2
k
N
= N ck
System:
x
a (t) anti-alias xa (t) sampler x[n] N -point DFT
H[k]
Want x[n] = h[n] x[n] but get y[n] = x[n]
N h[n]
Design issues
anti-alias cutoff
sampling frequency (relates to bandwidth of x
a (t)
N (larger causes more lag)
H[k]s (filter)
Is is real time? Not exactly due to lag to buffer in N samples, compute DFT/Multiply/IDFT.