2.161 Signal Processing: Continuous and Discrete MIT OpenCourseWare rms of Use, visit: .

advertisement
MIT OpenCourseWare
http://ocw.mit.edu
2.161 Signal Processing: Continuous and Discrete
Fall 2008
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Massachusetts Institute of Technology
Department of Mechanical Engineering
2.161 Signal Processing - Continuous and Discrete
Fall Term 2008
Lecture 111
Reading:
•
Class Handout: Sampling and the Discrete Fourier Transform
•
Class Handout: The Fast Fourier Transform
•
Proakis and Manolakis (4th Ed.) Ch. 7
•
Oppenheim, Schafer & Buck (2nd Ed.) Chs. 8 & 9
1
The Discrete Fourier Transform – continued
In Lecture 10 the DFT pair associated with a sample set {fn } of length N was defined as
Fm =
fn =
N
−1
�
fn e−j 2πmn/N
n=0
N
−1
�
1
N
Fm ej 2πmn/N
m=0
The value Fm was interpreted as F ∗ (j Ω) evaluated at Ω = 2π/N ΔT .
1.1
Organization of the DFT
The N components in a DFT represent one period of a periodic spectrum. The first N/2 lines
in the spectrum represent physical frequencies 0 . . . (π/ΔT ) radians/second. The components
in the upper half of the sequence, FN/2+1 . . . FN −1 , may be considered to be the negative
frequency components F−N/2+1 . . . F−1 in the spectrum. It is common to translate the upper
half of the record to the the left side of a plot to enhance the physical meaning.
Fm
Fm
N e q u i- s p a c e d s a m p le s
in o n e p e r io d o f F m
in te r p r e t to p N /2 v a lu e s
a s r e p r e s e n tin g n e g a tiv e
fr e q u e n c ie s in F * ( j9 ) .
0
1
N -1
N /2
c D.Rowell 2008
copyright 11–1
N -1 0
N /2 -1
m
1.2
Spectral Resolution of the DFT
The DFT pair provide a transform relationship between a pair of (complex) data sets {fn }
and {Fm }, each of length N . If the sampling interval associated with {fn } is ΔT units, the
record duration is
T = N ΔT.
The frequency resolution, or line spacing, ΔΩ, in the DFT is
ΔΩ =
2π
2π
=
rad/s,
N ΔT
T
ΔF =
or
1
Hz.
T
(1)
and the frequency range spanned by the N lines in the DFT is
2π
rad/s,
ΔT
N ΔΩ =
or
N ΔF =
1
Hz.
ΔT
(2)
The sequence {Fm } represents both the positive and negative frequencies in a two-sided
spectrum. The highest (positive) frequency component in the spectrum is half of this range
(the Nyquist frequency), that is
Ωmax =
π
rad/s,
ΔT
or
Fmax =
1
Hz.
2ΔT
(3)
We conclude therefore, that the resolution within the DFT depends on the duration T of
the data record, and the maximum frequency depends on the sampling interval ΔT .
1.3
Properties of the Discrete Fourier Transform
Because the DFT is derived directly as a sampled continuous Fourier transform, it inherits
most of the properties of the Fourier transform. We repeat some of the important properties
here. In addition other properties are based on the assumed periodicity of {fn } and {Fm }:
1. Linearity: If {fn } and {gn } are both length N , and
DFT
{fn } ⇐⇒ {Fm }
then
and
DFT
{gn } ⇐⇒ {Gm }
DFT
a {fn } + b {gn } ⇐⇒ a {Fm } + b {Gm }
2. Symmetry Properties of the DFT: If {fn } is a real-valued sequence then
�
�
{Fm } = F −m
from which it follows that {{Fm }} is an even function of m and {{Fm }} is an odd
function of m. Similarly the magnitude of {Fm } is an even function, and the phase is
an odd function. In addition
DFT
E {{fn }} ⇐⇒ {{Fm }}
and
where E and O denote the even and odd parts respectively.
11–2
DFT
O {{fn }} ⇐⇒ {{Fm }}
3. Shifting Properties: If
DFT
{fn } ⇐⇒ {Fm }
then
DFT
{fn−n0 } ⇐⇒
and
�
�
e−jmn0 Fm
�
� DFT
ejm0 n fn ⇐⇒ {Fm−m0 }
where n0 and m0 are constants.
4. Periodicity As noted above, both {fn } and {Fm } are periodic with period N .
Example 1
What is the effect of zero-padding (adding extra zero amplitude samples) to a
data record {fn } before taking the DFT?
fn
fn
o r ig in a l r e c o r d ( le n g th N )
z e r o - p a d d e d r e c o r d ( le n g th N + M )
M
0
n
N -1
0
a d d e d z e ro s
N -1
N + M -1
n
• Assume that the original N samples encapsulate f (t), so that f (t) ≡ 0 for
T > N ΔT . Then let FmN denote the DFT of the original length N record
FmN
=
N
−1
�
fn e−j 2πmn/N
n=0
We note that when related back to the continuous time domain, the Nyquist
frequency is ΩN = π/ΔT , and the line spacing is Δω = 2π/N ΔT .
• When we ad M zeros to the end of the record
FmN +M =
N +M
�−1
N
−1
�
n=0
n=0
fn e−j 2πmn/(N +M ) =
fn e−j 2πmn/(N +M )
since the M extra data point do not contribute to the DFT sums. However
we now have N + M spectral samples with the same Nyquist frequency
ΩN = π/ΔT , but with a new line spacing ΔΩ = 2π/(N + M )ΔT .
The result is that padding the data record with zeros has increased the spec­
tral resolution of the DFT.
11–3
Note that if the number of added zeros is an integer multiple of the original
record length (M = kN , for k = 1, 2, 3, . . . ), the original DFT samples FmN will
be preserved and k − 1 new samples will be interpolated between the original
samples.
kN
−1
N
−1
�
�
kN
−j 2πmn/(kN )
fn e
=
fn e−j 2πmn/(kN )
Fm =
n=0
so that
FmN
=
n=0
kN
Fkm
.
Example: The waveform below was sampled with ΔT = 1 sec to give a length
16 record.
f(t)
4
3
2
1
0
0
5
1 0
-1
1 5
t (s e c )
-2
-3
-4
The data record length was then extended to a length of 256 by zero-padding
with 240 zeros, and the FFT was then computed again. The following plot,
demonstrating the interpolation in the DFT was generated from the MATLAB
fragment:
k
= 0:7;
f16 = [cos(2.*pi*k/8) + 3*cos(4*pi*k/8)+ sin(6*pi*k/8)
f256 = [f16 zeros(1,240)];
plot(0:255,abs(fft(f256)),’o’);
hold;
stem(0:16:255, abs(fft(f16)),’filled’);
11–4
zeros(1,8)];
F
m
1 4
1 2
1 0
8
6
4
2
0
0
5 0
1 0 0
1 5 0
2 0 0
2 5 0
m
The original 16 DFT points are shown as filled circles (produced by the stem()
function). The interpolation of 15 new values between these points can be easily
seen.
Example 2
What is the effect of adding M zeros to the center of a DFT record {Fm } before
taking the inverse DFT?
Fm
Fm
o r ig in a l D F T r e c o r d ( le n g th N )
c e n te r - p a d d e d D F T r e c o r d ( le n g th N + M )
M
0
N -1
m
0
a d d e d z e ro s
N + M -1
m
We assume that no aliasing has taken place in the original sampling operation.
Let’s answer this by considering what the DFT would have been if we had sampled
f (t) at a higher rate, for example let’s consider twice the original rate.
• Since no aliasing was present in the original record, there will ne no aliasing
at the higher rate.
11–5
• The total duration T = N ΔT = 2N (ΔT /2) , therefore the line spacing ΔΩ
remains constant.
• The Nyquist frequency ΩN = π/(ΔT /2) has been doubled.
• The spectrum has been scaled.
This argument says that doubling the sampling rate (halving the interval ΔT )
has simply inserted N samples into the center of the DFT record {Fm }, and
scaled the data points. In general, inserting kN zeros into the center of a DFT
record and then taking the inverse DFT of the new record of length (k + 1)N , is
to interpolate k − 1 samples between each of the original N data points (and to
scale the data set).
The following MATLAB fragment was used to demonstrate the interpolation.
i=0:7;
f8=cos(2*pi*(i-1)/8) + 3*cos(4*pi*(i-1)/8)+ sin(6*pi*(i-1)/8) ;
% Take the DFT
Fin = fft(f8);
% Pad the center of the DFT with zeros.
Fout = zeros(56,1);
Fout(1:4) = Fin(1:4);
Fout(61: 64) = Fin(5:8);
% Take the inverse DFT, scale, and preserve the real part
fout = real(ifft(Fout))*8;
plot(0:63,fout,’o’);
hold on;
stem(0:8:63,f8,’filled’);
A data record of length 8 is created, and the DFT is computed. The center of
this record is padded with zeros to form a length 64 DFT. The inverse DFT is
then computed and plotted. The results are shown below. The original length 8
data sequence is shown with filled circles, and the interpolated data points are
shown as open circles.
fn
4
3
2
1
0
0
1 0
2 0
3 0
-1
-2
-3
-4
11–6
4 0
5 0
6 0
n
2
The Fast Fourier Transform (FFT)
Although the DFT was known for many decades, its utility was severely limited because of
the computational burden. The calculation of the DFT of an input sequence of an N length
sequence {fn }
N
−1
�
2πmn
Fm =
fn e−j N ,
m = 0, . . . , N − 1
(4)
n=0
requires N complex multiplications to compute each on the N values, Fm , for a total of N 2
multiplications. Early digital computers had neither fixed-point nor floating-point hardware
multipliers, and multiplication was performed by binary shift-and-add software algorithms.
Multiplication was therefore a computationally “expensive” and time consuming operation,
rendering machine computation of the DFT impractical for common usage.
The FFT is a computationally efficient algorithm to compute the DFT, by eliminating
redundant complex multiplications. In this course we look at a single implementation - the
radix-2 FFT with decimation in time and input-bit-reversal. Many other algorithms exist.
We start by writing the DFT as
Fm =
N
−1
�
fn e
−j
2πmn
N
n=0
=
N
−1
�
fn WNmn ,
m = 0, . . . , N − 1
n=0
where WN = e−j 2π/N . We also note the following periodic and symmetry properties of WN
k(N −n)
• WN
= WN−kn = WNkn (complex conjugate symmetry),
k(n+N )
• WNkn = WN
n−N/2
• WNn = −WN
n(k+N )
= WN
(periodicity in n and k),
for n ≥ N/2.
The FFT recognizes that these properties render many of the N 2 complex multiplications in
the DFT redundant.
Assume that the input sequence length N is even. We then ask whether any compu­
tational efficiency might be gained from splitting the calculation of {Fm } into two subcomputations, each of length N/2, involving the even samples, {f2n }, and odd samples
{f2n+1 } for n = 0 . . . N/2 − 1. Then
Fm =
=
=
P
−1
�
n=0
P
−1
�
n=0
P
−1
�
f2n WN2mn
+
P
−1
�
m(2n+1)
f2n+1 WN
n=0
f2n WN2mn + WNm
f2n WPmn + WNm
n=0
= Am + WNm Bm ,
11–7
P
−1
�
f2n+1 WN2mn
n=0
P
−1
�
f2n+1 WPmn
n=0
m = 0, . . . , N − 1.
where P = N/2, {Am } is a DFT of length N/2, based on the even sample points, and similarly
{Bm } is a DFT of length N/2 based on the odd sample points of {fn }. For example, if N = 8
the DFT relationship of {fn } shown as
fn
Fm
N = 8
N = 8
p e r io d ic w ith p e r io d 8
p e r io d ic w ith p e r io d 8
D F T
0
2
1
4
3
6
5
n
7
2
1
0
4
3
6
5
m
7
may decomposed into even and odd sample sets with a DFT relationship for the even set
indicated as
s e le c t th e e v e n s a m p le s o f { f n } to
fo r m a n e w s e t o f le n g th 4 .
fn
A
m
N = 4
p e r io d ic w ith p e r io d 4
D F T
0
1
2
3
4
5
6
n
7
0
1
2
3
4
5
6
7
m
o n e p e r io d
We also note from the properties of the DFT that both {Am } and {Bm } are periodic
with period N/2, that is
Am+N/2 = Am ,
and
Bm+N/2 = Bm
so that
Fm = Am + WNm Bm
m−N/2
Fm = Am−N/2 − WN
for m = 0 . . . (N/2 − 1), and
Bm−N/2
for m = N/2 . . . (N − 1)
These equations show that a DFT of length N may be synthesized by combining
two shorter DFTs from an even/odd decomposition of the original data set. For
example, if N = 8, F3 and F7 are simply related:
F3 = A3 + W83 B3
F7 = A7 + W87 B7 = A3 − W83 B3
so that N/2 multiplications are required to combine the two sets. Each of the two
shorter DFTs requires (N/2)2 complex multiplications, therefore the total required
is N 2 /2 + N/2 < N 2 , for N > 2, indicating a computational saving.
A modified discrete form of Mason’s signal-flow graph is commonly used to display the
algorithmic structure of the synthesis. The figure below shows the signal-flow graph - con­
sisting of a network of nodes connected by line segments.
11–8
a + W
a
N
n
n
b
b
The algorithm works from left to right, and each right-hand node is assigned a value that
is the weighted sum of the connected left-hand nodes, where the indicated weight n is the
exponent of WN . If no weight is indicated, it is assumed to be unity (or equivalent to WN0 ).
Thus the output of the step shown above is c = a + WNn b.
With this notation the combining of the two length N/2 DFTs is illustrated below for
N=8. Each right-hand node is one of the Fm , formed by the appropriate combination of Am
and Bm .
A
4 - p o in t D F T
0
fr o m e v e n s a m p le s
{ f 0 , f 2 , f 4 , f6 }
1
A
2
0
A
1
2
A
3
3
B
4
0
4 - p o in t D F T
fr o m o d d s a m p le s
{ f 1 , f 3 , f 5 , f7 }
B
5
1
B
6
3
7
+ W
0
0
8
F1 = A
1
+ W
8
F2 = A
2
+ W
8
F3 = A
3
+ W
8
F4 = A
4
+ W
8
F5 = A
2
B
F0 = A
F6 = A
F7 = A
+ W
5
+ W
6
7
+ W
B
1
B
1
2
B
2
3
B
3
4
B
4
5
8
B
6
8
8
0
= A
5
B
7
= A
= A
B
6
7
= A
- W
0
- W
1
- W
2
3
- W
0
8
8
1
B
8
B
0
2
1
8
B
3
B
2
3
This only the first step in the development of the FFT. The complete algorithm will be
developed in Lecture 12.
11–9
Download