DSP - ExtraProblems - Solutions PDF
DSP - ExtraProblems - Solutions PDF
14
1.12 Matching. Match each discrete-time signal with its DFT by filling out the following table. You should
be able to do this problem with out using a computer.
Signal DFT
1
2
3
4
5
6
7
8
15
SIGNAL 1 SIGNAL 2
1.5 1.5
1 1
0.5 0.5
0 0
0.5 0.5
1 1
1.5 1.5
0 10 20 30 0 10 20 30
SIGNAL 3 SIGNAL 4
1.5 1.5
1 1
0.5 0.5
0 0
0.5 0.5
1 1
1.5 1.5
0 10 20 30 0 10 20 30
SIGNAL 5 SIGNAL 6
1.5 1.5
1 1
0.5 0.5
0 0
0.5 0.5
1 1
1.5 1.5
0 10 20 30 0 10 20 30
SIGNAL 7 SIGNAL 8
1.5 1.5
1 1
0.5 0.5
0 0
0.5 0.5
1 1
1.5 1.5
0 10 20 30 0 10 20 30
16
DFT 1 DFT 2
30 30
20 20
10 10
0 0
0 10 20 30 0 10 20 30
DFT 3 DFT 4
30 30
20 20
10 10
0 0
0 10 20 30 0 10 20 30
DFT 5 DFT 6
30 30
20 20
10 10
0 0
0 10 20 30 0 10 20 30
DFT 7 DFT 8
30 30
20 20
10 10
0 0
0 10 20 30 0 10 20 30
Solution:
Signal 1 has exactly two cycles of a cosine, so you would expect X(2) and X(2) to be nonzero, and
other DFT coefficients to be 0; that gives DFT 4. Note that X(2) is really X(N 2).
Signal 2 has two and a half cycles of a cosine, so you would expect the DFT to have a peak at index
k = 2.5, but that is not an integer there is no DFT coefficient at that index. So the largest DFT
coefficients would be at k = 2 and k = 3 and there would be leakage. There would also be a peak
17
Signal DFT
1 4
2 6
3 1
4 2
5 8
6 7
7 3
8 5
18
1.25 The analog signal x(t) is band-limited to 40 Hz. Suppose the signal is sampled at the rate of 100
samples per second and that at this rate 200 samples are collected. Then 200 zeros are appended to
the 200 samples to form a 400-point vector. Then the 400-point DFT of this vector is computed to get
X(k) for 0 k 399.
(a) Which DFT coefficients are free of aliasing?
(b) The DFT coefficient X(50) represents the spectrum of the analog signal at what frequency f ?
(Give your answer in Hz).
Solution:
(a) All of the DFT coefficients are free of aliasing. The sampling rate is more that twice the maximum
signal frequency.
(b) The DFT bin width is 100/400 or 0.25 Hz. The 50th DFT coefficient corresponds to the frequency
50 times 0.25 Hz or 12.5 Hz .
34
3.3 Matching. The diagrams on the following three pages show the impulse responses, pole-zero diagrams,
and frequency responses magnitudes of 8 discrete-time causal LTI systems. But the diagrams are out
of order. Match each diagram by filling out the following table.
52
1 1
0.5 0.5
0 0
0.5 0.5
1 1
0 5 10 15 20 25 0 5 10 15 20 25
1 1
0.5 0.5
0 0
0.5 0.5
1 1
0 5 10 15 20 25 0 5 10 15 20 25
1 1
0.5 0.5
0 0
0.5 0.5
1 1
0 5 10 15 20 25 0 5 10 15 20 25
1 1
0.5 0.5
0 0
0.5 0.5
1 1
0 5 10 15 20 25 0 5 10 15 20 25
53
imag part
0
6 0
2
0.5 0.5
1 1
1.5 1 0.5 0 0.5 1 1.5 1.5 1 0.5 0 0.5 1 1.5
real part real part
0.5 0.5
imag part
imag part
0 0
0.5 0.5
1 1
1.5 1 0.5 0 0.5 1 1.5 1.5 1 0.5 0 0.5 1 1.5
real part real part
0.5 0.5
imag part
imag part
0 0
2
0.5 0.5
1 1
1.5 1 0.5 0 0.5 1 1.5 1.5 1 0.5 0 0.5 1 1.5
real part real part
0.5 0.5
imag part
imag part
0
2 0
0.5 0.5
1 1
1.5 1 0.5 0 0.5 1 1.5 1.5 1 0.5 0 0.5 1 1.5
real part real part
54
1.2 6
1 5
0.8 4
0.6 3
0.4 2
0.2 1
0 0
1 0.5 0 0.5 1 1 0.5 0 0.5 1
/ /
FREQUENCY RESPONSE 3 FREQUENCY RESPONSE 4
6 3.5
5 3
2.5
4
2
3
1.5
2
1
1 0.5
0 0
1 0.5 0 0.5 1 1 0.5 0 0.5 1
/ /
FREQUENCY RESPONSE 5 FREQUENCY RESPONSE 6
3.5 20
3
15
2.5
2 10
1.5
5
1
0.5 0
1 0.5 0 0.5 1 1 0.5 0 0.5 1
/ /
FREQUENCY RESPONSE 7 FREQUENCY RESPONSE 8
3.5 7
3 6
5
2.5
4
2
3
1.5
2
1 1
0.5 0
1 0.5 0 0.5 1 1 0.5 0 0.5 1
/ /
Solution:
55
56
H(z) = (1 z 1 )3 (1 + z 1 )3
0.5
Imaginary Part
3 6 3
0
0.5
1
1 0.5 0 0.5 1
Real Part
|H()|
10
0
1 0.5 0 0.5 1
omega/
59
H(z) = z 1 + z 6
z 1 + z 6 = 0 (17)
5
z +1=1 (18)
5
z = 1 (19)
z 5 = ej (20)
5 j +j 2 k
z =e (21)
j /5+j (2 /5) k
z=e (22)
0.5
0.5
5
0 0
0.5
0.5
1
1
1.5
0 2 4 6 8 1 0 1
Real Part
|H()|
2
1.5
0.5
0
4/5 3/5 2/5 /5 0 /5 2/5 3/5 4/5
A()
2
2
4/5 3/5 2/5 /5 0 /5 2/5 3/5 4/5
All the zeros lie on the unit circle, with equal spacing between them. From that, we can sketch the
frequency response.
65
4.8 Matching. Match each impulse response with its frequency response and zero diagram by filling out
the following table. You should do this problem with out using a computer.
1 1
0 0
1 1
2 2
0 2 4 6 0 2 4 6
1 1
0 0
1 1
2 2
0 2 4 6 0 2 4 6
69
ZPLANE A ZPLANE B
1 1
0.5 0.5
Imaginary Part
Imaginary Part
5 4
0 0
0.5 0.5
1 1
1 0.5 0 0.5 1 1 0.5 0 0.5 1
Real Part Real Part
ZPLANE C ZPLANE D
1 1
0.5 0.5
Imaginary Part
Imaginary Part
4 5
0 0
0.5 0.5
1 1
1 0.5 0 0.5 1 1 0.5 0 0.5 1
Real Part Real Part
4 4
3 3
2 2
1 1
0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
/ /
5 5
4 4
3 3
2 2
1 1
0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
/ /
Solution:
70
71
Without consulting MATLAB, match each of the two filters, h3 and h4, with their pole-zero diagrams
shown below.
1 1
0.5 0.5
DIAGRAM 1
DIAGRAM 2
4 6
0 0
0.5 0.5
1 1
1 0 1 1 0 1
1 1
0.5 0.5
DIAGRAM 3
DIAGRAM 4
2 6 6 2
0 0
0.5 0.5
1 1
1 0 1 1 0 1
1 1
0.5 0.5
DIAGRAM 5
DIAGRAM 6
6 6 2
0 0
0.5 0.5
1 1
1 0 1 1 0 1
1 1
0.5 0.5
DIAGRAM 7
DIAGRAM 8
4 2 6
0 0
0.5 0.5
1 1
1 0 1 1 0 1
79
Solution:
Note that h1 is a lowpass filter of Type 2. Also, from the code, we see that h2 (n) = (1)n h1 (n), so h2
is a highpass filter of Type 4. From the code we have that H3 (z) = H2 (z) (1 z 1 ) which puts a null
in the frequency response at = 0. Since h2 already has a zero at z = 1, h3 will have a double zero at
z = 1 and will be a Type 1 filter. So h3 will correspond to pole-zero diagram 4 or 6. (This is not such
a good exercise!) From the code we have h4 (n) = (1)n h3 (n) or H4 (z) = H3 (z) which will negate
all the zeros of H3 (z) so h4 will correspond to pole-zero diagram 3 or 8.
80
1 1
0.5 0.5
0 0
0.5 0.5
1 1
0 2 4 6 0 2 4 6
1 1
0.5 0.5
0 0
0.5 0.5
1 1
0 2 4 6 0 2 4 6
1 1
0.5 0.5
0 0
0.5 0.5
1 1
0 2 4 6 0 2 4 6
81
1.5 1.5
1 1
0.5 0.5
0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
2
1.5
1.5
1
1
0.5
0.5
0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
2
1.5
1.5
1
1
0.5
0.5
0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
/ /
82
Imaginary Part
Imaginary Part
0.5 0.5
5 5
0 0
0.5 0.5
1 1
1 0 1 1 0 1
Real Part Real Part
ZERO DIAGRAM 3 ZERO DIAGRAM 4
1 1
Imaginary Part
Imaginary Part
0.5 0.5
5 2 5
0 0
0.5 0.5
1 1
1 0 1 1 0 1
Real Part Real Part
ZERO DIAGRAM 5 ZERO DIAGRAM 6
1 1
Imaginary Part
Imaginary Part
0.5 0.5
5 2 5
0 0
0.5 0.5
1 1
1 0 1 1 0 1
Real Part Real Part
Solution:
Although each impulse is one of the four types of FIR linear phase filter, in this problem, it is instructive
to look at the number of sign changes in the impulse response. Roughly, the more sign changes an
impulse response have, the higher its frequency content is. Impulse response 3 has no sign changes and
it is a lowpass filter that impulse response has the lowest frequency content. Then impulse response
1 has one sign change. Impulres response 6 has 2 sign changes etc. So you can match them to each of
the frequency responses each frequency response has its passband at a different frequency. From the
frequency response, the zero diagram can be directly found.
83
4.15 A student is asked to design a Type I and a Type II low-pass FIR linear-phase filter using DFT-based
interpolation. The student turns in the work shown on the next page, which has two problems.
(a) The student does not provide an explanation.
(b) One of the solutions is correct, the other solution is fake (the student just made up the vector h,
it does not follow from the MATLAB commands).
Identify which solution is correct and provide an explanation for it. Why does the fake solution not
work? You should be able to do this problem with out actually using MATLAB.
89
>> H = [1 1 1 1 1 0 0 0 0 0 0 1 1 1 1];
>> v = ifft(H);
>> h = [v(9:15); v(1:8)]
h =
0.0394
-0.0667
0
0.0853
-0.0667
-0.0963
0.3050
0.6000
0.3050
-0.0963
-0.0667
0.0853
0
-0.0667
0.0394
>> H = [1 1 1 1 1 0 0 0 0 0 1 1 1 1];
>> v = ifft(H);
>> h = [v(9:14); v(1:8)]
h =
-0.0318
-0.0494
0.0891
-0.0255
-0.1287
0.2892
0.6429
0.6429
0.2892
-0.1287
-0.0255
0.0891
-0.0494
-0.0318
Solution:
The Type II filter solution is incorrect. The Type I filter solution is right.
For the Type I solution, note that the vector H is of length 15 and that it is real and circularly symmetric.
That means that the inverse DFT, (v in the code) is also real and circularly symmetric, and also of
length 15. The vector v will have the following symmetry pattern:
90
v = [a b c d e f g h h g f e d c b]
So the vector h produced by the 3rd line of MATLAB code in the Type I solution will have the symmetry
pattern:
v = [h g f e d c b a b c d e f g h]
v = [a b c d e f g h g f e d c b]
So the vector h produced by the 3rd line of MATLAB code in the Type II solution will have the symmetry
pattern:
v = [g f e d c b a b c d e f g h]
which is not a symmetric impulse response. The actual result of the MATLAB commands for the Type
II filter is:
h =
-0.0318
-0.0494
0.0891
-0.0255
-0.1287
0.2892
0.6429
0.2892
-0.1287
-0.0255
0.0891
-0.0494
-0.0318
0.0714
To design a Type II FIR filter using DFT-based interpolation, we can use a phase-shift of A prior to
using the DFT. In that case, the ones at the end of the A vector should be 1.
91
4.16 Optional : Mitra 4.19. (But use the frequencies 0.2, 0.4, 0.9)
Solution:
This is an interpolation problem:
We can use the general interpolation approach described in the notes. The impulse response we get as
a solution is
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
1
1 0 1 2 3 4 5
n
|A()|
1.4
1.2
0.8
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
/
N = 5;
M = (N-1)/2;
wk = [0.2 0.4 0.9]*pi;
Ak = [0 1 0];
C = cos(wk*[0:M]);
a = C\Ak;
h = (1/2)*[a([M:-1:1]+1); 2*a([0]+1); a([1:M]+1)];
figure(1)
clf
subplot(2,1,1)
stem(0:N-1,h,.)
xlabel(n)
title(IMPULSE RESPONSE h(n))
axis([-1 5 -1 1])
[A,w] = firamp(h,1);
subplot(2,1,2)
93
5.3 (Porat 6.1) We saw that the height of the largest side-lobe of the rectangular window is about -13.5
dB relative to the main-lobe. What is the relative height of the smallest side-lobe? You may assume
the window length N is odd. (Hint: At what frequency will it be located?).
Solution:
The smallest side lobe of the Dirichlet kernel is at = . The formula is
sin N2
f
S () = .
sin 21
so
N
sin
S f () = 2
1
=1
sin 2
when N is odd. Recall that S f (0) = N . The relative height of the smallest side-lobe is therefore 1/N .
99
5.15 The following spectrogram is taken from the HW submitted by an EL 713 student.
Which of the following three parameters would you suggest the student modify to best improve the ap-
pearance of this spectrogram? What change would you make to that parameter? The three parameters
are:
R = block length.
L = time lapse between blocks.
N = FFT length. (Each block is zero-padded to length N .)
Explain your answer.
Solution:
The student should reduce L the time-lapse between blocks. (Equivalently, the overlap fraction should
be increased.) Making that change will reduce the step like appearance of the spectrogram.
119
5.17 The following figures show a signal and its spectrogram, computed with different sets of parameters,
R {30, 60}, N {64, 256}
where
R = block length
N = FFT length (nfft in the Matlab specgram function). (Each block is zero-padded to length N .)
(a) For each of the spectrograms, indicate what you think R and N are, and explain your choices.
(b) Describe how the spectrogram would change if the time-skip (L in the notes), is increased.
0.5
SIGNAL
0.5
1
0 20 40 60 80 100 120 140 160 180 200
frequency
0 0 0
0 50 100 150 0 50 100 150 0 50 100 150
time time time
Solution:
For spectrogram B, the vertical width of the bar with respect to the frequency axis is less than for
spectrogram A, so spectorgram B uses a longer block length than spectrogram A. In addition, the point
in the middle where the frequency starts to decrease is blurred, which also suggests that spectrogram B
uses a longer block length.
The horizontal stripe effect in spectrogram C is due to discontinuities along the frequency axis so for
spectrogram C there is less zero padding that for A and B. Except for the stripe artifact, spectrogram
C appears to be similar to spectram A, so it appears that they use the same block length.
Spectrogram R N
A 30 256
B 60 256
C 30 64
127