You are on page 1of 6

SOME MATCHING EXERCISES FOR INTRODUCTORY DIGITAL SIGNAL PROCESSING

Ivan W. Selesnick

Polytechnic University, Brooklyn, NY


selesi@poly.edu

ABSTRACT transform (DFT),


This paper describes several types of matching exercises for
N
 −1  
introductory digital signal processing. The paper presents ex- 2π
ample exercises in four areas of DSP: the discrete Fourier X(k) = x(n) exp −j kn , 0≤k ≤N −1
n=0
N
transform, weighted least square FIR filter design, minimum-
phase FIR filters, and the short-time Fourier transform. These is computed, where N = 28. The magnitude of the DFT
exercises tests for conceptual understanding of important con- coefficients |X(k)| are also illustrated in Fig. 1, however, they
cepts rather than computational ability. are out of order. Match each signal to its DFT by completing
the following table.
1. INTRODUCTION
Signal DFT
Computer-based exercises for DSP, like those of [2], provide 1
an excellent way to provide the student with experience solv- 2
ing DSP problems. For testing and teaching some concepts, 3
other types of exercises can be beneficial. Matching exercises 4
allow the instructor to test for understanding of important con- 5
cepts rather than computational ability and therefore serve as 6
a useful complement to other types of DSP exercises. This 7
paper describes several types of matching exercises for intro- 8
ductory digital signal processing. The paper presents example 9
exercises in four areas of DSP: the discrete Fourier transform,
weighted least square FIR filter design, nonlinear-phase FIR
Discussion: In addition to learning about the properties of the
filters, and the short-time Fourier transform. I have found in
DFT, the student is expected to recognize the DFT of basic
teaching DSP that matching exercises provide a way both to
signals (the DFT of a constant signal, a rectangular pulse, an
teach certain concepts and to evaluate understanding by the
impulse and a cosine signal). The student should also under-
student.
stand that the DFT of a sine or cosine sequence, with exactly
Textbooks on DSP and ‘Signals, Systems, and Transforms’
an integer number p of periods (signals 1 and 3 in Fig. 1),
do not generally contain many matching exercises, perhaps
will have two non-zero DFT coefficients at index k = p and
in part because a single matching exercise can consume an
k = N − p. The exercise in Fig. 1 also requires the stu-
entire page. However, many excellent matching exercises
dent to understand that if a sine sequence has p periods where
are provided in the Signals and Systems Concept Inventory
p is not exactly an integer, then the energy of the DFT will
(SSCI) exam [3, 4], for example, for convolution, frequency
be concentrated around p and N − p. In addition, the stu-
response, and pole-zero diagrams, etc. The exercises pre-
dent should understand the effect on the DFT when the sig-
sented in this paper follow the idea of SSCI of testing con-
nal is multiplied by (−1)n , and that the signal (−1)n is the
cepts to complement computational skills.
‘highest-frequency’ signal, and can be thought of as cos(π n).

2. DISCRETE FOURIER TRANSFORM


3. WEIGHTED LEAST-SQUARE FIR FILTER
Exercise: Fig. 1 illustrates nine 28-point discrete-time signals DESIGN
x(n), 0 ≤ n ≤ 27. For each signal, the discrete Fourier
Exercise: Four FIR low-pass filters of equal length are de-
The author likes to acknowledge the Hans-Wilhelm and Helga Schüßler-
Stiftung for making possible his stay at the Universität Erlangen-Nürnberg in signed according to the weighted least-square error criterion.
2006. Specifically, the amplitude response A(ω) is designed so as

1-4244-0535-1/06/$20.00/©2006 IEEE 285


SIGNAL 1 SIGNAL 2 SIGNAL 3
1.5 1.5 1.5

1 1 1

0.5 0.5 0.5

0 0 0

−0.5 −0.5 −0.5

−1 −1 −1

−1.5 −1.5 −1.5


0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25

SIGNAL 4 SIGNAL 5 SIGNAL 6


1.5 1.5 1.5

1 1 1

0.5 0.5 0.5

0 0 0

−0.5 −0.5 −0.5

−1 −1 −1

−1.5 −1.5 −1.5


0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25

SIGNAL 7 SIGNAL 8 SIGNAL 9


1.5 1.5 1.5

1 1 1

0.5 0.5 0.5

0 0 0

−0.5 −0.5 −0.5

−1 −1 −1

−1.5 −1.5 −1.5


0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25

DFT 1 DFT 2 DFT 3


20 20
30

15 15
20
10 10

10
5 5

0 0 0
0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25

DFT 4 DFT 5 DFT 6


8 12
15
10
6
8
10
4 6

5 4
2
2

0 0 0
0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25

DFT 7 DFT 8 DFT 9


2
30 15

1.5
20 10
1

10 5
0.5

0 0 0
0 5 10 15 20 25 0 5 10 15 20 25 0 5 10 15 20 25

Fig. 1. A DFT matching problem. The signals and their DFTs are out of order; match each signal to its DFT. Each signal x(n)
is of length 28, defined on 0 ≤ n ≤ 27. Each DFT sequence X(k) is defined on k ≤ k ≤ 27. The magnitude |X(k)| is shown.

286
WEIGHTING FUNCTION 1
1.5
FREQUENCY RESPONSE A
bands on the error in the pass-band and stop-band; and how
1 the width of the zero-weighted transition band affects the fre-
1 quency response of the resulting filter. This simple matching
0.5 exercise helps the student understand the effect of the error
0.5
weighting function.
0 0
0 0.25 π 0.5 π 0.75 π π 0 0.25 π 0.5 π 0.75 π π

WEIGHTING FUNCTION 2 FREQUENCY RESPONSE B


4. NONLINEAR-PHASE FIR FILTERS
1.5
2
Exercise: Fig. 3 shows the impulse responses, pole-zero di-
1
1.5
agrams, and frequency responses magnitudes of six discrete-
1
0.5 time causal FIR filters. But the diagrams are out of order.
0.5
Match each set of diagrams by completing the following ta-
0
0 0.25 π 0.5 π 0.75 π π
0
0 0.25 π 0.5 π 0.75 π π ble. Note: There are only two distinct frequency response
WEIGHTING FUNCTION 3 FREQUENCY RESPONSE C
magnitudes among these six systems.
1.5
1
Impulse response Pole-zero Frequency response
1
1
0.5
0.5 2
3
0
0 0.25 π 0.5 π 0.75 π π
0
0 0.25 π 0.5 π 0.75 π π 4
WEIGHTING FUNCTION 4 FREQUENCY RESPONSE D
5
1.5
6
20
1
7
15
8
10
0.5
5
Discussion: The student should understand how to match the
0
0 0.25 π 0.5 π 0.75 π π
0
0 0.25 π 0.5 π 0.75 π π impulse response, transfer function zeros, and the frequency
ω ω
response magnitudes for simple systems. In addition, the stu-
dent should understand how to recognize low-pass and high-
Fig. 2. A matching problem for weighted least squares FIR pass filters of different pass-band widths from the impulse re-
filter design. Match each weighting function to its resulting sponse (a wide impulse responses gives a narrow pass-band,
frequency response. etc). For this problem, the student should in also understand
several other concepts: (1) the transformation of a low-pass
to minimize filter into a high-pass filter using (−1)n h(n), and how this
 affects the frequency response and pole-zero diagram; (2) the
π
E2 = W (ω)(A(ω) − D(ω))2 dω time-reversal of a filter using h(N − 1 − n), and how this af-
0 fects the frequency response and pole-zero diagram; (3) the
difference between a minimum-phase and maximum-phase
where the amplitude response D(ω) is an ideal low-pass fil- filter in terms of the pole-zero diagram and in terms of the
ter. Four different frequency-dependent weighting functions, center of mass of the impulse response.
W (ω), illustrated in Fig. 2 are used to produce four differ-
ent filters. The frequency responses, |H(ej ω )|, are also illus-
trated in Fig. 2, however, they are out of order. Match each 5. SHORT-TIME FOURIER TRANSFORM
frequency response with the weighting function used for the
design by completing the following table, and explain briefly. Exercise: Shown below are eight spectrograms of the same
discrete-time signal. (The signal is the sum of a cosine and an
Weighting function Frequency response impulse.) Each spectrogram is computed using a different set
1 of parameters,
2
3 R ∈ {18, 45}, L ∈ {1, 10} N ∈ {45, 256}
4
where
Discussion: The student should understand the role of the er- R = block length.
ror weighting function in the design. Specifically, the student L = time lapse between blocks (the overlap is R − L).
should understand the effect of different weights in different N = FFT length (each block is zero-padded to length N ).

287
IMPULSE RESPONSE 1 IMPULSE RESPONSE 2 IMPULSE RESPONSE 3
0.4 1 0.3

0.2 0.2
0.5

0 0.1

0
−0.2 0

−0.4 −0.5 −0.1


0 5 10 15 20 25 30 0 5 10 15 20 25 30 0 5 10 15 20 25 30

IMPULSE RESPONSE 4 IMPULSE RESPONSE 5 IMPULSE RESPONSE 6


0.3 1 0.4

0.2 0.2
0.5

0.1 0

0
0 −0.2

−0.1 −0.5 −0.4


0 5 10 15 20 25 30 0 5 10 15 20 25 30 0 5 10 15 20 25 30

POLE−ZERO DIAGRAM 1 POLE−ZERO DIAGRAM 2 POLE−ZERO DIAGRAM 3


1 1
1

0.5 0.5 0.5

0
30 0
30 0
30

−0.5 −0.5 −0.5

−1
−1 −1
−1 0 1 −2 −1 0 1 −1 0 1

POLE−ZERO DIAGRAM 4 POLE−ZERO DIAGRAM 5 POLE−ZERO DIAGRAM 6


1 1
1

0.5 0.5 0.5

0
30 0
30 0
30

−0.5 −0.5 −0.5

−1
−1 −1
−1 0 1 2 −1 0 1 −1 0 1

FREQUENCY RESPONSE 1 FREQUENCY RESPONSE 2


1.5 1.5

1 1

0.5 0.5

0 0
−π −0.5 π 0 0.5 π π −π −0.5 π 0 0.5 π π
ω ω
FREQUENCY RESPONSE 3 FREQUENCY RESPONSE 4
1.5 1.5

1 1

0.5 0.5

0 0
−π −0.5 π 0 0.5 π π −π −0.5 π 0 0.5 π π
ω ω

Fig. 3. A matching problem for nonlinear-phase FIR filters. The diagram are out of order; match each diagram to the other
ones.

288
For each of the eight spectrograms, indicate what you think 7. REFERENCES
R, L, and N are, by completing the table and explain your
answers. [1] R. G. Baraniuk, C. S. Burrus, D. H. Johnson, and D. L.
Jones. Sharing knowledge and building communities in
Spectrogram R L N signal processing. IEEE Signal Processing Magazine,
A 21(5):10–16, September 2004.
B
[2] C. S. Burrus, J. H. McClellan, A. V. Oppenheim, T. W.
C
Parks, R. W. Schafer, and H. W. Schuessler. Computer-
D
Based Exercises for Signal Processing. Prentice Hall,
E
1994.
F
G [3] K. E. Wage, J. R. Buck, and C. H. G. Wright. Obstacles in
H signals and systems conceptual learning. In Proc. Third
IEEE Signal Processing Education Workshop, pages 58–
Discussion: For this exercise1 the student should understand 62, Aug 1-4 2004.
the effect on the appearance of the spectrogram caused by
adjusting each of the three parameter values. Most impor- [4] K. E. Wage, J. R. Buck, C. H. G. Wright, and T. B.
tantly, the student should understand how the block length, Welch. The signals and systems concept inventory. IEEE
R, affects the frequency/time-resolution of the spectrogram. Trans. on Education, 48(3):448–461, August 2005.
In addition, the parameters L (equivalently, the overlap) and
N affect the number of rows and columns of the discrete-time
discrete-frequency spectrogram array.
Spectrogram A is ‘pixelated’ along the frequency axis,
which means that there are few DFT coefficients in each col-
umn of the spectrogram. So for spectrogram A, N = 45. For
the same reason, N = 45 for spectrograms B, C, and G.
Similarly, spectrograms B, C, D, and F are ‘pixelated’
along the time axis, which means that these images contain
few columns, which occurs when the time lapse between blocks
is large (small amount of overlap). For these spectrograms,
L = 10. The other spectrograms have L = 1.
For spectrograms A, C, E, and F the frequency-resolution
is not as good as it is for the other four spectrograms. No-
tice that for these four spectrograms, the horizontal line that
represents the cosine signal is wider that for the other four
spectrograms — it is less clear what the actual frequency of
the cosine signal is. Therefore, for spectrograms A, C, E, and
F, the block length must be shorter than it is for the other four
spectrograms.

6. CONCLUSION

Matching exercises can be easy for students who do under-


stand the concepts in question, however, when a matching ex-
ercise has a large number of elements to match (18 separate
diagrams in Fig. 1 and 16 in Fig. 3) one can be confident that
correct answers are not due completely to guessing. Indeed,
students who have not understood the concept will often get
no correct matches in such exercises. This paper shows how
student understanding of some DSP concepts can be evalu-
ated by simple matching exercises.
1 An earlier version of this exercise was posted by the author on the Con-

nexions site at www.cnx.org [1].

289
SPECTROGRAM A SPECTROGRAM B
0.5 0.5

0.4 0.4
frequency

frequency
0.3 0.3

0.2 0.2

0.1 0.1

0 0
0 50 100 150 0 50 100 150
time time
SPECTROGRAM C SPECTROGRAM D
0.5

0.4 0.4
frequency

frequency
0.3 0.3

0.2 0.2

0.1 0.1

0 0
0 50 100 150 0 50 100 150
time time
SPECTROGRAM E SPECTROGRAM F

0.4 0.4
frequency

frequency

0.3 0.3

0.2 0.2

0.1 0.1

0 0
0 50 100 150 0 50 100 150
time time
SPECTROGRAM G SPECTROGRAM H
0.5

0.4 0.4
frequency

frequency

0.3 0.3

0.2 0.2

0.1 0.1

0 0
0 50 100 150 0 50 100 150
time time

Fig. 4. A matching problem for the short-time Fourier transform. For each spectrogram, identify which parameters values from
the problem statement are used.

290

You might also like