DSP Problem
DSP Problem
T-61.3010 Digital Signal Processing and Filtering T-61.3010 Digital Signal Processing and Filtering
T-61.3010 DSP 2009 3/170 DESCRIPTIONS T-61.3010 DSP 2009 4/170 DESCRIPTIONS
T-61.3010 Digital Signal Processing and Filtering T-61.3010 Digital Signal Processing and Filtering
Example problems for spring 2009. Corrections and comments to [email protected]!
1 2
1.5
y z = x + yj
0.5 jθ 1
=r sin(θ) r =re
θ 0.5
0
x = r cos(θ) 0
−0.5 −0.5
z*
−1
−1
−1.5
−1 −0.5 0 0.5 1 −2 −1 0 1
Figure 1: Problem 1, unit circle in complex plane (left), and points for (a), (b), and (c) (right).
T-61.3010 DSP 2009 7/170 PROBLEMS – Part A 1-13 T-61.3010 DSP 2009 8/170 PROBLEMS – Part A 1-13
2. Problem: Examine the connection between exponential functions and cosines and sines. 3. Problem: Consider the following three complex numbers z1 = 3 + 2j, z2 = −2 + 4j, and
z3 = −1 − 5j.
a) Express with cosines and sines: ejθ + ej(−θ) .
b) Express with cosines and sines: ejθ − ej(−θ) . a) Draw the vectors z1 , z2 , and z3 separately in the complex plane.
c) Express with cosines and sines: ejπ/8 · ejθ − ej(−π/8) · ej(−θ) . b) Draw and compute the sum z1 + z2 + z3 .
c) Draw and compute the weighted sum z1 − 2z2 + 3z3 .
[L0140] Solution: Euler’s formula ejθ = cos(θ) + j · sin(θ) can be thought as a phasor d) Draw and compute the product z1 · z2 · z3 .
going
√ around on the unit circle, see Problem 5. It is an unit circle because |ejθ | = e) Compute and reduce the division z1 /z2 .
cos2 + sin2 = 1 always. Cosine is an even function f (x) = f (−x), whereas sine is odd
function f (x) = −f (−x). Real part of ejθ is cosine, and imaginary part is sine.
[L0138] Solution:
a) Sum of exponentials at positive frequency θ and negative frequency −θ gives a real
a) Each complex number can be thought as a vector starting from origin and the other
cosine at frequency θ:
end at point z. See Figure 2(a).
ejθ = cos(θ) + j · sin(θ) b) Real parts and imaginary parts can be summed separately z = (3 − 2 − 1) + (2 + 4 −
ej(−θ) = cos(−θ) + j · sin(−θ) = cos(θ) − j · sin(θ) 5)j = j. This can be expressed in the polar coordinates z = ej(π/2) , i.e. on the unit
ejθ + ej(−θ) = 2 cos(θ) ∈ R circle (radius 1) and the angle one fourth a circle (90 degrees, π/2) counterclockwise.
cos(θ) = 0.5 · ejθ + 0.5 · ej(−θ) c) If you are computing without computer, be attentive and check twice that all coef-
ficients are correctly reduced. z = (3 +p
2j) − 2(−2 + 4j) + 3(−1 − 5j) = 4 − 21j.
b) In the same way as in (a) but substracting the last from the first gives Again, in the polar coordinates r = (4)2 + (−21)2 ≈ 21.38. The angle θ =
arctan((−21)/(4)) ≈ −1.38 ≈ −0.44π (−79◦ ).
ejθ = cos(θ) + j · sin(θ) If z = −4 − 21j, then the calculator gives θ = arctan((−21)/(−4)) ≈ 1.38 ≈ 0.44π
ej(−θ) = cos(−θ) + j · sin(−θ) = cos(θ) − j · sin(θ) (+79◦ ), which is incorrect (atan(-21/-4)). Notice that now z is in the third quarter
ejθ − ej(−θ) = 2j sin(θ) ∈ C and ±π has to be added. The correct angle is θ = arctan((−21)/(−4))−π ≈ −1.76 ≈
1 jθ 1 j(−θ) −0.56π (−101◦ ), in Matlab either atan2(-21,-4) or angle(-4-21j).
sin(θ) = ·e − ·e = −0.5j · ejθ + 0.5j · ej(−θ)
2j 2j d) When using Cartesian coordinates, multiply terms normally and apply j 2 = −1, e.g.,
(3 + 2j) · (−2 + 4j) = −6 + 12j − 4j + 8j 2 = −14 + 8j. The product in the polar
where 1
2j
= − 2j as shown in Problem 3(e). coordinates means multipling the lengths of vectors and summing the angles.
c) This can be thought as phase shift. First, use the rule ex · ey = ex+y ,
z = (3 + 2j) · (−2 + 4j) · (−1 − 5j) = 54 + 62j ≈ 82.2 · ej(0.27π)
√ √ √
ejθ · ejπ/8 = ej(θ+π/8) = 9 + 4 · 4 + 16 · 1 + 25 · ej(arctan(2/3)+arctan(4/(−2))+arctan((−5)/(−1)))
e−jθ · e−jπ/8 = e−j(θ+π/8)
e) The denominator is now complex. If both sides are multiplied by the complex con-
Now, we see using (b) jugate of the denominator then the denominator becomes real. Just as in Problem 1
z · z ∗ = |z|2 = r 2 ∈ R. Notice also that 1/j is −j because (1/j) · (j/j) = j/j 2 = −j.
ejπ/8 · ejθ − ej(−π/8) · ej(−θ) = 2j sin(θ + π/8)
z = (3 + 2j)/(−2 + 4j) | · (−2 − 4j)/(−2 − 4j)
Notice that each sinusoidal (cos, sin) can be replaced by two complex exponentials with = (2 − 12j)/20
a positive and a corresponding negative angle. When considering Fourier analysis, a real
4 z2
cosine signal with frequency fc can be represented in the spectrum with a peak at fc (in 6
3
one-sided spectrum) or with peaks at fc and −fc (in two-sided spectrum). If the two-sided 2 z1 5
spectrum is not symmetric, then the signal is surely not real but complex. More about 1 4 z
2
z3
this later in Fourier analysis, see Problem 37 and 41. 0
3
−1
2
−2 z1
−3 1 z
−4 0
z3
−5 −1
−5 −4 −3 −2 −1 0 1 2 3 4 5 6 −1 0 1 2 3 4
0.5π 3
ω x = Real(H(ω)) y = Imag(H(ω)) r = |H(ω)| θ = ∠H(ω) 1 2 0.1π
0 r 1
π/4 0π θ π
π/2 0.5π π ω 0.5π π ω
1 2 3
3π/4
π Figure 3: Problem 4: Plots of a complex-valued function, (a) H(ω) in complex plane, (b)
absolute values |H(ω)|, and (c) angle ∠H(ω). The case when ω = 3π/4 is highlighted.
Table 1: Problem 4: values of a complex-valued function in rectangular (x, y) and polar (r, θ)
coordinates.
5. Problem: Compute values of a complex-valued function H(ω)
[L0131] Solution: In this course complex-valued functions are widely used, e.g. as fre- H(ω) = 3e−jω + 2e−2jω − e−3jω
quency responses of the systems or in Fourier transforms. The argument of the function
is real-valued ω ∈ R, but the value of the function is generally complex H(ω) ∈ C due to at ω = {0, π/2, π} considering each complex exponential function as a phasor – not
complex factor ejω . In case of the transfer function H(z) both the argument z and the explicitly applying Euler’s formula (decomposition to cosines and sines).
function H(z) are complex-valued.
[L0165] Solution: The exponential function f (ω) = A ejω+θ , where A is radius and θ
a) Sometimes it is possible to simplify H(ω). However, normally it is useful to write
phase shift, can be considered as a phasor , which draws counterclockwise a circle with
down a suitable format for the use of the calculator. In this case, Cartesian coordi-
radius A when ω = 0 . . . 2π. The starting and ending point is A ejθ .
nate system with x and y is used:
There is a very nice Java applet demo “Harmonic phasors and Fourier series” in http://
H(ω) = 2 − e−jω = 2 − (cos(−ω) + j sin(−ω)) www.jhu.edu/~signals/phasorlecture2/indexphasorlect2.htm. Choose “Harmonic
= 2 − cos(ω) +j sin(ω) Phasor Sums” and click positions (3, 0), (5, 0), and (4, 0) in the complex plane for the
| {z } | {z }
x y
starting point and press Play button. This phasor rotates counterclockwise (ejω instead
of e−jω ). A similar Matlab program phasor.m can be found in the course web site. This
The variables r and p θ of the polar coordinate system are received from the right- problem requires a command phasor([3 2 -1], -1);
angled triangle: r = x2 + y 2 and θ = arctan(y/x). Consider each exponential as a phasor with radius 3, 2, and 1, starting points (3, 0), (2, 0),
On the other hand, in this case it is easily seen that there is only a circle (e−jω ) and (−1, 0), angular frequencies −ω, −2ω, and −3ω, and figure out / compute the values
whose origin is shifted to z = 2. H(ω) = {4, −2 − 4j, 0} at ω = {0, π/2, π}:
b) Take the columns x and y of Table 2 and sketch the curve like in Figure 3(a). There
is a line drawn in the plot, from the origin to a point related to ω = 3π/4, i.e. (x, y). 3e−jω 2e−2jω −e−3jω H(ω)
The length of the line is r and the angle between the line and x-axis is θ, so it can ω=0 3 2 −1 4
be written in polar coordinates r ejθ . ω = π/2 −3j −2 −j −2 − 4j
c) Take the column r of Table 2 and sketch the curve like in Figure 3(b). The plot ω=π −3 2 1 0
shows the distance r from the origin to a point at given value of ω.
d) Take the column θ of Table 2 and sketch the curve like in Figure 3(c). The plot These values are illustrated in Figure 4, where first three columns are individual phasors
shows the angle θ between the origin and a point at given value of ω. and the last column the phasor sum H(ω). The first row is the initial case at ω = 0.
The second row shows that the first phasor has moved one quarter clockwise (−ω ), second
T-61.3010 DSP 2009 11/170 PROBLEMS – Part A 1-13 T-61.3010 DSP 2009 12/170 PROBLEMS – Part A 1-13
phasor two quarters (−2ω ), and third phasor three quarters (−3ω ), i.e., moving three times 6. Problem: A cosine signal can be represented using its angular frequency Ω or frequency
“faster” than the first phasor. f , amplitude A and phase θ:
3 e−j ω, ω=0 π 2e
−2j ω
, ω=0 π −e
−3j ω
, ω=0 π SUM, ω=0 π x(t) = A cos(Ωt + θ) = A cos(2πf t + θ)
4 4 4 4
3 3 3 3
2 2 2 2
1
0
1
0
1
0
1
0
a) Estimate A, f, θ for the cosine x1 (t) in Figure 5(a).
−1 −1 −1 −1
−2
−3
−2
−3
−2
−3
−2
−3 b) Sketch a cosine x2 (t), with A = 2, angular frequency 47 rad/s and angle −π/2.
−4 −4 −4 −4
−4−3−2−1 0 1 2 3 4 −4−3−2−1 0 1 2 3 4 −4−3−2−1 0 1 2 3 4 −4−3−2−1 0 1 2 3 4
−j ω
c) Express x2 (t) in (b) using exponential functions.
3e , ω=0.5 π 2 e−2j ω, ω=0.5 π − e−3j ω, ω=0.5 π SUM, ω=0.5 π
4 4 4 4
3 3 3 3
2 2 2 2
1 1 1 1 2
0 0 0 0 1
−1 −1 −1 −1 1.5
−2 −2 −2 −2
−3 −3 −3 −3
−4 −4 −4 −4 0.5 1
−4−3−2−1 0 1 2 3 4 −4−3−2−1 0 1 2 3 4 −4−3−2−1 0 1 2 3 4 −4−3−2−1 0 1 2 3 4
−j ω
3 e , ω=1 π 2 e−2j ω, ω=1 π − e−3j ω, ω=1 π SUM, ω=1 π 0.5
4 4 4 4
3 3 3 3 0 0
2 2 2 2
1 1 1 1 −0.5
0 0 0 0
−1 −1 −1 −1
−2 −2 −2 −2 −0.5 −1
−3 −3 −3 −3
−4 −4 −4 −4 −1.5
−4−3−2−1 0 1 2 3 4 −4−3−2−1 0 1 2 3 4 −4−3−2−1 0 1 2 3 4 −4−3−2−1 0 1 2 3 4
−1 −2
Figure 4: Problem 5: Columns: Phasors and their sum. Rows: ω = 0, ω = 0.5π, and ω = π. −0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0 0.02 0.04 0.06 0.08 0.1 0.12
A cosine signal can be represented using its angular frequency Ω or frequency f , amplitude
A and phase θ:
x(t) = A cos(Ωt + θ) = A cos(2πf t + θ)
For a discrete sequence of numbers
a) Cosine oscillates between −0.8 and 0.8, so A = 0.8. There is no phase shift, θ = 0.
There is one oscillation in 0.2 seconds, so there are 5 periods in one second, f = 5
Hz, or Ω = 2πf = 10π rad/s.
Hence, x1 (t) = 0.8 cos(10πt).
T-61.3010 DSP 2009 13/170 PROBLEMS – Part A 1-13 T-61.3010 DSP 2009 14/170 PROBLEMS – Part A 1-13
b) x2 (t) can be written directly x2 (t) = 2 cos(47t − π/2). 7. Problem: Some elementary functions and notations.
Now Ω = 47 rad/s, hence f ≈ 7.5 Hz and the period T = 1/f ≈ 0.13 s. At
a) Compute with a calculator: log8 7.
t = 0, x2 (0) = 2 cos(−π/2) = 0, and increasing. Note that cos(Ωt − π/2) ≡ sin(Ωt).
Amplitude A = 2, so the curve oscillates between −2 and 2. The curve is plotted in b) The power of signal is attenuated from 10 to 0.01. How much is the attenuation in
Figure 6(b). decibels?
P
c) Using Euler’s formula, and properties of cosine (even function f (−x) = f (x)) and c) Sketch the curve p(x) = +N k=−N kx for various N.
sine (odd function f (−x) = −f (x)), d) Sinc-function is useful in the signal processing. It is defined sinc(x) = sin(πx)/(πx).
Also it is known that sin(x)/x → 1, when x → 0, and with sinc-function sinc(0) = 1.
ejω = cos(ω) + j sin(ω) Consider h(n) = sin(0.75πn)/(πn). What is h(0)?
+ e−jω = cos(ω) − j sin(ω)
e) What is the binary number (1001011)2 as a decimal number?
ejω + e−jω = 2 cos(ω) f) What is the hexadecimal number 0x01EF3A as a decimal number?
jω
g) Modulo-N operation for number x is written here as < x >N . What is < −5 >3 ?
e = cos(ω) + j sin(ω)
+ − e−jω = − cos(ω) + j sin(ω)
[L0133] Solution:
ejω − e−jω = 2j sin(ω)
a) logarithm: log8 7 = loge 7/ loge 8 ≈ 1.9459/2.0794 ≈ 0.936.
Now, it can be seen that Sometimes it is useful to convert, e.g., 22008 to decimal base: 22008 = 10x , taking log10
on both sides: x = 2008 log10 2 ≈ 604.4682. Now 100.4682 ≈ 2.9392, which finally
x2 (t) = 2 cos(47t − π/2) gives 22008 ≈ 2.9 · 10604. Remember also 210 = 1024 ≈ 1000 (k), 220 = 1048576 ≈ 106
= ej(47t−π/2) + e−j(47t−π/2) (M), etc. For instance, 232 = 22 · 230 ≈ 4G.
b) Decibel scales are widely used to compare two quantities. The decibel difference
which can be even “simplified” (?!) to x2 (t) = j[e−j47t − ej47t ].
between two power levels, ∆L, is defined in terms of their power ratio W2 /W1 (p.
99, Rossing et al., The Science of Sound, 3rd Edition, Addison Wesley)
1
2
−1 −2
In case of computing amplitude response |H(ejω )|, e.g. in Matlab directly from the
−0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0 0.02 0.04 0.06 0.08 0.1 0.12 equation or with the command freqz, the values are squared for decibels
Figure 6: Cosine x1 (t) (left) and x2 (t) (right) in Problem 6. 10 log10 |(H/H0 )|2 = 20 log10 |(H/H0 )|
T-61.3010 DSP 2009 15/170 PROBLEMS – Part A 1-13 T-61.3010 DSP 2009 16/170 PROBLEMS – Part A 1-13
e) The result depends on which number representation is chosen. In case of multi-byte 8. Problem: Roots of a polynomial.
data types numbers can be saved in big-endian or little-endian manner. DSPs are
divided to fixed-point and floating-point processors (IEEE 754 , sign bit, exponent a) Compute roots of H(z) = z 2 + 2z + 2.
and mantissa fields). Least significant bit (LSB) is normally the last bit, most b) Compute roots of H(z) = 1 + 16z −4 .
significant bit (MSB) leftmost. Negative numbers and fractions has to be considered, c) Compute long division (4z 4 − 8z 3 + 3z 2 − 4z + 6)/(2z − 3).
too. (Mitra 2Ed Sec. 8.4 / 3Ed Sec. 11.8 ) deals with all aspects of the number
representation.
When both negative and positive b-bit fraction values are needed, 1001011 is con- [L0134] Solution: Roots of a polynomial p(x) can be found from p(x) = 0. Nth order
sidered to have a sign bit first, and then fraction bits, like s∆ a−1 a−2 . . . a−b . Table 4 p(x) has N roots, see Problem 8(b).
contains some possible results with values b = 6 and s = 1, see also (Mitra 2Ed Table √ √
Roots of a complex z = r ej(θ+2πk) are N z = | N r| · ej(2π k/N +θ/N ) , where k = 0 . . . N − 1.
8.1, p. 557 / 3Ed Table 11.1, p. 638 ).
In this course roots of transfer function H(z) provide information on the behaviour of the
non-negative fixed-point 1001011 1 · 64 + 1 · 8 + 1 · 2 + 1 · 1 = 75 filter. The order of the rational polynomial H(z) = B(z)/A(z) is the maximum of the
P orders of B(z) and A(z).
sign-magnitude 1∆ 001011 (−2s + 1) bi=1 a−i 2−i = −11/64 ≈ −0.1719
P
ones’ complement 1∆ 001011 −s · (1 − 2−b ) + bi=1 a−i 2−i = −52/64 ≈ −0.8125 a) The order of
P √ H(z) is 2. Using the equation for solving the second-order polynomials
two’s complement 1∆ 001011 −s + bi=1 a−i 2−i = −53/64 ≈ −0.8281 z = (−b ± b2 − 4ac)/(2a), the roots are z1 = −1 + j and z2 = −1 − j. This can be
offset binary 1∆ 001011 +11/64 ≈ +0.1719 assured by multiplication (z − z1 )(z − z2 ) = z 2 − (z1 + z2 )z + z1 z2 = z 2 + 2z + 2.
Table 4: Problem 7: Examples on binary number representations with values b = 6 and s = 1. b) The order of H(z) is 4, and we have 4 roots. Now, when setting H(z) = 1+16z −4 √ = 0,
the equation can be multiplied by z 4 on both sides. Hence,
√ z 4 +16
√ = 0 and z = 4 −16.
4 j(π+2πk) j(2π k/N +θ/N )
f) In some programming languages a prefix 0x is reserved for hexadecimals, 16-base Because −16 = 2 · e , we get four roots using z = | r| · e
N N
.
numbers, where {A, B, C, D, E, F} = {(10)10 , (11)10 , . . . , (15)10 }. Now, 0x01EF3A Roots: zk = 2 ej(2πk/4+π/4) , with k = 0 . . . 3. Again, z04 = (2ejπ/4 )4 = 24 ej4π/4 =
is 0 · 165 + 1 · 164 + 14 · 163 + 15 · 162 + 3 · 16 + 10 = 126778. If considering RGB colors, jπ
16e = −16, and similarly other zk result to −16. In Figure 8 all four roots are
then each component has two hexas, 01.EF.3A, meaning values red = 1 (1/255), plotted with circles.
green 239, and blue 58. A similar approach for IP addresses (four 2-hexas).
2
g) See also “circular shift of a sequence” (Mitra 2Ed Sec. 3.4.1, p. 140 / 3Ed Sec. z1 = 1.41 + 1.41j
5.4.1, p. 244 ). In the modulo operation, (m mod N), or, < m >N , we want to 1 r = 2, θ = π/4
compute the remainder (or residue) r when m is divided by N, that is, m = r + kN, 1 1
so that the remainder is always in the range 0 . . . N − 1. Now for < −5 >3 we have 0
the equation with m = −5 and N = 3 as −5 = r + k · 3. With k = −2 r becomes in
−1
the range 0 . . . 2 and it is r = 1. Hence, < −5 >3 = 1. In case of a periodic sequence
(N = 3) this yields . . . = x[−5] = x[−2] = x[1] = x[4] = x[7] = . . . −2
A circular buffer is implemented in the instruction sets of many DSPs. Assume that −2 0 2
there is a buffer of size 1024 bytes, with addresses 0x0000 to 0x03F F in hexadecimals.
New 8-bit (byte) samples are read into a buffer where an address counter (pointer) Figure 8: Problem 8(b): four roots of fourth order H(z) = 1 + 16z −4 .
is increased by one each time. When the counter has the value 0x03F F , the next
value is < 0x0400 >0x0400 = 0x0000. In other words, the oldest sample is replaced by c) Division operation can be applied to polynomials just as for normal numbers. Polyno-
the newest. See Figure 7 for figures of linear and circular buffers. mial product and division have a very close connection to the convolution operation.
0x03FF 0x0000 For example, in Matlab there is the same function conv for the both operations.
0x03FE 0x0001
0x0000 0x03FD 0x0002 2z 3 − z 2 −2
0x0001 2z − 3 4z 4 − 8z 3 + 3z 2 − 4z + 6
0x0002 − 4z 4 + 6z 3
− 2z 3 + 3z 2
2z 3 − 3z 2
0x03FD
− 4z + 6
0x03FE
4z − 6
0x03FF
0
Figure 7: Problem 7: linear and circular buffer with addresses from 0x0000 to 0x03FF.
T-61.3010 DSP 2009 17/170 PROBLEMS – Part A 1-13 T-61.3010 DSP 2009 18/170 PROBLEMS – Part A 1-13
9. Problem: Examine a complex-valued function (z ∈ C) 10. Problem: Partial fraction decomposition is used to divide a high-order rational ex-
1 + 0.5z −1 + 0.06z −2 pression into a sum of low-order rational expressions. For example, 1/(x2 + 3x + 2) =
H(z) = 1/(x + 1) − 1/(x + 2).
1 − 1.4z −1 + 0.48z −2
a) Multiply both sides by z 2 . a) Decompose f (x) = 1/(x2 + 1) into sum of first-order expressions.
b) Solve z 2 + 0.5z + 0.06 = 0. b) Decompose H(z) = (0.4 − 0.2z −1 )/(1 − 0.1z −1 − 0.06z −2 ) into sum of first-order
c) Solve z 2 − 1.4z + 0.48 = 0. expressions.
d) H(z) can be written with five values complex values K, z1 , z2 , p1 , and p2
(z − z1 ) · (z − z2 ) [L0135] Solution: Partial fraction decomposition (or expansion) is used to divide a
H(z) = K ·
(z − p1 ) · (z − p2 ) high-order rational expression into a sum of low-order rational expressions.
What are the five values? Decomposition is quite trivial if there are not multiple roots neither is the order of nu-
e) What are the coefficients of H(z). What are the roots of H(z)? What is the order of merator polynomial as big or bigger as the order of the denominator polynomial. Decom-
the numerator polynomial of H(z)? What is the order of the denominator polynomial position requires taking roots of a polynomial, so it is possible to derive by hands only in
of H(z)? some trivial cases, e.g., 1/(x2 + 3x + 2) = 1/(x + 1) − 1/(x + 2). For more complicated
cases, see (Mitra 2Ed Sec. 3.9 / 3Ed Sec. 6.4.3 ), or any other math reference. The
command in Matlab is residuez.
[L0139] Solution: In this course complex-valued functions are widely used. In case of the
transfer function H(z) both z and H(z) are complex-valued. A typical form of a transfer In this course partial fractions are used when finding an explicit form of the impulse
function of a FIR filter is response h[n] from the transfer function H(z). In the list of Fourier-transform pairs there
are only inverse transforms for the first order expressions. So, if the transfer function is
H(z) = b0 + b1 z −1 + b2 z −2 + . . . + bM z −M of second-order or higher, it has to be converted to a sum of first-order expressions by
and that of an IIR filter is partial fraction decomposition (expansion).
b0 + b1 z −1 + b2 z −2 + . . . + bM z −M Rules of thumb, (1) compute roots of the denominator polynomial, (2) write down the sum
H(z) =
1 + a1 z −1 + a2 z −2 + . . . + aN z −N of first-order rational polynomials, (3) compute the unknown constants (equation pairs).
a) Multiplication H(z) · (z 2 /z 2 ) does not change the values of H(z), but it is more Note that the decomposition in not unique, but there are several different expressions
convenient to work with positive exponentials: which lead to the same result.
z 2 + 0.5z + 0.06 a) Find the roots of the denominator: x2 + 1 = 0 ⇒ x1 = −j, x2 = j. Roots can be
H(z) =
z 2 − 1.4z + 0.48 complex, too! Hence,
b) Using the formula for second order polynomials az 2 + bz + c = 0
√ A B A B
−b ± b2 − 4ac f (x) = + = +
z= x − x1 x − x2 x+j x−j
2a
we get easily the roots z1 = −0.3, z2 = −0.2. In Matlab you can write P = [1 0.5 A(x − j) + B(x + j) x(A + B) + j(−A + B)
= =
0.06]; roots(P). x2 + jx − jx + 1 x2 + 1
c) Similarly, the roots p1 = 0.8, p2 = 0.6. ( (
A+B =0 A = 0.5j
d) Using the notation from (b) and (c), ⇒ ⇒
−A + B = −j B = −0.5j
(z + 0.3) · (z + 0.2)
H(z) = K · Finally,
(z − 0.8) · (z − 0.6) 0.5j 0.5j
z 2 + 0.5z + 0.06 f (x) = −
= K· 2 x+j x−j
z − 1.4z + 0.48
b) In this course z −1 corresponds a unit delay in time-domain. The numerator poly-
we can scale H(z) correctly by choosing K = 1.
nomial can divided and z −1 terms can be taken to front, and the partial fraction is
e) In this case the coefficients were {1, 0.5, 0.06} in numerator polynomial (upper part), done only once for P (z), whose numerator polynomial is plain 1,
and {1, −1.4, 0.48} in denominator polynomial (bottom part).
Roots were computed in (b) and (c). In DSP we call the roots of numerator poly- 0.4 − 0.2z −1
H(z) =
nomial as “zeros”. The roots of denominator polynomial (bottom part) are “poles”. 1 − 0.1z −1 − 0.06z −2
As seen in (d) the same function H(z) can be expressed either using coefficients 1 1
= 0.4 · −1 −2
−0.2z −1 · −1 −2
or roots (and scaling factor). In the filter analysis the positions of roots give some |1 − 0.1z {z− 0.06z } |1 − 0.1z {z− 0.06z }
information on the nature of the filter. More about this in Problem 54. P (z) P (z)
T-61.3010 DSP 2009 19/170 PROBLEMS – Part A 1-13 T-61.3010 DSP 2009 20/170 PROBLEMS – Part A 1-13
The denominator of P (z) is set to zero and multiplied by z 2 : z 2 − 0.1z − 0.06 = 0. 11. Problem: Sum of geometric series.
The roots are z1 = 0.3 and z2 = −0.2. P
a) What is sum of series S = ∞ k
k=0 (0.5) .
A B P
P (z) = + b) S = ∞ k=10 (−0.6) k−2
.
1 − 0.3z −1 1 + 0.2z −1 P
c) S = ∞ k=2 (0.8
k−2
· e−jωk ).
A + 0.2Az −1 + B − 0.3Bz −1
=
1 − 0.1z −1 − 0.06z −2
[L0136] Solution: Sum of geometric series is applied in Fourier and P z-transforms. When
1
= | as stated above the ratio q in geometric series is |q| < 1, the sum of series converges to ∞ k
k=0 q = 1/(1−q),
1 − 0.1z −1 − 0.06z −2 P
and correspondingly N k=0 q k
= (1 − q N +1
)/(1 − q).
Now we get a pair of equations from comparing numerator polynomials Other known series are {1/n} and {1/n2 }. Notice that the sum of the former does not
( (
A+B =1 A = 0.6 converge, while the latter does.
⇒
0.2A − 0.3B = 0 B = 0.4
a) Directly from the formula with q = 0.5, S = 1/(1 − 0.5) = 2.
and finally,
b) Open Σ expression if it seems to be difficult.
0.6 0.4 0.6 0.4
H(z) = 0.4 · + − 0.2z −1 · + ∞
X
1 − 0.3z −1 1 + 0.2z −1 1 − 0.3z −1 1 + 0.2z −1 S = (−0.6)k−2 = (−0.6)8 + (−0.6)9 + (−0.6)10 + . . .
k=10
From this expression of H(z) we can easily (inverse) transform H(z) → h[n], see, ∞
X
e.g., Problem 55(f). = (−0.6)k
k=8
X∞ 7
X
= (−0.6)k − (−0.6)k
k=0 k=0
= 1/(1 + 0.6) − (1 − (−0.6)8 )/(1 + 0.6) = (−0.6)8 /1.6 ≈ 0.0105
∞
X
S = (0.8k−2 · e−jωk ) |k = m + 2
k=2
X∞
= (0.8m · e−jωm · e−j2ω )
m=0
∞
X
= e−j2ω · (0.8e−jω )m
m=0
1
= e−j2ω ·
1 − 0.8e−jω
The term e−j2ω can be seen as a time shift (delay in this case) of two units.
T-61.3010 DSP 2009 21/170 PROBLEMS – Part A 1-13 T-61.3010 DSP 2009 22/170 PROBLEMS – Part A 1-13
12. Problem: Integral transforms, like Fourier transforms, play an important role in signal 13. Problem: Using notation WN = e−j2π/N and matrix
processing. Compute integrals 0
W4 W40 W40 W40
1 1 1 1
R4 W40 W41 W42 W43 1 W41 W42 W43
a) X(Ω) = 0 e−jΩt dt D4 = 0
=
1
R W4 W42 W44 W46 1 W42 W44 W46
b) x[n] = 2π 2π X(ejω ) ejωn dω, where
W40 W43 W46 W49 1 W43 W46 W49
X(ejω ) = 2πδ(ω + 0.2π) − jπδ(ω + 0.1π) + jπδ(ω − 0.1π) + 2πδ(ω − 0.2π) T
compute X = D4 x, when x = 2 3 5 −1
[L0137] Solution: A general integral transform is defined by
Z b [L0163] Solution: A common notation WN is defined as WN = e−j2π/N . We see that
p
F (ω) = f (t)K(ω, t)dt |WN | = |e−j2π/N | = | cos(2π/N) − j sin(2π/N)| = cos(2π/N)2 + sin(2π/N)2 = 1
a
where K(ω, t) is an integral kernel of the transform, see e.g. (Mitra 2Ed Sec. - / 3Ed Sec. That is, the points WNk are lying uniformly spaced clockwise on the unit circle. WN is
(2N +3)
5.1 ) or http://mathworld.wolfram.com/IntegralTransform.html. See Problem 17 periodic with every N, e.g., WN = e−j2π·(2N +3)/N = e−j4π · e−j6π/N = e−j6π/N = WN3 .
for discussion on transforms used in DSP. Note that WN0 = 1. An example with N = 16 is given in Figure 9.
a) Now x(t) can be considered as a rectangular signal, and its Fourier transform is a 12
W11 W16 W13
16 16
sinc-function. W10
16
W14
16
Z 4 .4 W916 W15
16
X(Ω) = e−jΩt dt = (1/(−jΩ))e−jΩt = (1/(−jΩ))(e−j4Ω − 1) W816 W016
0
0 7 1
W16 W16
= (1/(−jΩ))(−e−j2Ω )(ej2Ω − e−j2Ω ) = (1/(−jΩ))(−e−j2Ω )(2j sin(2Ω))
W616 W216
W516 W4 W316
= 4e−j2Ω (sin(2Ω)/(2Ω)) = 4e−j2Ω sinc(2Ω/π) 16
Now we have computed continuous-time Fourier transform (CTFT). It is often writ- Figure 9: Problem 13: Uniformly spaced {WN } = {WN0 , WN1 , . . . , WN15 } with N = 16.
ten as X(jΩ) instead of X(Ω) in DSP.
b) Now we are computing inverse discrete-time Fourier transform (IDTFT), (Mitra 2Ed
When N = 4, the angle between each point is 2π/4 = π/2 (equivalent to 90◦ ). We can
Eq. 3.7 / 3Ed Eq. 3.16 ). The spectrum X(ejω ) consists of four peaks (only!) at
compute values W40 = 1, W41 = e−j2π/4 = e−jπ/2 = −j, W42 = −1, and W43 = j. Using the
ω0 = {−0.2π, −0.1π, 0.1π, 0.2π}, which are written with Dirac’s delta function
periodic properties of WNk the square matrix D4 is
δ(ω − ω0 ) and computed as
Z 1 1 1 1
k · δ(ω − ω0 ) · f (ω) dω = k · f (ω0 ) 1 −j −1 j
2π D4 =
1 −1 1 −1
when ω = ω0 , and zero elsewhere. Integral is taken from any period of 2π, and here 1 j −1 −j
we choose −π . . . π. Euler’s formula ( ejθ +e−jθ = 2 cos(θ) and ejθ −e−jθ = 2j sin(θ)),
see Problem 2, is applied and the result is a discrete sequence x[n] of numbers. Note Size of matrix D4 is 4 rows and 4 columns (4 × 4), and that of column vector x is (4 × 1).
that each peak pair at −ω0 and ω make up a sinusoidal, if the phases are correctly In the matrix product X = D4 x dimensions must agree: (4 × 4)(4 × 1), and the final size
chosen. of X is (4 × 1).
Z
1 1 1 1 1 2 1 · 2 + 1 · 3 + 1 · 5 + 1 · (−1) 9
x[n] = X(ejω ) ejωn dω, where 1 −j −1 j 3 1 · 2 − j · 3 − 1 · 5 + j · (−1) −3 − 4j
2π 2π X = D4 x = = =
jω
X(e ) = 2πδ(ω + 0.2π) − jπδ(ω + 0.1π) + jπδ(ω − 0.1π) + 2πδ(ω − 0.2π) 1 −1 1 −1 5 1 · 2 − 1 · 3 + 1 · 5 − 1 · (−1) 5
Z Z π 1 j −1 −j −1 1 · 2 + j · 3 − 1 · 5 − j · (−1) −3 + 4j
1 π
= · 2δ(ω − 0.2π) · ejωn dω + jδ(ω − 0.1π) · ejωn dω − We have computed here discrete Fourier transform (DFT) for a real sequence {2, 3, 5, −1}.
2 −π
Z π Z π −π The result, here {9, −3 − 4j, 5, −3 + 4j}, is generally complex-valued. There are several
jδ(ω + 0.1π) · ejωn dω + 2δ(ω + 0.2π) · ejωn dω symmetric properties of DFT that are discussed later.
−π −π
1 The matrix D∗4 (DH
4 , Hermitian) is transpose of D4 with complex-conjugate values:
= · 2ej0.2πn + jej0.1πn − je−j0.1πn + 2e−j0.2π
2 1 1 1 1
1 1 j −1 −j
= · 2[ej0.2πn + e−j0.2π ] + j[ej0.1πn − e−j0.1πn ] D∗4 =
2 1 −1 1 −1
= 2 cos(0.2πn) − sin(0.1πn) ∈R 1 −j −1 j
T-61.3010 DSP 2009 23/170 PROBLEMS – Part B 14-18 T-61.3010 DSP 2009 24/170 PROBLEMS – Part B 14-18
14. Problem: Consider an analog signal x(t) = π · cos(4πt). Plot the analog signal, the 15. Problem: There is a sketch of the magnitude response of a typical lowpass filter in
discrete-time signal sampled with 10 Hz, and the digital signal with accuracy to integer Figure 11. Sketch some other examples of the magnitude (amplitude) responses of the
numbers. following filters in the frequency domain: (a) highpass filter, (b) bandpass filter, (c)
bandstop filter, (d) notch filter, (e) multiband filter, and (f) comb filter.
[L0280] Solution: Analog signal : both t and x(t) ∈ R. For example, you can measure
1 |H(e jω)|
the outside temperature at any time with continuous scale.
Discrete-time signal (sequence): signal x[n] may get any values at certain time moments,
x[n] ∈ R, n ∈ Z. Often explained as a sampled version of analog signal. 0 ω
Digital signal (sequence): signal x[n] is discrete also with amplitude values, n, x[n] ∈ Z. 0 π
A pure sinusoidal is x(t) = A · cos(Ωt + θ) and now we have x(t) = π · cos(4πt). The Figure 11: Problem 15: Magnitude (amplitude) response of a typical lowpass filter.
angular frequency is Ω = 4π rad/s and the frequency f = 2 Hz while Ω = 2πf . The
period of the sinusoidal signal is T = 1/f = 0.5 second.
The sampling frequency is fs = 10 Hz, i.e., samples are taken every Ts = 0.1 seconds:
[L0288] Solution: In this course we are dealing with digital LTI filter s which are frequency-
t ← nTs = n/fs . This gives a discrete-time sequence
sensitive filters, in other words, you can amplify or attenuate sinusoidal components of the
x[n] = π · cos(0.4πn) input signal. Furthermore, LTI constructions are key elements in, e.g., adaptive filters.
where the normalized angular frequency is ω = 0.4π rad/sample. Typical LTI filters are lowpass, highpass, bandpass, and bandstop. A word lowpass means
that low frequency components of the input signal are left or even amplified (boosted) by
Some numeric values are given below in a table, and the plots in Figure 10, where in (a) the filter whereas high frequencies are attenuated (suppressed). Sketches for these basic
t runs from 0 to 1.25 seconds, and in (b) and (c) n correspondingly from 0 to 12. filter types are given in Figure 12.
t n (a) x(t) (b) x[n] (c) x[n] |H(e jω)| |H(e jω)| |H(e jω)| |H(e jω)|
1 1 1 1
0 0 π · cos(0) = π π Int{π} = 3
0 < t < 0.1 ∄ cos(4πt) ∄ ∄
0 ω 0 ω 0 ω 0 ω
0.1 1 π · cos(0.4π) ≈ 0.9708 ≈ 0.9708 Int{0.9708} = 1
0 π 0 π 0 π 0 π
0.5 5 π · cos(2π) = π π Int{π} = 3
Figure 12: Problem 15: Plots of some magnitude (amplitude) responses of filters. (a) lowpass
x(t) = π ⋅ cos(4π t) x[n] = π ⋅ cos(0.4π n) x[n] = ROUND{ π ⋅ cos(0.4π n) } (LP), (b) highpass (HP), (c) bandpass (BP), and (d) bandstop (BS) filter.
4 4 4
x(0.5)=π x[0]=π x[5]=π x[0]=3 x[5]=3
2 2 2
x[1]=cos(0.4π) x[1]=1 There are a few things to notice here. The magnitude response |H(ejω )| ∈ R, or often
0 0 0 also amplitude response, is the absolute value of the frequency response H(ejω ) ∈ C
(generally), which is a function of (normalized angular) frequency ω ∈ R.
−2 −2 −2
Both the x- and y-axis can be either in linear or logarithmic (decibel) scale depending
x[2] x[3]=−3
−4
on the application. The x-axis of a magnitude response of a digital LTI filter is normally
−4 −4
0 0.5 1 0 5 10 0 5 10 scaled to the range 0 . . . π which is equivalent to 0 . . . fT /2 where fT is the sampling
t n n
frequency. The maximum of the magnitude response is often scaled to unity, that is,
Figure 10: Problem 14: (a) analog signal, (b) discrete-time signal, (c) digital signal. the maximum in y-axis is either 1 (linear) or 0 decibels (logarithmic). See more spectra
examples from Matlab in Problem 16.
Discrete-time or digital signal is often called a sequence instead of signal. For instance, in An example of an ideal filter (bandstop in this case) is given in Figure 12(d)
(b) we have a sequence {π, π · cos(0.4π), π · cos(0.8π), π · cos(0.8π), π · cos(0.4π), π, . . .} (
and in (c) a sequence {3, 1, −3, −3, 1, 3, . . .}. Note that π is an irrational number 1, 0 ≤ ω < ω1 , ω2 ≤ ω < π
H(ejω ) =
which cannot be expressed accurately with finite number of bits. 0, ω 1 ≤ ω < ω2
In practice, A/D (analog to digital) converter discretizes the analog signal into digital
where ω1 and ω2 are cut-off frequencies. Ideal filters are important in theorical derivations
signal with a certain accuracy. For instance, in audio recordings (CD quality) the sampling
but they may give poor results in practice (ringing effect with audio or images). In practice
frequency is 44100 Hz (44100 samples each second) and the each data sample is expressed
we allow some ripple (deviation) both in the stopband and passband, see Figure 12(a,b,c).
with 16 bits, i.e., having 216 = 65536 discrete levels between (appr.) −1 . . . + 1.
Smooth transitions from stopband to passband make the filter order lower which is often
Definitions of signal types (analog, digital, etc.) may vary from book to book. desirable.
T-61.3010 DSP 2009 25/170 PROBLEMS – Part B 14-18 T-61.3010 DSP 2009 26/170 PROBLEMS – Part B 14-18
There are some other LTI filters, too. The spectrum of a notch filter is one (or almost) 16. Problem: Explain the spectra in Figure 16(a) and (b). What does a spectrum of a signal
for all frequencies expect ω0 , which is filtered out, see Figure 13(a). It can be achieved in Figure 16(c) look like? How about its spectrogram?
with a simple IIR filter by setting a pole-zero pair at a cut-off frequency, see Problem 54.
0.5
A comb filter is periodic and therefore it is often used to remove harmonic components,
see Figure 13(b). For example, distortion of multiples of 50 Hz (AC supply) is common. 0
|X| |X|
x[n]
A multiband filter , see Figure 13(c), can be utilized in an equalizer to boost treble (discant)
−0.5
or bass tones. An example of a 10-channel software equalizer can be seen in Figure 14.
The user can adjust ten different sliders from which the amplitude response curve is f f
−1
formed. In the right-most figure all high frequencies are attenuated. 0 0.01 0.02 0.03 0.04
−f_h f_h f_s/2 0 3 6 kHz time
|H(e jω)| |H(e jω)| |H(e jω)| Figure 16: Problem 16: (a) two-sided triangular spectrum, frequency in x-axis, (b) one-sided
1 1 1
line spectrum, frequency in x-axis, (c) signal waveform, time in x-axis.
0 ω 0 ω 0 ω
0 π 0 π 0 π
Figure 13: Problem 15: Plots of some magnitude (amplitude) response of filters. (a) notch [L0290] Solution: In Problem 15 we saw several types of filters depicted in frequency-
filter, (b) comb filter, and (c) multiband filter. domain. Now we are considering signals and their spectra.
The triangular spectrum in Figure 16(a) typically depicts a spectrum X of any kind of
signal, or, we are not interested how the signal looks like in time-domain. However, one
should find out from the context, if we are talking about spectrum X(jΩ) of an analog
signal after continuous-time Fourier transform (CTFT), X(ejω ) of a discrete sequence
after discrete-time Fourier transform (DTFT), or X[k] of a discrete sequence after discrete
Fourier transform (DFT). X[k] can be thought as a sampled version of X(ejω ).
In Figure 16(a) we have a two-sided spectrum which is band limited between −fh and
Figure 14: Problem 15: Example of an equalizer in a software (WinAmp). fh . It is symmetric around y-axis, that is, the corresponding signal in time-domain is
real-valued (like all signals found in nature), see Problem 41. The highest frequency
Remark. All magnitude responses in Figure 12 and 13 are sketched by hand. They
component is fh which is less than half of the sampling frequency fs /2.
y-axis is linear and scaled in range 0 . . . 1. In Figure 15 there are figures of a lowpass
filter plotted in Matlab. Figure 15(a) is from command freqz(B, A). The top subfigure The line spectrum in Figure 16(b) contains two peaks at 2 kHz and 4 kHz. If the signal is
is the magnitude response, where x-axis linear [0 . . . 1] × π, and y-axis logarithmic. The real-valued, as it is often by default, the one-sided spectrum is enough because its left side
bottom subfigure contains the phase response. Figure 15(b) is from commands [H, w] is a mirror image of the right side. One could draw the left side of the spectrum by adding
= freqz(B, A); plot(w, abs(H)). Both x-axis and y-axis are linear, x-axis is scaled 2 units high peak at -2 kHz and 1 unit high peak at -4 kHz. The signal x[n] or x(t) can be
to 0 . . . π. Figure 15(c) is from commands [H, f] = freqz(B, A, [], f_s); plot(f, quite easily plotted from the spectrum, e.g., x(t) = 2 cos(2π · 2000 · t) + cos(2π · 4000 · t).
20*log10(abs(H))). Now x-axis is linear but y-axis are logarithmic, and x-axis is scaled In Figure 16(c) there is a signal which contains one slowly variating signal, a quickly
to 0 . . . 22050, that is, half of the sampling frequency when fs = 44100 Hz (CD quality). changing part at 0.03 . . . 0.04 seconds, and small amount of other noise. We can imagine
Note that magnitude response curves look like the same in (a) top subfigure and (c), while that we will have a line spectrum with two peaks: one strong peak at very low frequency
in (b) the same curve is in linear scale. The ripple of 1 decibel (dB) in passband corre- and the other, smaller peak at a frequency that can be estimated from the figure. We
sponds oscillation between 0.891 . . . 1 in linear y-axis. Similarly, the stopband attenuation can read that there are 11 oscillations in 0.03 . . . 0.04 seconds, that is, 1100 oscillations a
of 40 dB corresponds 0.01. second (1100 Hz).
Figure 16(c) is plotted from Matlab. In this case we have a discrete sequence x[n] of 1000
1
numbers in a computer, from which we can compute another discrete sequence X[k] by
Magnitude (dB)
0 0
−20
0.8 DFT (fft). Using all 1000 samples we get the absolute value of discrete Fourier transform
−40
−60 0.6 −20 in Figure 17(a). Two peaks close to 0 and 1100 Hz can be found.
0 0.2 0.4 0.6 0.8 1
Normalized Frequency (×π rad/sample) 0.4 −40 There is a large number of spectrum estimation methods. Figure 17(b) shows the result
Phase (degrees)
−200 0.2 of Welch approximation using only 256 samples (pwelch). It also detects a peak at 1 kHz.
−60
−400
See discussion on spectrum spreading in DFT in Remark of Problem 37.
0
0 1 2 3 0 0.5 1 1.5 2
0 0.2 0.4 0.6 0.8
Normalized Frequency (×π rad/sample)
1
normalized frequency ω frequency (Hz) x 10
4 In both figures we clearly see that there is energy at zero frequency (or low frequency)
Figure 15: Problem 15: Magnitude responses of a LP filter. and at about 1 kHz which reflects the high-frequency component starting at 0.03 seconds.
However, the time information, when the high-frequency component occurs, cannot be
seen from the spectrum. Therefore we can analyze the signal in time-frequency-domain.
T-61.3010 DSP 2009 27/170 PROBLEMS – Part B 14-18 T-61.3010 DSP 2009 28/170 PROBLEMS – Part B 14-18
The spectrogram is a short-time Fourier transform (STFT) method, (Mitra 2Ed Sec. 17. Problem: Categorize Fourier-transforms for aperiodic/periodic analog/digital signals.
11.3.1 / 3Ed Sec. 15.3.1 ). It is nothing but computing spectra in small time windows.
In a spectrogram, see Figure 17(c), time is in x-axis and frequency in y-axis, and the [L0291] Solution: Integral transforms are important and essential tools in signal pro-
gray level in z-axis shows how strong a certain frequency (sinusoidal) is at a certain time cessing. With Fourier-transforms you can change between time-domain and frequency-
moment. It can be seen that the component at 1 kHz is present only in the end. domain, see Problem 18. In a high level several Fourier transforms can be catego-
jω Spectrogram
rized into four classes according to signal type (analog/digital) and periodicity (peri-
Fourier−transform |X(e )|, N=1000 0
Power Spectral Density Estimate via Welch odic/aperiodic), see Table 5 from (Huttunen: Signaalinkäsittelyn menetelmät, p. 33 ) and
Power/frequency (dB/Hz)
0
Power/frequency (dB/Hz)
0 10000
−20 (Smith: DSPguide, Ch. 8, p. 145 ). In addition, more general z-transform for digital,
Frequency (Hz)
When taking Fourier transform of the signal in Figure 16(c) we get the spectrum in Fourier transform. Continuous-time and aperiodic signal x(t) is transformed. The re-
Figure 17(a). However, if we see first the spectrum, we cannot exactly say, how the signal sult X(jΩ) is continuous-frequency and aperiodic. Mitra’s book uses the term continuous-
looks like. For example, even if the spectrum estimation in Figure 18(a) is very similar time Fourier transform (CTFT), R ∞(Mitra 2Ed p. – / 3Ed p. 118 R).∞The analysis and syn-
1
to that in Figure 17(a), the original signal is very different, see Figure 18(b). thesis equations are X(jΩ) = −∞ x(t)e−jΩt dt, and x(t) = 2π −∞
X(jΩ)ejΩt dΩ. Note
Note that the conversion x[n] ↔ X(ejω ) via Fourier transform is unique (Fourier is bi- that t and Ω ∈ R.
jection function), but we normally examine only absolute value |X(ejω )|, which can be Discrete-time Fourier transform. Discrete-time and aperiodic signal x[n] is trans-
achieved by several (infinite number) x[n]. formed. The result X(ejω ) is continuous-frequency and periodic with 2π. See more about
discrete-time Fourier transform (DTFT)P in (Mitra 2Ed p. 117 / 3Ed p. 122R π ). The analy-
sis and synthesis equations are X(ejω ) = ∞ −jωn 1
X(ejω )ejωn dω.
Power Spectral Density Estimate via Welch
−30
−0.2
Fourier series. Continuous-time and periodic signal x(t) is transformed. The result
are the Fourier series coefficients ak with a fundamental frequency Ω0 . Coefficients are
x[n]
−40
−0.4
−50
−0.6
therefore
R discrete-frequency andP aperiodic. The analysis and synthesis equations are ak =
1
x(t) e−jkΩ0 t dt, and x(t) = ∞ jkΩ0 t
. Note that t ∈ R and k ∈ Z.
−60
18. Problem: Consider a signal x[n] shown in Figure 19. Assume that there exists a lowpass from which the sequence y[n] is plotted in right-top. The output spectrum of HP filter is
and a highpass filter with a cut-off at 1 kHz. Sketch the outputs of the both filters. in Figure 22, respectively.
0.5 1 1
x[n] 0.06 y[n]
0 0.04
0 0
0.02
x[n]
0
−0.5 −1 −0.02 −1
0 0.030.04 0 0 0.030.04
time index time
−1
0 0.01 0.02 0.03 0.04
time FOURIER FOURIER FOURIER
Figure 19: Problem 18: Input signal x[n].
X(ej ω) / Welch H(ej ω) Y(ej ω) / Welch
0 0 0
−20 −20 −20
[L0289] Solution: First, some sketches in frequency domain are given as results to this −40 −40 −40
problem. Second, figures from Matlab with some real (but here ungiven) signals and −60 −60 −60
filter constructions are plotted. Third, the overall picture of the time-frequency-domain
analysis is given in the end of this problem (Remark). 1.1 5 10 1.1 5 10 1.1 5 10
frequency (kHz) frequency (kHz) frequency (kHz)
The signal in Figure 19 was already analyzed in Problem 16. It contains slowly changing
part (low frequency) and quickly changing part (high frequency, approx. 1100 Hz, only Figure 21: Problem 18: Lowpass filtering. Top row: input signal x[n], impulse response h[n] of
present at 0.03 . . . 0.04 s). Therefore we can sketch a spectrum X(ejω ) of the signal in left LP filter, output signal y[n]. Bottom row: input spectrum X(ejω ), transfer function H(ejω ) of
in Figure 20. LP filter, output spectrum Y (ejω ).
Filtering in frequency-domain is purely a product of the input spectrum X(ejω ) and the
filter H(ejω ). Now the cut-off is at 1 kHz and the magnitude response is sketched in
middle in Figure 20. y[n]
1 1 0.2
The output spectrum Y (ejω ) of a lowpass filter (LP) is sketched in right in Figure 20.
x[n]
There is a peak at very low frequency meaning that only the slowly changing part of 0.5
0 0
the signal is left. Filtering with a highpass filter (HP) gives a peak at 1.1 kHz, which in h[n]
time-domain corresponds quickly changing part of signal at 0.03 seconds.
−1 0 −0.2
|X| |H| |Y| 0 0.030.04 0 0 0.030.04
time index time
T-61.3010 DSP 2009 31/170 PROBLEMS – Part B 14-18 T-61.3010 DSP 2009 32/170 PROBLEMS – Part C 19-35
Remark. This course deals with SISO systems, that is, a system with a single input and 19. Problem: Sketch the following sequences around the origin
a single output. The systems are mainly linear and time-invariant (LTI) digital ones. The
analysis of signals and systems requires Fourier transform (or equivalent) to change from a) x1 [n] = sin(0.1πn)
time-domain to frequency-domain and back. b) x2 [n] = sin(2πn)
The big picture of the analysis can be seen in Figure 23. There is an input x[n], a system c) x3 [n] = δ[n − 1] + δ[n] + 2δ[n + 1]
h[n] and an output y[n] in time-domain, or X(z), H(z), and Y (z) in frequency-domain,
d) x4 [n] = δ[−1] + δ[0] + 2δ[1]
respectively. The system is called a filter.
e) x5 [n] = µ[n] − µ[n − 4]
DOMAIN
FREQUENCY− TIME−
δ[n] = µ[n] =
0, when n 6= 0 0, when n < 0
Y(z) =
X(z) H(z) H(z) . X(z)
A sequence or a discrete-time signal x[n] can be shown with individual values x[k] and
impulse function as
X∞
x[n] = x[k] · δ[n − k]
Figure 23: Problem 18: Filtering in time-domain and frequency-domain. Time-domain: Input k=−∞
signal x[n], impulse response h[n], output y[n] = h[n]⊛x[n] by convolution. Frequency-domain: For example, if xe [0] = 2, xe [3] = −4, and xe [n] = 0 elsewhere, we get
Input spectrum X(z), transfer function H(z), output Y (z) = H(z) · X(z) by multiplication.
Fourier or z-transform (etc.) are needed in the analysis. xe [n] = xe [0] · δ[n − 0] + xe [3] · δ[n − 3] = 2δ[n] − 4δ[n − 3]
Signal is a function of independent variables such as time (speech) or position (images) The discrete-time signal is purely a sequence of numbers. There are equivalent ways to
(Mitra 2Ed Sec. 1.0, p. 1 / 3Ed Sec. 1.0, p. 1 ). It nature signals carry information, write a sequence, e.g. in (c), x3 [n] = 2δ[n + 1] + δ[n] + δ[n − 1], or x3 [n] = {2, 1, 1}, where
e.g., a speech signal is a longitudinal waveform transporting energy from speaker’s speech non-zero values are listed and the underlined position is at n = 0. Non-zero values can
organ to listener’s hearing. Signals have certain properties: they can be analog (x(t)) or be also written explicitly, e.g., x3 [−1] = 2, x3 [0] = 1, x3 [1] = 1, and x3 [k] = 0 elsewhere.
digital (x[n]), periodic or aperiodic. In this course digital signals (sequences) are plain There are different ways to draw discrete-time signals. Here we use “pins” or “stems”,
sequences of numbers which can be processed and saved in a computer. There exist which emphasizes that the sequence is discrete-time. See examples in Figure 24.
analog/digital (AD) and digital/analog (DA) hardware to make conversion x(t) ↔ x[n].
While sin(.), δ[n], and mu[n] are functions of n, we can compute these functions at certain
System takes an input, processes it and returns an output. It has also some properties. points of n by using tables, like in (a)
In case of digital systems, realized either software or hardware, system can be, e.g., linear,
time-invariant (or shift-invariant), causal or stable. See more in Problem 25. n sin(0.1πn) x1 [n]
−2 sin(0.1π(−2)) ≈ −0.588
In time-domain we speak about input and output signals x[n] and y[n]. All symbol letters
−1 sin(0.1π(−1)) ≈ −0.309
are typically written with lower case. A LTI system is identified uniquely with its impulse
0 sin(0.1π(−0)) 0
response h[n], and the output y[n] is computed as a convolution of sequences h[n] and
1 sin(0.1π(1)) ≈ 0.309
x[n].
2 sin(0.1π(2)) ≈ 0.588
In frequency-domain (or transform-domain) signals are transformed and the correspond-
Note that in (b) the argument for the sine function is always 2π-multiple and therefore
ing symbol letters are capitalized. X(ejω ) and Y (ejω ) are input and output spectra,
. . . = sin(0) = sin(2π) = . . . = 0. Shifted sequences can be written in a table, like in (c),
whereas H(ejω ) is the frequency response of the system (H(z) is called transfer function).
Here the output Y (ejω ) is computed as a product of spectrum X(ejω ) and frequency n δ[n − 1] δ[n] 2δ[n + 1] x3 [n]
response H(ejω ). −2 δ[−2 − 1] = 0 δ[−2] = 0 2δ[−2 + 1] = 0 0+0+0=0
Altering between time-domain and frequency-domain is achieved by applying Fourier −1 δ[−1 − 1] = 0 δ[−1] = 0 2δ[−1 + 1] = 2 0+0+2=2
transform and inverse Fourier transform (or other integral transforms, like z-transform 0 δ[0 − 1] = 0 δ[0] = 1 2δ[0 + 1] = 0 0+1+0=1
and Laplace transform). For example, if we want to compute the convolution in frequency- 1 δ[1 − 1] = 1 δ[1] = 0 2δ[1 + 1] = 0 1+0+0=1
domain, we first apply discrete Fourier transform (DFT) to x[n] and h[n] in order to get 2 δ[2 − 1] = 0 δ[2] = 0 2δ[2 + 1] = 0 0+0+0=0
X[k] and H[k], then we compute Y [k] = H[k] · X[k], and finally apply inverse discrete In (d) there are only constants δ[−1] = δ[1] = 0 and δ[0] = 1 from the definition,
Fourier transform (IDFT) to get y[n]. More about transforms in Problem 17. hence x4 [n] = 1 for all n. Sequences can be summed together, like in (e), x5 [n] =
T-61.3010 DSP 2009 33/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 34/170 PROBLEMS – Part C 19-35
x[n]
2 x3 [2] = 0 x6 [2] = x3 [−(2) + 1] = x3 [−1] = 2
−0.5
(a) (b) (c)
1 1 2
−1
0 0 1 1 22050 29001
0 0.2 0.4 0.6 0.8 1 1.2 1.4
0 time (s)
−1 −1
−10 0
(d) 10 −5 0
(e) 5 −2 −1 (f)
0 1 2 Figure 25: Remark of Problem 19. The waveform of a speech signal in the file kiisseli.wav.
While sampling frequency is 22050 Hz, there are 22050 samples in each second. Therefore 29001
2 samples correspond ≈ 1.3 seconds.
1 1
0.5 0.5 1
20. Problem: Which of the following signals are periodic? Determine the length of the
0 0 0 fundamental period for periodic signals.
−5−4−3−2−1 0 1 2 3 4 5 −3−2−1 0 1 2 3 4 5 −2 −1 0 1 2
a) x(t) = 3 cos( 8π
31
t)
Figure 24: Sequences of Problem 19. Top row: (a)-(c), bottom: (d)-(f). b) x[n] = 3 cos( 8π n)
31
Remark. For real-world physical signals, e.g., speech signal, there exists the sampling c) x(t) = cos( π8 t2 )
frequency fT (Hz). The inverse 1/fT gives us the time in seconds between each sample. d) x[n] = 2 cos( π6 n − π/8) + sin( π8 n)
Assume that there is an audio file kiisseli.wav, which contains a Finnish word “kiisseli” e) x[n] = {. . . , 2, 0, 1, 2, 0, 1, 2, 0, 1, . . .}
pronounced by female, see Figure 25. The file can be loaded into Matlab. It can be P
f) x[n] = +∞ k=−∞ δ[n − 4k] + δ[n − 4k − 1]
seen that the length of the digital sequence x[n] is 29001, each number is coded with
8 bits (28 = 256 quantization levels between −1 and +1), and the sampling frequency
is fT = 22050 Hz (sampling period T = 1/f T ≈ 45.4µs). The sequence x[n] is in the [L0162] Solution: A continuous-time signal x(t) is periodic if there exists period T ∈ R,
memory as “double” type meaning double precision floating point, 8 bytes (64 bits) per for which x(t) = x(t + T ), ∀t. The fundamental period is the smallest T0 > 0.
sample. The whole sequence requires therefore 232008 bytes linear memory. For instance,
the sample x(1) is −0.094 and x(29001) 0.023. A discrete-time signal (sequence) x[n] is periodic, if there exists period N ∈ Z, for which
x[n] = x[n + N], ∀n ∈ Z. The fundamental period is the smallest N0 > 0.
Matlab commands: [x, fs, nbits] = wavread(’kiisseli.wav’);
Examination of periodicity can be restricted to a certain time range.
length(x), class(x), x(1), x(end).
One way to find the period is to replace t by t + T (n by n + N) and try if the equation
We can now write our signal using δ notations x(t) = x(t + T ) holds.
x[n] = −0.094δ[n] + . . . + 0.023δ[n − 29000] Another way to find the period of a sinusoidal component (sine, cosine) is to express
the function in form of x(t) = sin(2π · f · t) where f is frequency (Ω = 2πf is angular
The length of x[n] in seconds is Ls = 29001/fT = 1.315 s, which can be derived from the frequency). Then T = 1/f .
fact that in one second there are fT samples. Typically signals can be synthesized as a sum of sinusoidals. Sines, cosines, and exponen-
tial functions are all 2π-periodic, e.g., A sin(Ωt + θ) ≡ A sin(Ωt + θ + 2πk). Note that the
amplitude A or phase shift θ does not have effect on periodicity.
If there is a sum of cosines, like in (d), one has to find period T0 (N0 ), to which all periods
of individual cosines are multiples, see Figure 27. Correspondingly, in the frequency
domain one has to find a fundamental frequency f0 , with which all individual frequencies
can be represented as multiples.
T-61.3010 DSP 2009 35/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 36/170 PROBLEMS – Part C 19-35
Signals (a)..(f) are plotted for a small range in Figure 28. The non-periodicity of the in Figure 28(c).
signal is often easy to see from the signal plot, for instance, the signal (c) is clearly not
π π π π
periodic. x(t) = cos( t2 ) = cos( (t + T )2 ) = cos( t2 + (2tT + T 2 ))
8 8 8 8
a) Periodic. Substitute t by (t + T ) and test, if the additional part is multiple of 2π. π 2 tT T2
= cos( t + 2π( + ))
8 | 8 {z 16 }
8π 8π 8π 8π 2πk
x(t) = 3 cos( t) = 3 cos( (t + T )) = 3 cos( t + T )
31 31 31 31
8π 4 tT T2
= 3 cos( t + 2π( T )) 2πk = 2π( + )
31 31 8√ 16
| {z } T = −t ± t2 − 16k no constant T exists
=2πk
4 d) Periodic, N0 = 48. Compute first individual periods of each sinudoidal. The funda-
2πk = 2π T
31 mental period is the least common multiple (LCM) of periods N1 = 12, N2 = 16 ⇒
T = (31/4)k N0 = 4N1 = 3N2 = 48. See Figure 27.
When T = (31/4)k, then 2π-multiple is added to the argument of the original cosine, π π 1 1
and x(t) = x(t + T ) holds. The fundamental period is the shortest period T0 = 31/4, x[n] = 2 cos( n − π/8) + sin( n) = 2 cos(2π n − π/8) + sin(2π n)
6 8 12 16
that is, k = 1.
Correspondingly, the fundamental angular frequency is the greatest common divisor
b) Periodic. Substitute n by (n + N) is a similar way as in (a) (GCD) of individual frequencies (ω = 2π/N): ω1 = π/6 = 4π/24, ω2 = π/8 =
8π 8π 8π 8π 3π/24 ⇒ ω0 = π/24, ⇒ ω1 = 4ω0 , ω2 = 3ω0 . More about computing LCM and
x[n] = 3 cos( n) = 3 cos( (n + N)) = 3 cos( n + N) GCD can be found, e.g. “Beta, Mathematics Handbook for Science and Engineering”.
31 31 31 31
8π 4 There are Matlab commands lcm and gcd, too.
= 3 cos( n + 2π( N))
31 | {z31 } 0 12 24 36 48 60
2πk
4
2πk = 2π N 0 16 32 48 64
31 Figure 27: Problem 20(d): least common multiple (LCM) for N1 = 12 and N2 = 16 is N0 = 48.
N = (31/4)k
Again N = (31/4) · k, where the period N has to be integer. The smallest possible e) (Assume that) the period is N0 = 3, i.e. x[0] = x[±3k] = 2, x[1] = x[±3k + 1] = 0,
k = 4 gives the length of the fundamental period N0 = 31. x[2] = x[±3k + 2] = 1, where the integer k > 0.
Notice also the difference of the results in (a) and (b), where x(t) = x(t + (31/4)), f) N0 = 4. “Open” the sequence if you do not see it directly:
but x[n] = x[n + 31]. The signals are plotted in the same axis in Figure 26.
+∞
X
(a) vs (b): x(t) = 3cos(8π / 31 t) vs x[n] = 3cos(8π / 31 n) x[n] = δ[n − 4k] + δ[n − 4k − 1]
k=−∞
N=31
3 T=31/4
= . . . + δ[n + 4] + δ[n + 4 − 1] + δ[n] + δ[n − 1] + δ[n − 4] + δ[n − 4 − 1] + . . .
2
| {z } | {z } | {z }
k=−1 k=0 k=1
1
= {. . . , 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, . . .}
0
−1 Remark. Real-life signals are seldom periodic in strict sense; almost periodic signals
−2
are sometimes called quasi-periodic. See Figure 29, where the signal part of a vowel /i/
x(t)
x[n]
in 0.02 second range is not exactly periodic x(t) = x(t + 0.02s) but almost.
−3
0 5 10 15 20 25 30 35
n, t
Figure 26: A visualization of the difference of fundamental periods of similar looking analog
and discrete-time signals in Problem 20(a) and (b). T0 = 31/4 but N0 = 31.
c) Not periodic (aperiodic), the latter term depends on t. The result can be also seen
T-61.3010 DSP 2009 37/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 38/170 PROBLEMS – Part C 19-35
1 Formally, the input sequence is x[n] = {12, 16, 15, 22, 20, 24, 23} or
2 2
0.5
x[n] = 12δ[n] + 16δ[n − 1] + 15δ[n − 2] + 22δ[n − 3] + 20δ[n − 4] + 24δ[n − 5] + 23δ[n − 6]
(a)
(b)
(c)
0 0 0
(e)
(f)
0 1
0.5 h[n] = = {0.5, 0.5}
2
−2 0 0
and the frequency response (see, e.g., Problem 42 and 55)
0 20 40 60 80 −5 0 5 −5 0 5
n n n
1 + e−jω
Figure 28: Signals and sequences in Problem 20, (a)..(c) in top row, (d)..(f) in bottom row. It H(ω) =
2
can be seen that (at least) (c) is not periodic in the scene shown.
which in DSP literature is normally written as H(ejω ). The corresponding flow (block)
/i/ in kiisseli.wav
diagram is plotted in Figure 30. In this case computation “flows” into right direction
0.6 without any feedback loops – the filter type is now FIR (finite impulse response, FIR),
0.4 whereas Problem 22 shows an example of the other type IIR.
0.2
Slow changes in the signal (temperature) mean low frequencies and quick changes mean
x[n]
0
high frequencies. Averaging smoothens the signal. In DSP, we say that it is a lowpass
−0.2
filter while it preserves low frequencies in the signal but attenuates high frequencies.
−0.4 High-frequency variation is often considered as noise.
−0.6
jω −j ω
−0.8 MA−2, H(e ) = 0.5 ( 1 + e )
0.435 0.44 0.445 0.45 1
time (s) h[n]
Figure 29: Problem 20: example of a quasi-periodic signal. 0.8
|H(e )|
jω
21. Problem: Compute “a two-point moving average” temperature from daily temperatures 0.4
in DSPVillage in early July: 0.5
z−1
0.2
T-61.3010 DSP 2009 39/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 40/170 PROBLEMS – Part C 19-35
22. Problem: Compute an average temperature by adding half of temperature today and half 23. Problem: Express the input-output relations of the discrete-time systems in Figure 32.
of average temperature yesterday. Use the same daily temperature data as in Problem 21:
x[n] y[n] x[n] y[n]
July 1st 2nd 3rd 4th 5th 6th 7th
◦
C 12 16 15 22 20 24 23 D z−1 z−1
−2 −2 2
D z−1
[L0287] Solution: Take a new sample and the last computed output value, sum them
together, divide by two, and go on to the following point. The purpose of averaging is to
suppress quick changes, possibly noise, in the signal.
(a) (b)
In order to compute the average temperature on 3rd July, we take temperature of 3rd
and the avarage of 2nd, and compute mean of them as shown below. Borders have to be v[n]
x[n] +
dealt with in appropriate way.
a b
system
1st 2nd 3rd 4th 5th 6th 7th x[n] y[n] h[n]
x[n] 12 16 15 22 20 24 23
y[n − 1] 6 11 13 17.5 18.8 21.4 22.2 11.1 y[n] + D
y[n] 6 11 13 17.5 18.8 21.4 22.2 11.1 5.6 cos( ω n) c
(c) (d)
Now the averaging process can be thought as a filtering operation:
Figure 32: Discrete-time systems for Problems 23, 27, and 28.
x[n] + y[n − 1]
y[n] = = {6, 11, 13, 17.5, 18.8, 21.4, 22.2, 11.1, 5.6, . . .}
2
This corresponds a LTI system with the infinite-length impulse response [L0244] Solution: In this problem there are several types of discrete-time systems. Notice
that the scope of this course is LTI systems (linear and time-invariant). LTI systems are
h[n] = 0.5 · 0.5n µ[n] = {0.5, 0.25, 0.125, . . .} very easy to detect, they are relatively simple but very useful. In this course the system
input x[n] and output y[n] are 1-dimensional except some examples with pictures (2D).
and the frequency response (see, e.g., Problem 42 and 55)
For LTI-systems the input-output relation can be written with a difference equation or a
0.5 set of difference equations.
H(ejω ) =
1 − 0.5e−jω There are some basic operations on sequences (signals) in discrete-time systems (x refers
The corresponding flow (block) diagram is plotted in Figure 31. In this case there exists to input to the system / operation, y output) shown also in Figure 33:
a feedback loop – the filter type is now IIR (infinite impulse response, IIR), whereas • sum of signals (sequences) y[n] = x1 [n] + x2 [n]
Problem 21 shows an example of the other type FIR.
• signal multiplication (by constant) y[n] = a x[n]
IIR, H(ej ω) = 0.5 / ( 1 − 0.5 e−j ω )
• delay or advance of signal y[n] = x[n ± k]
h[n] 1
0.4
0.5
x 1 [n] x[n] ax[n] x[n] x[n−1] x 1 [n] x[n]
z−1 0.2
a
D x 1 [n] . x2 [n]
0
0.5 0 0.2 0.4 0.6 0.8 1 x 2 [n] x 1 [n]+x 2 [n] x[n] x[n−1] x 2 [n] x[n]
norm. angular freq. ω (× π) z−1 x[n]
(a) (b) (c) (d) (e)
Figure 31: Problem 21: (a) Flow (block) diagram of the filter. Input x[n] is filtered by the
system h[n], which is dashed and includes everything between input and output, and the output
Figure 33: Problem 23: Basic operations in discrete-time systems.
is y[n]. The system includes a feedback loop which is equivalent that the system is IIR. (b)
Magnitude response |H(ejω )| of an IIR filter. It can be seen that it is a lowpass filter.
Now we analyze the systems depicted in Figure 32.
T-61.3010 DSP 2009 41/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 42/170 PROBLEMS – Part C 19-35
a) Difference equation: y[n] = x[n] − 2x[n − 1] + x[n − 2]. LTI-filter, type FIR (see 24. Problem: Look at the flow (block) diagrams in Figure 34.
Problem 24).
x[n]
b) The memory registers / unit delays are often drawn either “D” (delay) or “z−1 (refers
to a delay in z-transform). Note that the output is fed back in the loop. The left z
-1
part of the filter is the same as (a). The sequence right after the second summing on -0.75
-1
z
top line is y[n] which goes both to the output and down to feedback loop. Therefore
x[n] y[n]
the terms coming into the last summing unit are x[n] − 2x[n − 1] + x[n − 2] from left 0.5 0.5
0.5
and 2y[n − 1] from the loop. The difference equation is
x[n] y[n] y[n]
y[n] = 2y[n − 1] + x[n] − 2x[n − 1] + x[n − 2] -1 -1
-1
z z z 0.75
-0.75 0.5 -0.75 -1
The system is LTI and type IIR (see Problem 24). z
c) Input signal x[n] is multiplied by a sequence cos(ωn) (not a constant). This operation
i ii iii
is called modulation and is not LTI. The relation can be written as
v[n]
y[n] = x[n] · cos(ωn) x[n] +
d) This is so called lattice structure (Mitra 2Ed Sec. 6 / 3Ed Sec. 8 ). In order to get a b
system
relationship between x[n] and y[n] temporary variables are used after each summing h[n]
unit. In this case, there is one temporary variable v[n], and the set of difference 1/2 y[n]
x[n]
equations is
y[n] + D
v[n] = x[n] + a v[n − 1] 1
c
y[n] = b v[n] + c v[n − 1] iv v
The temporary variable v[n] can be simplified away, but it is easier to determine Figure 34: Flow diagrams of Problem 24.
the transfer function H(z) in frequency domain and then apply inverse z-transform,
which is discussed later. The system is LTI and IIR (see Problem 24).
Remark. The simplified difference equation for the system in (d) can be received by a) What does LTI mean? In what ways can the system be proved (Problem 25) or
eliminating all temporary v[n] sequences: shown to be LTI?
x[n] = v[n] − a v[n − 1] | x on left side b) Which systems are linear and time-invariant (LTI) without any computation?
y[n] = b v[n] + c v[n − 1] | y on left side c) Which systems have feedback?
−bx[n] = −b v[n] + ab v[n − 1] | y[n] − bx[n] cancels v[n] d) Which LTI systems are FIR and which are IIR?
−ay[n − 1] = −ab v[n − 1] − ac v[n − 2]
−cx[n − 1] = −c v[n − 1] + ac v[n − 2] | all v[n − 1], v[n − 2] cancelled [L0245] Solution: In this problem we try to recognise LTI systems by their layout.
which finally gives y[n] = ay[n − 1] + bx[n] + cx[n − 1]. a) LTI = linear AND time-invariant (=shift-invariant) system. These two properties
The discrete-time system does some computation for sequencies of numbers. Therefore it belong to a system not to a signal. Other system properties can be, e.g. stability,
is straightforward to write down a computer program, e.g. in (a), causality, or if it needs memory or if it can be inverted.
x1 := 0; x2 := 0; See Problem 25 for mathematical proofs.
while TRUE { Recognition of LTI systems from the flow (block) diagrams: there are only (1) sums
x2 := x1; of signals, (2) multiplication by a contant, (3) delays or advances. The components
x1 := x0; were introduced in Problem 23, see Figure 33 at page 40.
x0 := read_next_input(input_stream); LTI systems can be represented with a linear constant coefficient difference (or dif-
y := x0 - 2*x1 + x2; ferential in case of analog system) equation
write_output(output_stream, y); X X
} dk y[n − k] = pk x[n − k]
k k
or if all samples are known in advance and written in vector x,
where {dk } and
P{pk } are constants.POften in practice, we use causal finite-dimensional
for (k = 2; k <= length(x); k++) {
LTI systems N k=0 dk y[n − k] =
M
k=0 pk x[n − k], where the order of the system is
y[k] := x[k] - 2*x[k-1] + x[k-2];
given by max{N, M} (Mitra 2Ed Sec. 2.6.0 / 3Ed Sec. 2.7.0 ). If the system cannot
}
be written in the format above, it is not a (causal) LTI system.
T-61.3010 DSP 2009 43/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 44/170 PROBLEMS – Part C 19-35
b) LTI? Only summing, delays, amplifications by constants. (i) Yes, (ii) Yes, (iii) Yes, 25. Problem: For each the following discrete-time systems, determine whether or not the
(iv) No, adding a constant, (v) Yes. system is (1) linear, (2) causal, (3) stable, and (4) shift-invariant. The sequences x[n] and
c) Feedback means that some of the output (or internal) values are fed back in the y[n] are the input and output sequences of the system.
system. Computation can be said to be recursive or iterative. There are loops in (i), a) y[n] = x3 [n],
(ii), (iii), and (v). P2
b) y[n] = γ + l=−2 x[n − l], γ is a nonzero constant,
d) FIR = Finite (length) Impulse Response. IIR = Infinite (length) Impulse Response.
c) y[n] = αx[−n], α is a nonzero constant.
If the system has a feedback loop somewhere in the structure, it is also IIR at the
same time. The output value is computed using older output values, i.e. there is
recursion. This can be seen that there are also terms y[n−k], k 6= 0, in the difference [L0238] Solution: Properties of the discrete-time system, see (Mitra 2Ed Sec. 2.4.1,
equation. 2.5.3, 2.5.4 / 3Ed Sec. 2.4.2, 2.5.3., 2.5.4 ).
If there is no loop and computation flows forward all the time, then the system is Linearity:
FIR. This can be seen that there is only the term y[n] in the left side of the difference If y1 [n] and y2 [n] are the responses to the input sequences x1 [n] and x2 [n], respectively,
equation above. then for an input
FIR: (iv) has an impulse response of finite length but it is not LTI. IIR: (i), (ii), (iii), x[n] = αx1 [n] + βx2 [n],
and (v) have infinite (length) impulse response because of feedback loops.
the response is given by
y[n] = αy1 [n] + βy2[n].
S a a
x1 y y3* x1 x3 y3
1
S
S b b
x2 y x2
2
Figure 35: Linearity. If the linear combination y3∗ of outputs of x1 and x2 is the same as the
output y3 of the linear combination of inputs, then the system S is linear.
Linear systems offer possibility to use superposition, that is, a signal can be divided to
small portions, processed individually, and summed back.
Remark. When considering a constant-coefficient difference equation like y[n] + 0.5y[n −
1] = x[n] + 0.5x[n − 1] the system is not linear, if the initial conditions are not zero, i.e.,
y[−1] 6= 0. When initial values are zero, the system is said to be in rest. See (Mitra 2Ed
Ex. 2.30, p. 92 / 3Ed Ex. 2.37, p. 92 ).
Causality:
The n0 -th output sample y[n0 ] depends only on previous output values and input samples
x[n] for n ≤ n0 , and does not depend on input samples for n > n0 . In case of a LTI
system, the system is causal if and only if impulse response h[n] = 0 for all n < 0. In
other words, if the system does not predict anything, it is causal.
Stability:
Bounded input, bounded output (BIBO) stability: If a bounded input (Bx is a finite
constant)
|x[n]| < Bx < ∞, ∀n
produces a bounded output (By is a finite constant)
as a response then the system is BIBO stable (see (a) Pand (b) at Page 45 for details). In
case of LTI-system, the system is stable if and only if ∞n=−∞ |h[n]| < ∞.
T-61.3010 DSP 2009 45/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 46/170 PROBLEMS – Part C 19-35
Time/Shift-invariance: The system is not causal, because there can be output before input, when l ∈
If y1 [n] is the response to an input x1 [n], then the response to an input [−2, −1].
System is stable: Assume bounded input |x[n]| < Bx , then
x[n] = x1 [n − n0 ]
2
X 2
X
is simply |y[n]| = |γ + x[n − l]| ≤ |γ| + |x[n − l]| < |γ| + 5Bx = By < ∞
y[n] = y1 [n − n0 ], l=−2 l=−2
The system is time-invariant: Assume input x1 [n] and output y1 [n], then response
of input x[n] = x1 [n − n0 ] is
T-61.3010 DSP 2009 47/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 48/170 PROBLEMS – Part C 19-35
26. Problem: A LTI system with an input x1 [n] = {1, 1, 1} gives an output y1 [n] = 27. Problem: Impulse response h[n] is the response of the system to the input δ[n].
{0, 2, 5, 5, 3}. If a new input is x2 [n] = {1, 3, 3, 2}, what is the output y2 [n]?
a) What is the impulse response of the system in Figure 32(a)? What is the connection
to the difference equation? Is this LTI system stable/causal?
[L0281] Solution: While the LTI system is both linear (L) and time-invariant (TI) we
can apply superposition. Now x2 [n] can be synthesized as a sum of original x1 [n] and a b) What are the first five values of impulse response of the system in Figure 32(b)?
shifted and scaled 2x1 [n − 1]: Hint: Fetch the input δ[n] and read what comes out. Is it possible to say something
about stability or causality of the system?
x2 [n] = x1 [n] + 2x1 [n − 1] = {1, 1, 1} + {0, 2, 2, 2} = {1, 3, 3, 2} c) What are the first five values of impulse response of the system in Figure 32(d)?
Because of LTI, the output y2 [n] is also a sum of original y1 [n] and a shifted and scaled
2y1 [n − 1], as shown in Figure 37 [L0237] Solution: Impulse response h[n] is the response of the system to the input δ[n].
y2 [n] = y1 [n] + 2y1 [n − 1] = {0, 2, 5, 5, 3} + {0, 0, 4, 10, 10, 6} = {0, 2, 9, 15, 13, 6}
Any discrete-time Impulse response
Impulse δ[n] −→ −→
system hi [n]
15
3
10 Here hi [n] may get different values at different moments. However, a discrete-time LTI
x [n]
y1[n]
2
1
1 5 (linear and time-invariant) has only one h[n] which specifies the system completely (Mitra
0 2Ed Sec. 2.5.1 / 3Ed Sec. 2.5.1 ).
0
0 2 4 6 0 2 4 6
n n
3
15 Discrete-time (unambiguous)
Impulse δ[n] −→ −→
2 x [n−1]
2 y1[n−1]
1 5
0
0 For a LTI system (see Problems 24 and 25) the stability condition is
0 2 4 6 0 2 4 6
n n
∞
X
15
3 |h[n]| < ∞
10
x [n]
y2[n]
2
n=−∞
2
1 5
0 and the causality condition
0
0 2 4 6 0 2 4 6
n n h[n] = 0, ∀n < 0
Figure 37: Problem 26: Left column: sequences x1 [n], 2x1 [n − 1], and x2 [n] = x1 [n] + 2x1 [n − 1]. If the impulse response h[n] is known for a LTI system, then the output y[n] can be
Right column: sequences y1 [n], 2y1 [n − 1], and y2 [n] = y1 [n] + 2y1 [n − 1]. This holds for linear computed for any input x[n] by convolution.
and time-invariant (LTI) systems.
Discrete-time Output sequence y[n]
Input sequence x[n] −→ −→
LTI system h[n] y[n] = h[n] ⊛ x[n]
Remark. A standard way to solve this problem is to compute deconvolution of x1 [n] and
y1 [n], and then apply the result to the new input x2 [n]. See Problem 32.
If we know how the LTI system modifiesP an impulse δ[n] into an output y[n] = h[n], we a) Difference equation of the system is y[n] = x[n] − 2x[n − 1] + x[n − 2]. Let the input
can build an arbitrary synthesis x[n] = k x[k]δ[n − k] and receive the output y[n] by be δ[n] and read what comes out.
convolving x[n] and h[n]. See Problem 27 or (Smith: DSPguide, Ch. 5, p. 98–99 ). n x[n] −2x[n − 1] x[n − 2] y[n] = x[n] − 2x[n − 1] + x[n − 2]
... 0 0 0 0
Notice that a synthesis signal x[n] can be decomposed in several ways. For example, the
-1 0 0 0 0
synthesis of 15+25 is always 40, but 40 can be decomposed to 1+39, −1+41, 20+20, etc.
0 1 0 0 1
In case of signals, Fourier analysis (decomposition) or Fourier synthesis (inverse Fourier)
1 0 −2 0 −2
is applied.
2 0 0 1 1
3 0 0 0 0
... 0 0 0 0
|{z} |{z}
δ[n] h[n]
T-61.3010 DSP 2009 49/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 50/170 PROBLEMS – Part C 19-35
T-61.3010 DSP 2009 51/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 52/170 PROBLEMS – Part C 19-35
28. Problem: Step response s[n] is the response of the system to the input µ[n]. What are 29. Problem: Compute the linear convolution of two signals x1 (t) and x2 (t)
the step responses of systems in Figures 32(a) and (b)? Z ∞
y(t) = x1 (t) ⊛ x2 (t) = x1 (τ ) · x2 (t − τ ) dτ
−∞
[L0273] Solution: Unit step response, or shortly step response s[n] is the response of the
system to the input µ[n] (Mitra 2Ed Sec. 2.4.2 / 3Ed Sec. 2.4.3 ). Step response can be in both cases (a) and (b) in Figure 38. The arrows in (b) are impulses δ(t).
computed easily from the impulse response h[n] by cumulative sum (accumulator)
n
x1(t) x2(t) x1(t) x2(t)
X 3 3
s[n] = h[k] 2 2
2 2
k=−∞
1 1 1 1
Now, in (a) the impulse response is h[n] = δ[n]−2δ[n−1]+ δ[n−2], and the step response 0 2 4 t −1 0 1 2 t 0 2 4 t −1 0 1 2 t
is
s[n] = {. . . , 0, 0, 1, −1, 0, 0, . . .} Figure 38: Problem 29: signals x1 (t) and x2 (t) to be convolved, left: (a), right: (b).
which can be also seen by feeding ones to the input and reading the output. The steady-
state response (Mitra 2Ed Sec. 4.2.3 / 3Ed Sec. 3.8.5 ) converges quickly to zero. [L0272] Solution: Continuous-time linear convolution of two signals x1 (t) and x2 (t) is
In (b) the impulse response diverges h[n] = δ[n] + δ[n − 2] + 2δ[n − 3] + 4δ[n − 4] + . . ., defined by Z ∞
as well as the step response y(t) = x1 (t) ⊛ x2 (t) = x1 (τ ) · x2 (t − τ ) dτ
−∞
s[n] = {. . . , 0, 0, 1, 1, 2, 4, 8, . . .} You can see an example of graphical convolution in Java applet in URL http://www.jhu.
edu/~signals/convolve/index.html. Sketch the signals x1 (t) and x2 (t) of Figure 38
into the boxes. The other signal is flipped around. When sliding the flipped signal to
right over the other signal, the integral of the product is computed. At certain point t0
the integral gives the convolution output y(t0).
The results of (a) can be seen in Figure 39(a). In (b) the arrows are impulses δ(t) which
are signals having the area of unity and being infinitely narrow, i.e. the height in infinite.
Convolving a signal with an impulse δ(t) can be considered as copying the signal at each
place where impulse lies, see Figure 39(b).
y(t) y(t)
3 3
2 2
1 1
0 2 4 t 0 2 4 t
Figure 39: Problem 29: convolution results y(t), left: (a), right: (b).
Remark. The continuous-time convolution contains the product of two signals and taking
integral of the product. In practice, the convolution can seldom be computed in closed
form. However, in (a) the signals are
(
3, −1 ≤ t < 4
x1 (t) =
0, elsewhere
(
2 − 2t, 0 ≤ t < 1
x2 (t) =
0, elsewhere
from left to right: (1) t < −1, product of signals is zero, (2) −1 < t < 0, x2 “penetrating”, 30. Problem: Linear convolution of two sequences is defined as (Mitra 2Ed Eq. 2.64a, p.
(3) 0 < t < 4, “stable” case, (4) 4 < t < 5, x2 “leaving”, (5) t > 5, again zero. 72 / 3Ed Eq. 2.73a, p. 79 )
Z −1 ∞
X
y(t)(1) = 0 · (2 − 2t + 2τ ) dτ = 0, t < −1 y[n] = h[n] ⊛ x[n] = x[n] ⊛ h[n] = x[k] h[n − k]
−∞
Z t k=−∞
τ t ∞
X
−2 2 4 6 −2 0 2 4 6 y[n] = h[n] ⊛ x[n] = h[k]x[n − k]
t = −1.9 k=−∞
00
11 y(t)
11
00
00
11
00
11
00
11
00
11
x1( τ) 00
11
00
11 The convolution is an operation for two sequences (Mitra 2Ed Sec. 2.5.1, p. 71 / 3Ed
x 2(t−τ ) 2 00
11
00
11
2
00
11
00
11
00
11
Sec. 2.5.1, 2.5.2, p. 78 ). There are several ways to get the convolution result. First,
τ 00
11
00
11
t
00
11 in (a) the convolution is considered as filtering, the other sequence is the input and the
−2 2 4 6 −2 0 2 4 6
t = −0.7
other is the inpulse response of the system, and the convolution result is the output of
00
11
11
00
y(t)
00
11
00
11
00
11
the system. Second, in (b) a graphical way of inverting and sliding the sequences over
00
11
x1( τ)
00
11
00
11
00
11
each other is represented. In (c) the convolution is considered as a sum of shifted and
2 00
11
2
00
11
x 2(t−τ ) 00
11
00
11
00
11
scaled sequences, “tabular method” in (Mitra 3Ed Sec. 2.5.2 ). However, even if three
00
11 t
τ 00
11
00
11 ways are introduced separately, they all rely on the same (and simple) definition of the
−2 2 4 6 −2 0 2 4 6
convolution.
t = 1.2
y(t) When computing discrete-time convolution y[n] = x[n] ⊛ h[n], it is nice know a couple of
0
1
1
0
x1( τ) 0
1
0
1
0
1
rules. Let L{.} be a length of a sequence, e.g. x[n] = {3, 2, 0, 5, −2}, then L{x[n]} = 5.
2 x 2(t−τ ) 2 0
1
0
1
0
1
0
1
0
1 t Because LTI-system is shift-invariant, the starting point of the convolution result can be
τ 0
1
0
1
−2 2 4 6 −2 0 2 4 6 determined as a sum of starting points of the convolved sequencies. Let A{.} be the index
t = 4.5 number of the first non-zero element, e.g., A{x[n]} = −1.
y(t)
x 2(t−τ ) It is easily seen that for the convolution result y[n] it holds
2
x1( τ) 2
Figure 40: Remark of Problem 29: Detailed example of continuous convolution. Five figures There are also some nice convolution demos in Internet, e.g. http://www.jhu.edu/
represent examples of y(t)(i) , i = 1 . . . 5, as given in equations above. The shaded areas depict ~signals/discreteconv2/index.html.
the integrand x1 (τ ) · x2 (t − τ ) in the corresponding range. Note that they are not in scale in
second and third figure, the peak should be at 6. a) Consider convolution as filtering with the input sequence x[n] = δ[n] + δ[n − 1] =
{1, 1}, and the impulse response h[n] = δ[n] + δ[n − 1] = {1, 1}, of the system.
The corresponding difference equation is y[n] = x[n] + x[n − 1], that is, the output
is just the sum of the present and previous value in the input. (You can draw the
flow (block) diagram for the system and verify the computation.)
T-61.3010 DSP 2009 55/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 56/170 PROBLEMS – Part C 19-35
n x[n] = δ[n] + δ[n − 1] x[n − 1] y[n] = x[n] + x[n − 1] x[n]=x1[n] * x2[n], method "inverse&slide"
-1 0 0 0+0=0
5
0 1 0 1+0=1
x1[k]
1 1 1 1+1=2 0
2 0 1 0+1=1 0 1 5 0
−5
3 0 0 0+0=0 −4 −2 0 2 4
4 0 0 0+0=0 5
x2[3−k]
0 −5 −1 −1 0
So, the result is x[n] ⊛ h[n] = {1, 2, 1} = δ[n] + 2δ[n − 1] + δ[n − 2], and the length is 0
L{y[n]} = 3. The starting point can be checked: A{y[n]} = A{x[n]} + A{h[n]} = 0. 2
−5
b) Another way (on-line) is computing output values at each time moment n. Graphi- −4 −2 0 2 4
10
cally this means inverting (flipping around) the other sequence, sliding it over the
Prod.
5 0 −1 0
other, and computing the output value as a dot sum. This is also illustrated with 0
figures in (Mitra 2Ed Ex. 2.24, p. 73-75 / 3Ed Ex. 2.26, p. 80-83 ). −5 10
Now when x1 [n] = δ[n]+5δ[n−1] and x2 [n] = −δ[n−1]+2δ[n−2]−δ[n−3]−5δ[n−4], −4 −2 0 2 4
10
then L{x[n]} = 2 + 4 − 1 = 5 and A{x[n]} = 0 + 1 = 1. Therefore we know that the
5
x[n]
x[0] ⋅ h[n−0]
2 1 0.5 0.25 0.0625
1 0.125 0.03125 D
0
−1
1
−2 0 2 4 6
x[1] ⋅ h[n−1]
2
1 D
0 −1
−1 0 2 1 0.5 ****
−2 0 2 4 6
x[2] ⋅ h[n−2]
2
0 0 −1 −0.5 ****
1 Figure 43: Problem 31: Flow diagram.
0
−1
−2 0 2 4 6
b) Using values of h[n] = δ[n − 1] − δ[n − 2] as scaling factors
x[n] * h[n]
2
1
0 y[n] = h[n] ⊛ x[n]
−1 1 2 0.25 0.125 * * * * ∞
X
−2 0 2 4 6 = h[k]x[n − k]
k=−∞
2
Figure 42: Problem 30(c): Linear convolution using “scaled and shifted sequences”. Top line: X
= h[k]x[n − k]
x[0] · h[n − 0] = 0.5n µ[n], second: x[1] · h[n − 1] = 2 · 0.5n−1 µ[n − 1], third: x[2] · h[n − 2] =
k=1
−1 · 0.5n−2 µ[n − 2], bottom: convolution result, sum of sequences above.
= 1 · (2δ[n − 1] + 3δ[n − 3]) − 1 · (2δ[n − 2] + 3δ[n − 4])
= 2δ[n − 1] − 2δ[n − 2] + 3δ[n − 3] − 3δ[n − 4]
31. Problem: Consider a LTI-system with impulse response h[n] = δ[n − 1] − δ[n − 2] and
input sequence x[n] = 2δ[n] + 3δ[n − 2].
c) U(x) = S(x) · T (x) = (2 + 3x2 ) · (x − x2 ) = 2x − 2x2 + 3x3 − 3x4 . Notice the
a) What is the length of convolution of h[n] and x[n] (without computing convolution correspondence with the result of (b), the delay is the power of x (z −1 in z-transform).
itself)? Which index n is the first one having a non-zero item? d) Using long division (Mitra 2Ed Ex. 3.35 / 3Ed Ex. 6.19 ). The polynomials are
b) Compute convolution y[n] = h[n] ⊛ x[n] U(x) = 2x − 2x2 + 3x3 − 3x4 and S(x) = 2 + 3x2 ,
c) Consider polynomials S(x) = 2 + 3x2 and T (x) = x − x2 . Compute the product − x2 + x
U(x) = S(x) · T (x)
3x2 + 2 − 3x4 + 3x3 − 2x2 + 2x
d) Check the result by computing the polynomial division T (x) = U(x)/S(x). 3x4 + 2x2
3x3 + 2x
− 3x3 − 2x
[L0246] Solution: An important rule of thumb for finding length L{.} of the linear
convolution (different from circular convolution): 0
We get the result x − x2 as expected (h[n] = δ[n − 1] − δ[n − 2]). Convolution and
y[n] = h[n] ⊛ x[n] → L{y[n]} = L{h[n]} + L{x[n]} − 1 deconvolution operations can be computed using products and divisions of polyno-
The index of the first non-zero item A{.} for finite sequences: mials.
In this case, h[n] = δ[n − 1] − δ[n − 2], which is drawn as a flow diagram in Figure 43.
T-61.3010 DSP 2009 59/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 60/170 PROBLEMS – Part C 19-35
32. Problem: The impulse response h1 [n] of a LTI system is known to be h1 [n] = µ[n] − Third, compute the convolution, and solve the unknown constants a, b, and c.
µ[n − 2]. It is connected in cascade (series) with another LTI system h2 as shown in
h[n] = h11 [n] ⊛ h2 [n]
Figure 44. +∞ 2
X X
x[n] y[n]
= h11 [k]h2 [n − k] = h11 [k]h2 [n − k]
h1[n] h2[n] h1[n] k=−∞ k=0
= h11 [0] · h2 [n − 0] + h11 [1] · h2 [n − 1] + h11 [2] · h2 [n − 2]
Figure 44: The cascade system of Problem 32. = h2 [n − 0] + 2h2 [n − 1] + h2 [n − 2]
= (aδ[n] + bδ[n − 1] + cδ[n − 2])
+2(aδ[n − 1] + bδ[n − 2] + cδ[n − 3])
Compute the impulse response h2 [n], when it is known that the impulse response h[n] of
the whole system is shown in Table 6 below. +(aδ[n − 2] + bδ[n − 3] + cδ[n − 4])
= aδ[n] + (b + 2a)δ[n − 1] + (c + 2b + a)δ[n − 2] + (2c + b)δ[n − 3] + cδ[n − 4]
n <0 0 1 2 3 4 >4 = δ[n] + 5δ[n − 1] + 9δ[n − 2] + 7δ[n − 3] + 2δ[n − 4] | h[n] is known
h[n] 0 1 5 9 7 2 0
The comparison between the last two lines from left gives a = 1, then (b + 2 · 1) = 5 ⇒
b = 3, then (c + 2 · 3 + 1) = 9 ⇒ c = 2, and also the rest values hold. In the end, the
Table 6: Impulse response of the cascade system in Problem 32. result is
h2 [n] = δ[n] + 3δ[n − 1] + 2δ[n − 2]
which can be ensured by convolution.
[L0241] Solution: There are three subsystems connected in cascade (series). They are
Remark. The last convolution can be written easily in a visual way using “tabular
all linear and time-invariant (LTI). The overall impulse response of the whole system is
method” (Mitra 2Ed Sec. -, p. - / 3Ed Sec. 2.5.2, p. 83–85 ).
therefore P
Recall that h[n] = 2k=0 h11 [k]h2 [n − k], where h11 [n] = {1, 2, 1}, h2 [n] = {a, b, c}, and
h[n] = (h1 [n] ⊛ h2 [n]) ⊛ h1 [n] h[n] = {1, 5, 9, 7, 2}. Write down the sum into a table
h[n] = (h1 [n] ⊛ h1 [n]) ⊛ h2 [n] n: −1 0 1 2 3 4 5
= δ[n] + 5δ[n − 1] + 9δ[n − 2] + 7δ[n − 3] + 2δ[n − 4] h11 [0]· 0 a b c 0 0 0 ← h2 [n]
= {1, 5, 9, 7, 2} h11 [1]· 0 0 a b c 0 0 ← h2 [n − 1]
+ h11 [2]· 0 0 0 a b c 0 ← h2 [n − 2]
Notice that h[n] and h1 [n] are known but h2 [n] is unknown. If one of the signals to = h[n] = h[−1] h[0] h[1] h[2] h[3] h[4] h[5]
be convolved is unknown and the convolution result is known, the operation to find the Now, inserting all known values, and multiplying h11 [k] scaling factors in, we get
unknown is called deconvolution, inverse operation of convolution. The procedure of
n: −1 0 1 2 3 4 5
deconvolution is basically the same as that with convolution. If polynomial products are
0 a b c 0 0 0
used, then the operation is polynomial division H2 (x) = H(x)/(H1 (x)H1 (x)).
0 0 2a 2b 2c 0 0
First, compute h11 [n] = h1 [n] ⊛ h1 [n], with h1 [n] = δ[n] + δ[n − 1], or h1 [0] = 1, h1 [1] = 1, + 0 0 0 a b c 0
= h[n] = 0 1 5 9 7 2 0
h11 [n] = h1 [n] ⊛ h1 [n]
+∞ We can start either from left-most non-zero column (or from right-most) to solve unknown
X
= h1 [k]h1 [n − k] values. First, we find out that in the column at n = 0 there is a + 0 + 0 = 1, from which
k=−∞ we get a = 1:
= δ[n] + 2δ[n − 1] + δ[n − 2] n: −1 0 1 2 3 4 5
0 1 b c 0 0 0
Second, compute the length (here L{.}) of h2 [n]. While L{h[n]} = 5, L{h11 [n]} = 3, and 0 0 2 2b 2c 0 0
L{h[n]} = L{h11 [n]} + L{h2 [n]} − 1, the result is L{h2 [n]} = 3. + 0 0 0 1 b c 0
The index of the first non-zero element (here A{.}) is A{h2 [n]} = A{h[n]} − A{h11 [n]} = = h[n] = 0 1 5 9 7 2 0
0 − 0 = 0. Therefore the unknown sequence can be written as The next column at n = 1 gives b + 2 + 0 = 5, from which b = 3:
n: −1 0 1 2 3 4 5
h2 [n] = aδ[n] + bδ[n − 1] + cδ[n − 2]
0 1 3 c 0 0 0
0 0 2 6 2c 0 0
+ 0 0 0 1 3 c 0
= h[n] = 0 1 5 9 7 2 0
T-61.3010 DSP 2009 61/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 62/170 PROBLEMS – Part C 19-35
The next column at n = 2 gives c + 6 + 1 = 9, from which c = 2: 33. Problem: LTI systems are commutative, distributive and associative. Determine the
n: −1 0 1 2 3 4 5 expression for the impulse response of each of the LTI systems shown in Figure 45.
0 1 3 2 0 0 0
h4[n]
0 0 2 6 4 0 0 h1[n] h2[n]
+ 0 0 0 1 3 2 0
h1[n] h2[n] h3[n]
= h[n] = 0 1 5 9 7 2 0 h5[n]
(a) (b)
h2 [n] = δ[n] + 3δ[n − 1] + 2δ[n − 2]
Figure 45: LTI systems in Problem 33.
[L0242] Solution: All subsystems are LTI. Therefore we can use sum of impulse re-
sponses for parallel systems and convolution of impulse responses for cascade systems
(Mitra 2Ed Ex. 2.27 / 3Ed Ex. 2.35 ).
If any temporary variables are needed, they are probably best situated right after the
summing units.
a) We can derive the impulse response h[n] of the whole system directly, or using a
temporary variable v[n] (easier!?) shown in Figure ??. The useful position for v[n]
is after summation.
T-61.3010 DSP 2009 63/170 PROBLEMS – Part C 19-35 T-61.3010 DSP 2009 64/170 PROBLEMS – Part C 19-35
34. Problem: The impulse response of a digital matched filter, h[n], is the time-reversed 35. Problem: Determine the autocorrelation sequence of the sequence x1 [n] = αn µ[n], |α| <
replica of the signal to be detected (Mitra 2Ed Sec. 4.14, p. 272 / 3Ed Sec. -, p. -). The 1 and show that it is an even sequence. What is the location of the maximum value of
time-shift is needed in order to get a causal filter. the autocorrelation sequence?
The (binary) signal to be detected is given by s[n] = {1, 1, 1, −1, −1, 1, −1}. Consider an
input sequence x[n] which is a periodic sequence repeating s[n]. Determine h[n] and the [L0249] Solution: Cross-correlation sequence rxy [l] of two sequences and autocorrelation
result of filtering y[n] = h[n] ⊛ x[n]. sequence rxx [l] with lag l = 0, ±1, ±2, . . . are defined in (Mitra 2Ed Sec. 2.7 / 3Ed Sec.
2.9 )
∞ ∞
[L0247] Solution: Matched filter. Let s[n] be a (binary) 7-bit long codeword to be X X
detected, x[n] an input signal of repeated s[n], and the impulse response of the matched rxy [l] = x[n]y[n − l] rxx [l] = x[n]x[n − l]
n=−∞ n=−∞
filter h[n] = s[−n]:
∞
s[n] = {1, 1, 1, −1, −1, 1, −1} X
rxx [l] = x1 [n]x1 [n − l]
x[n] = {. . . , s[n], s[n], s[n], . . .} = n=−∞
= {. . . , 1, 1, 1, −1, −1, 1, −1, 1, 1, 1, −1, −1, 1, −1, 1, 1, 1, −1, −1, 1, −1, . . .} X∞
4
αl α−l
Note for the lag l ≥ 0, rxx [l] = 1−α2
, and for l < 0, rxx [l] = 1−α2
.
2
α−(−l)
Replacing l with −l in the second expression we get rxx [−l] = 1−α2
= rxx [l].
0
Hence, rxx [l] is an even function of l.
−2
0 5 10 15 20 25
Maximum value of rxx [l] occurs at l = 0 since αl is a decaying function for increasing l
when |α| < 1.
Figure 46: Convolution result of the matched filter and desired sequence in Problem 34.
n
Problem 3. Autocorrelation of x[n] = α µ[n], α = 0.8
The signal s[n] was chosen so, that the every seventh sample (length of s[n]) in output is 1
high, and all others are low. If the signal s[n] were different, there would be not so clear
x[n]
0.5
peaks in the convolution result.
0
Remark. Convolution and cross-correlation have a close connection (Mitra 2Ed Eq. −2 0 2 4 6 8 10 12 14
∞
X 0.5
n=−∞ −2 0 2 4 6 8 10 12 14
2
rxx[2]
0
−2 0 2 4 6 8 10 12 14
1
36. Problem: Compute continuous-time Fourier transform (CTFT) of the following analog 1
Real{x(t)}
2
Imag{x(t)}
signals using the definition
0.5 0 0
Z ∞
X(jΩ) = xa (t) e−jΩt dt 0 −1 −2
−∞ 0 1 2 3 0 1 2 3 0 2 4
0.4 6 6
−3t
a) x1 (t) = e µ(t) 4 4
0.2
b) x2 (t) = e−j3t 2 2
0 0
−j3t j3t
c) x3 (t) = e +e 0
−10 0 10 −5 0 5 −5 0 5
Figure 48: Problem 36: Top row (a), (b), (c): signals x1 (t), x2 (t), and x3 (t), time t in x-
axis. Bottom row (d), (e), (f): corresponding CTFTs, amplitude spectra |X1 (jΩ)|, |X2 (jΩ)|,
[L0275] Solution: The continuous-time Fourier transform (CTFT) of a continuous-time
|X3 (jΩ)|, angular frequency Ω in x-axis. In case of real signals x(t) ∈ R the spectrum is
signal xa (t) is given by (Mitra 2Ed Eq. -, p. - / 3Ed Eq. 3.1, p. 118 ) below. The variable
symmetric around y-axis.
is the angular frequency Ω = 2πf ∈ R, in range −∞ < Ω < ∞.
Z ∞
Xa (jΩ) = xa (t) e−jΩt dt 37. Problem: Sketch the following signals in time-domain and their (amplitude) spectra in
−∞
frequency-domain.
a) Now x1 (t) = e−3t µ(t) ∈ R, see Figure 48(a). Note that the unit step function µ(t)
a) x1 (t) = cos(2π 500 t)
sets the low border of intergration to zero. See also (Mitra 2Ed Ex. -, p. - / 3Ed
Ex. 3.1, p. 118 ). b) x2 (t) = 4 cos(2π 200 t) + 2 sin(2π 300 t)
Z ∞ Z ∞ Z ∞ c) x3 (t) = e−j(2π 250t) + ej(2π 250t)
X1 (jΩ) = x1 (t) e−jΩt dt = e−3t e−jΩt dt = e−(3+jΩ)t dt d) x4 (t) = x1 (t) + x2 (t) + x3 (t)
−∞ 0 0
∞
.
1 1
= − e−(3+jΩ)t = − · 0−1 [L0271] Solution: The continuous-time Fourier transform (CTFT) decomposes the sig-
3 + jΩ 3 + jΩ
0
nal to its frequency components. Cosine and exponential function have a close relationship
1
= via Euler’s formula:
3 + jΩ cos(Ωt) = 0.5 · (ejΩt + e−jΩt )
b) Now x2 (t) = e−j3t ∈ C. The signal is complex-valued and runs clock-wise around Ideally, each real cosine component xi (t) = Ai cos(2πfi t + θi ) is a peak at frequency fi in
unit circle with angular frequency Ω = −3 (rad/s), see Figure 48(b). an one-sided spectrum or a peak pair at frequencies −fi and fi in a two-sided spectrum.
Z ∞ Z ∞ Z ∞ So, if the signal x(t) is real-valued, then the two-sided spectrum |X(jΩ)| is symmetric.
X2 (jΩ) = x2 (t) e−jΩt dt = e−j3t e−jΩt dt = e−j(3+Ω)t dt The amplitude Ai expresses how strong the cosine component is.
−∞ −∞ −∞
T-61.3010 DSP 2009 67/170 PROBLEMS – Part D 36-42 T-61.3010 DSP 2009 68/170 PROBLEMS – Part D 36-42
Time Domain Freq. Domain 38. Problem: Compute discrete-time Fourier transform (DTFT) for each of the following
5 4 sequences using the definition
∞
(a)
0 2 X
−5
X(ejω ) = x[n]e−jωn
0 n=−∞
0 0.005 0.01 0.015 0 200 400 600
5 4 a) x1 [n] = δ[n − 2]
b) x2 [n] = 0.5n µ[n]
(b)
0 2
−5 c) x3 [n] = a[n] · cos( π5 n), where a[n] is a real-valued sequence whose DTFT is A(ejω ).
0
0 0.005 0.01 0.015 0 200 400 600
5 4
[L0258] Solution: The discrete-time Fourier transform (DTFT) of sequence x[n] is de-
(c)
0 2 fined ∞
−5 X
0 0.005 0.01 0.015
0
0 200 400 600 X(ejω ) = x[n]e−jωn
4 n=−∞
5
(d)
0 2 a) x1 [n] = δ[n − 2]
−5 ∞
X ∞
X
0
0 0.005 0.01 0.015 0 200 400 600 X1 (ejω ) = x1 [n]e−jωn = δ[n − 2]e−jωn
time (s) freq. (Hz) n=−∞ n=−∞
−j2ω
Figure 49: Problem 37: Signals and their one-sided spectra (CTFT). = e
20
cos( n) = 0.5 · ej 5 n + e−j 5 n
20 5
0 0 Hence,
0 200 400 600 800 f (Hz) 0 200 400 600 800 f (Hz) ∞ ∞
X X π
X3 (ejω ) = x3 [n]e−jωn = a[n] cos( n)e−jωn
Figure 50: Remark in Problem 37. Discrete Fourier Transform (DFT) of the same signal (now 5
n=−∞ n=−∞
discrete-time x4 [n]) as in Figure 49(d): (a) signal components (200, 250, 300, 500 Hz) are ∞
X π
multiples of the frequency resolution f0 = 2000 Hz /40, (b) signal components are not any = 0.5
π
a[n] ej 5 n + e−j 5 n e−jωn
more multiples of f0 = 2000 Hz /41. Actually there are only four frequency components in n=−∞
the signal, but this cannot be observed in (b). Fourier component X4 [4] is highlighted in both X∞
π π
figures. In (a) its frequency is 4f0 = 200 Hz, while in (b) it is 4f0 ≈ 195 Hz. Dashed line is the = 0.5 a[n] e−j(ω− 5 )n + e−j(ω+ 5 )n
result of discrete-time Fourier transform (DTFT) where the frequency is continuous-valued. n=−∞
π π
= 0.5 A(ej(ω− 5 ) ) + A(ej(ω+ 5 ) )
where A(ejω ) is DTFT of a[n]. Signal a[n] is modulated with ω = π/5. In the
frequency domain the spectrum A(ejω ) is “copied” (and scaled) at normalized angular
frequencies ω = ±π/5. See Problem 39(a) for solving the same problem with the
transform table.
T-61.3010 DSP 2009 69/170 PROBLEMS – Part D 36-42 T-61.3010 DSP 2009 70/170 PROBLEMS – Part D 36-42
39. Problem: Consult the transform table and find the DTFTs of sequences
T-61.3010 DSP 2009 71/170 PROBLEMS – Part D 36-42 T-61.3010 DSP 2009 72/170 PROBLEMS – Part D 36-42
Figure 52: Problem 39(b): (a) xrect [n], a rectangular sequence, whose transform Xrect |N1 is
known, (b) x51 [n] = 2xrect [n − 1]|N1 =2 , which is a rectangle of height 2, of length 5, i.e., N1 = 2, 7.5π 8.5π 9.5π
and delayed by k = 1 from origo, (c) x52 [n] = xrect [n − 3]|N1 =2 , height 1, length 5, delay 3, and
(d) x5 [n] = x51 [n] + x52 [n]. Figure 53: |X(ejω )| of Problem 41.
40. Problem: Suppose that a real sequence x[n] and its discrete-time Fourier transform
(DTFT) X(ejω ) are known. The sampling frequency is fs . At normalized angular fre- [L0276] Solution: Discrete-time Fourier transform (DTFT) is always 2π-periodic:
quency ωc = π/4: X(ej(π/4) ) = 3 + 4j. Determine ∞ ∞
X X
X(ej(ω+2πk) ) = x[n] e−j(ω+2πk)n = x[n] e−jωn e|−j2π kn jω
{z } = X(e )
a) |X(ej(π/4) )| b) ∠X(ej(π/4) )
n=−∞ n=−∞ =1
j(−π/4) j(π/4+2π)
c) X(e ) d) X(e )
The spectrum in range (7.5π . . . 9.5π] can be repeated. Borders correspond 7.5π−(2·4)π =
e) If fs = 4000 Hz, what is fc
−0.5π and 9.5π − (2 · 4)π = 1.5π. When origo taken as a central point, it can be seen
that the spectrum is symmetric around y-axis. See Figure 54.
[L0257] Solution: The discrete-time Fourier transform (DTFT) is always 2π-periodic:
∞
X ∞
X
X(ej(ω+2πk) ) = x[n] e−j(ω+2πk)n = x[n] e−jωn e|−j2π kn jω
{z } = X(e )
n=−∞ n=−∞ =1 6π 7π 7.5π 8π 9π 9.5π 10 π
Complex-valued DTFT can be considered in polar coordinates −2 π −π 0π π 2 π
jω )
X(ejω ) = |X(ejω )| · ej∠X(e Figure 54: Problem 41: Discrete-time spectrum is periodic with 2π. The bottom label line is
z = r · ejθ shifted by 8π. The two-sided spectrum in range (−π . . . π] in a dashed rectangle.
where |X(ejω )| is (amplitude) spectrum and ∠X(ejω ) phase spectrum. In case of a real valued sequence x[n] the following symmetry relations hold (Mitra 2Ed
Sec. 3.1.4, p. 127 / 3Ed Sec. 3.2.3, p. 128 ):
The value of DTFT was given at ωc = π/4 : X(ej(π/4) ) = 3 + 4j.
X(ejω ) = X ∗ (e−jω )
a) |X(ej(π/4) )| = 5
Xre (ejω ) = Xre (e−jω )
b) ∠X(ej(π/4) ) = arctan(4/3) ≈ 0.927
Xim (ejω ) = −Xim (e−jω )
c) X(ej(−π/4) ) = 3 − 4j |X(ejω )| = |X(e−jω )|
d) X(ej(π/4+2π) ) = 3 + 4j ∠X(ejω ) = −∠X(e−jω )
e) Normalized angular sampling frequency is ωs = 2π. The interesting frequency can
be obtained from the ratio (ωc /ωs ) = (fc /fs ). If the sampling frequency fs = 4000 Equivalently, because now our magnitude spectrum is symmetric (|X(ejω )| = |X(e−jω )|),
Hz, then then x[n] ∈ R. For real sequences x[n] it is normal to draw the spectrum only in range
4000 Hz · (π/4) ω ∈ [0 . . . π], as in Figure 55.
fc = = 500 Hz.
2π
0 π
Figure 55: Problem 41: One-sided spectrum.
T-61.3010 DSP 2009 73/170 PROBLEMS – Part D 36-42 T-61.3010 DSP 2009 74/170 PROBLEMS – Part D 36-42
42. Problem: A LTI filter is characterized by its difference equation c) Recall, that any complex number
√ z can be represented in the polar coordinate system
as z = r · ejθ , where r = | z| and θ = ∠z = arctan Imag(z)/Real(z).
y[n] = 0.25x[n] + 0.5x[n − 1] + 0.25x[n − 2] jω
The frequency response H(e ) can be expressed by its amplitude response (= mag-
a) Draw the block diagram nitude response) |H(ejω )| and the phase response ∠H(ejω ) (Mitra 2Ed Sec. 4.2.1 /
b) What is the impulse response h[n] 3Ed Sec. 3.8.1 )
jω
P −jωk
P pk e−jωk
H(ejω ) = |H(ejω )| · ej∠H(e )
c) Determine the frequency response H(ejω ) = dk e
jω Now using the expression above,
d) Determine the amplitude response |H(e )|
e) Determine the phase response ∠H(ejω ) 0.25 + 0.5e−jω + 0.25e−j2ω
H(ejω ) =
f) Determine the group delay τ (ω) = − d∠H(e
jω )
1
dω
In this particular case, when h[n] is symmetric around nc = 1, we can take e−jω·nc as
[L0277] Solution: LTI system can be characterized by a linear constant coefficient dif- a common factor, utilize Euler’s formula, and write the frequency response as follows
ference equation of form (Mitra 2Ed Sec. 4.2.7, 4.2.6 / 3Ed Sec. 3.8.3, 3.9.1 )
H(ejω ) = 0.25 + 0.5e−jω + 0.25e−j2ω
X X
dk y[n − k] = pk x[n − k] = e−jω 0.25ejω + 0.5 + 0.25e−jω
k k
and its corresponding frequency response can be derived by Fourier transform (a · x[n − = e−jω 0.5 cos(ω) + 0.5
k] ↔ a · e−jωk X(ejω )) or directly
P d) Recall that absolute value of product A and B is the same as product of absolute
pk e−jωk
H(ejω ) = Pk values A and B: |A · B| = |A| · |B|.
−jωk
k dk e When computing values for the amplitude response in range [0 . . . π] we will get the
Finite-length sequences with certain geometric symmetry have an important role in digital curve which says if the filter is lowpass / highpass / bandpass / bandstop
signal processing (Mitra 2Ed Sec. 4.4.3 / 3Ed Sec. 5.5.2 ). A length-N sequence is said
to be symmetric if |H(ejω )| = |e−jω | · | 0.5 cos(ω) + 0.5 | = |0.5 cos(ω) + 0.5|
x[n] = x[N − 1 − n] | {z }
=1
and a length-N sequence is said to be antisymmetric if
The amplitude response is plotted in Figure 56(b).
x[n] = −x[N − 1 − n] e) Recall that angle of product A and B is the same as sum of angles of A and B:
For example, x1 [n] = {−2, 3, −2} is symmetric around nc = 1, and x2 [n] = {1, −2, 2, −1} ∠(A · B) = ∠A + ∠B.
is antisymmetric around nc = −0.5. Now, in this case when h[n] is finite-length and symmetric, the phase response can
Remark. If the length of the impulse response h[n] is N + 1, then the order of filter is be expressed easily in closed form (Mitra 2Ed Sec. 4.4.3 / 3Ed Sec. 7.3 )
N. For instance, two-point moving average y[n] = 0.5 · x[n] + x[n − 1] , whose impulse
∠H(ejω ) = ∠e−jω + ∠ 0.5 cos(ω) + 0.5 = −ω
response h[n] = 0.5 · δ[n] + δ[n − 1] is of length 2, and has the frequency response
H(ejω ) = 0.5 · 1 + e−jω , which is 1st order filter according to the order of the polynomial | {z }
=0
of ejω . There is a risk of confusing length and order, because N is typically used for both
of them. The phase response is linear and plotted in Figure 56(c).
a) The block (flow) diagram of the filter with the difference equation y[n] = 0.25x[n] + f) In case of linear phase response, the group delay is constant for all frequencies (Mitra
0.5x[n − 1] + 0.25x[n − 2] is drawn in Figure 56(a). There is no feedback loops in 2Ed Sec. 4.2.6 / 3Ed Sec. 3.9 ). That is, all frequency components are delayed by
the system, i.e., there is no delayed y[n − k] terms in the difference equation. Hence, the same amount (of time). In this case the output sequence is delayed by 1 in the
the system is FIR. filter.
d
τ (ω) = − ∠H(ejω ) = 1
b) The impulse response h[n] is computed by assigning x[n] ← δ[n], which gives in the dω
output y[n] = 0.25δ[n] + 0.5δ[n − 1] + 0.25δ[n − 2]. Because the system response to
an impulse is called the impulse response, we write
h[n] = 0.25δ[n] + 0.5δ[n − 1] + 0.25δ[n − 2]
The length of the impulse response is L{h[n]} = 3 < ∞. So, the system is FIR
(= Finite P
(length) Impulse Response). While h[n] is of finite length, the stability
condition n |h[n]| always converges and therefore FIR filters are always stable.
T-61.3010 DSP 2009 75/170 PROBLEMS – Part E 43-49 T-61.3010 DSP 2009 76/170 PROBLEMS – Part E 43-49
x[n] y[n] 1
Amplitude response 0
Phase response
a) The one-sided spectrum of a sinusoidal signal is a peak at corresponding frequency.
0.25 Thus, the spectral components are a peak at 10 Hz with relative height of 1 and
0.8 −1
D another peak at 90 Hz with height of 0.8. This is sketched in Figure 58. X(jΩ) can
0.6
x[n−1]
0.5
−2 be computed via continuous-time Fourier transform (CTFT), where the spectrum
0.4
D −3
X(jΩ) is not periodic, see Problem 37.
0.2
x[n−2] 0.25
0 −4
0 0.5 1 0 0.5 1 |X(j Ω )|
Figure 56: Problem 42: (a) block diagram, (b) amplitude response |H(ejω )|, (c) phase response
∠H(ejω ), which in this case is linear because of symmetric properties of finite-length h[n]. x-axis
in (b) and (c) ω/π, y-axis in (b) linear and in (c) radians. f
10 50 90 100 150 (Hz)
0
component is aliased down to exactly 10 Hz, t ← n/100:
−1
0 0.02 0.04 0.06 0.08 0.1
1 cos(2π90(n/100)) = cos(1.8πn) = cos(−0.2πn) = cos(2π10(n/100))
x2(t)
−1 see more examples in Problem 47. The same can be found in frequency-domain either
0 0.02 0.04 0.06 0.08 0.1
2
by copying the base band (0 . . . fT /2) spectrum at each multiple of fT (Problem 46)
or by flipping each component down to the base band (Problem 48).
x(t)
0
The ideal reconstruction returns the base band (corresponding 0 . . . π) back to analog
−2
0 0.02 0.04 0.06 0.08 0.1 domain. In the reconstructed spectrum Xr (jΩ) there is only one peak at 10 Hz,
Figure 57: Problem 43: Sinusoidal components x1 (t) and x2 (t) and their sum x(t). which corresponds one single sinusoidal, see the dash curves in bottom subfigures of
Figure 59.
[L0422] Solution: The signal x(t) consists of two sinusoidals whose frequencies can be
computed from Figure 57. We see that the period of x1 (t) is T1 = 0.1 s, and it oscillates
10 times a second, that is, f1 = 10 Hz. There are 9 oscillations of x2 (t) in 0.1 seconds,
i.e., T2 = 0.0111 . . . s, and 90 periods a second, f2 = 90 Hz. Amplitudes can be read from
the extreme points, A1 ≈ 1 and A2 ≈ 0.8. The phase shifts θi can also be approximated
if needed.
We can compute the fundamental frequency f0 of the signal x(t) by finding greatest
common divisor (GCD) of f1 = 10 and f2 = 90. That is f0 = 10 Hz, because f1 = 1 · f0
and f2 = 9 · f0 , see Problem 20.
T-61.3010 DSP 2009 77/170 PROBLEMS – Part E 43-49 T-61.3010 DSP 2009 78/170 PROBLEMS – Part E 43-49
p(t) T cn
1 1
x1(t)
x1(t)
0 0 1/T
−1 −1
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1 ... ... ... ...
1 1
x2(t)
x2(t)
0 0
t −2 −1 0 1 2 3 4 n
−1 −1
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
2 2 Figure 60: Problem 44: impulse train p(t) left, and its Fourier series coefficients cn right.
x(t)
x(t)
0 0
−2 −2
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
45. Problem: Impulse train in Problem 44 can be also expressed as a Fourier transform
Figure 59: Problem 43: Sinusoidal components x1 (t), x2 (t), their sum x(t), and corresponding
∞
sampled sequences x1 [n], x2 [n], x[n]. The amplitude of x[n] depends on the phases θi . The 2π X
dash curve in bottom is reconstructed analog signal xr (t). P (jΩ) = δ(Ω − k Ωs )
Ts k=−∞
T-61.3010 DSP 2009 79/170 PROBLEMS – Part E 43-49 T-61.3010 DSP 2009 80/170 PROBLEMS – Part E 43-49
P (jΩ) , which finally gives 46. Problem: Suppose that a continuous-time signal x(t) and its spectrum |X(jΩ)| in Fig-
Z ure 62 are known.
∞
1 1
P (jΩ) ⊛ X(jΩ) = P (jθ)X(j(Ω − θ))dθ
2π 2π −∞ |X(j Ω)|
Z∞ ∞
1 2π X 1
= δ(θ − kΩs )X(j(Ω − θ))dθ
2π
−∞ Ts k=−∞
∞ Z ∞ Z
1 X
= δ(θ − kΩs )X(j(Ω − θ))dθ | δ(t)x(t)dt = x(t)|t=0 fh
Ts k=−∞ −∞
∞ Figure 62: Spectrum X(jΩ) in Problem 46.
1 X
= X(j(Ω − kΩs ))
Ts k=−∞
The highest frequency component in the signal is fh . The signal is sampled with frequency
In other words, the spectrum X(ejω ) of the discrete-time signal x[n] can be obtained fs , i.e. the interval between samples is Ts = 1/fs : x[n] = x(nTs ). Sketch the spectrum
by summing the shifted spectra X(jΩ) of the corresponding analog signal x(t). Spectra |X(ejω )| of the discrete-time signal, when
X(jΩ) are scaled by (1/Ts ) and copied at every sampling (angular) frequency.
a) fh = 0.25 fs
P(jW) X(jW) (1/T) P(jW) * X(jW) b) fh = 0.5 fs
2pi/T c) fh = 0.75 fs
... ... ... ...
−2 0 2 4 W W −2 0 2 4 W [L0416] Solution: The spectrum X(jΩ) of a real analog signal is symmetric around y-axis.
Figure 61: Problem 45: Left, an example of a spectrum P (jΩ) of an impulse train, middle, a When sampling, the spectrum X(ejω ) is 2π-periodic (corresponds sampling frequency fs )
spectrum X(jΩ) of an arbitrary signal, and their convolution in right. Notice that X(jΩ) is ∞
1 X
not symmetric, which means that x(t) is complex-valued. x[n] = xp (nTs ) = x(t)p(t) ↔ X(ejω ) = Xp (jΩ) = X(j(Ω − kΩs ))
Ts k=−∞
|Xp (j Ω)|
1/T_s
fh f s /2 fs
|X p(j Ω )|
1/T_s
fh
f s /2 fs 2f s
Figure 64: fh = 0.5 fs , critical sampling in Problem 46(b).
c) Figure 65. Aliasing takes place. X(ejω ) is the sum of all folded analog spectra. The
spectrum X(ejω ) is depicted in Figure 65 with a thick continuous line.
1
X(ejω ) = ... + X(j(Ω − Ωs )) + X(jΩ) + X(j(Ω + Ωs )) + ...
Ts
T-61.3010 DSP 2009 81/170 PROBLEMS – Part E 43-49 T-61.3010 DSP 2009 82/170 PROBLEMS – Part E 43-49
47. Problem: Consider a continuous-time signal are frequencies over the Nyquist frequency in the original signal, those frequencies are
aliased into low frequencies.
cos(2πf1 t) + cos(2πf2 t) + cos(2πf3 t), t ≥ 0
x̃(t) = In this problem X(jΩ) is sampled with three different sampling frequencies fs of 1600 Hz,
0, t<0
800 Hz and 400 Hz, The Nyquist frequency is the half of the sampling frequency fs /2,
where f1 =100 Hz, f2 =300 Hz and f3 =750 Hz. The signal is sampled using frequency fs . 800 Hz, 400 Hz, and 200 Hz, respectively. Let fm (in this case 750 Hz) be the biggest
Thus, a discrete signal x[n] = x̃(nTs ) = x̃(n/fs ) is obtained. frequency found in the input signal. If the sampling frequency is less than 2fm = 1500
Hz, then there will be aliasing.
Sketch the magnitude of the Fourier spectrum of x[n], the sampled signal, when fs equals
to (i) 1600 Hz (ii) 800 Hz (iii) 400 Hz. In the following figures for i, ii and iii, the scale and magnitude values for aliased frequen-
cies are not exactly correct. Phase shifts in input signal cause that a pure addition of
Use an ideal reconstruction lowpass filter whose cutoff frequency is fs /2 for each case.
magnitudes will not hold. (The sum of two cosines with same frequency and phase shift
What frequency components can be found in reconstructed analog signal xr (t)?
of π is zero. However, in practice, this is rarely significant.)
[L0417] Solution: There is a continuous-time signal i) fs = 1600 Hz, highest frequency component fm = 750 Hz. The inequality 1600 >
2 · 750 holds, hence, there is no aliasing. All three frequencies can be recovered. See
x(t) = cos(2πf1 t) + cos(2πf2 t) + cos(2πf3 t) Figure 66.
Let f1 = 100 Hz, f2 = 300 Hz and f3 = 750 Hz. fs = 1600 Hz
2
x(t)
It is possible directly to express the Fourier transform of a periodic signal using transform 0
−2
|X a (jw)| 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
pairs (or see Page 78). In this case using frequencies f and a constant A
x(t).p(t)
2
0
−2
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
X(f ) = A · δ[f + 750] + δ[f + 300] + δ[f + 100] + δ[f − 100] + δ[f − 300] + δ[f − 750] 2
x[n]
200 600 w (f, Hz) 0
fs /2 −2
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
reconst.
|X p (jw)| 2
2
xr(t)
n f1 f2 f3 0
x[n] = x(nT ) = x( ) = cos(2π n) + cos(2π n) + cos(2π n) 200 600 1000 w (f, Hz) −2
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
fs fs fs fs
In the frequency domain the discrete-time spectrum Gp (jΩ) can be seen as a sum of shifted Figure 66: Sampling in Problem 47(i) with sampling frequency 1600 Hz: original analog spec-
and scaled replicas of the analog spectrum Ga (jΩ) as shown in Problems 45 and 46 (Mitra trum X(jΩ) (left top), and spectrum X(ejω ) of the discrete-time signal (left bottom). Time
2Ed Eq. 5.9, p. 302 / 3Ed Eq. 4.10, p. 174 ): domain view (right), top down x(t), sampling x(t) · p(t) sampled sequence x[n] to be processed
with DSP, reconstruction, and reconstructed continuous-time signal xr (t). Again, in this case
∞
1 X no aliasing, i.e. x(t) ≡ xr (t).
Gp (jΩ) = Ga (j(Ω − kΩT ))
T
k=−∞
Alternatively, sampling can be considered as flipping the analog spectrum around each ii) fs = 800 Hz, highest frequency component fm = 750 Hz. The inequality 800 > 2 ·750
half of the sampling frequency down to the band 0 . . . fs /2. does not hold, hence, there is aliasing. All frequencies over 400 Hz are missed (750 Hz
in this case); they cannot be observed. There is a new alias component at frequency
Reconstruction means converting a digital sequence back to analog signal. An ideal 50 Hz. See Figure 67.
lowpass filter with the passband up to half of the sampling frequency is used. When
Before going further, there is a short demonstration on the aliasing signal component
reconstructing signals we can only observe frequencies up to Nyquist frequency.2 If there
x3 (t) (fi = 750 Hz) of the signal x(t) in Figure 68. The figures are depicted in
2
There is variation in using “Nyqvist frequency” in the literature. It is either (1) half of the sampling time-domain: (a) original x(t) with period T = 1/f = (1/750) = 1.333 ms, (b)
frequency (Mitra 2Ed p. 302 / 3Ed p. 174 ) or (2) the highest frequency in the signal (Mitra 2Ed p. 304 / 3Ed samples x[n] using interval Ts = 1/fs = (1/800) = 1.250 ms, (c) reconstructed
p. 176 ). The first one is much more common. The reader should not confuse with this. signal x3r (t), whose period Tr = (1/50) = 20 ms. The same aliasing effect can be
shown using the cosine function, which is 2π-periodic (cos(ωn) ≡ cos(ωn + 2π)) and
|X p(j Ω )| even (cos(−ωn) ≡ cos(ωn)). The highest component x3 (t) of 750 Hz aliases in the
1/T_s sampling and reconstructing process to 50 Hz:
fh
f s /2 f s 2f s 3f s
Figure 65: fh = 0.75 fs , aliasing in Problem 46(c).
T-61.3010 DSP 2009 83/170 PROBLEMS – Part E 43-49 T-61.3010 DSP 2009 84/170 PROBLEMS – Part E 43-49
fs = 800 Hz fs = 400 Hz
2 2
x(t)
x(t)
0 0
−2 −2
|X a (jw)| 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02 |X a (jw)| 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
x(t).p(t)
x(t).p(t)
2 2
3 2 1 1 2 3 0 3 2 1 1 2 3 0
−2 −2
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
2 2
x[n]
x[n]
reconst.
|X p (jw)| 2
0 2 2 2 2 2
0
3 3 2 1 3 3 1 2 −2 3 3 3 3 −2
2 1 1 2 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02 1 1 1 1 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
2 2
xr(t)
xr(t)
0 0
200 600 1000 w (f, Hz) −2 200 600 1000 w (f, Hz) −2
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
Figure 67: Sampling in Problem 47(ii) with sampling frequency 800 Hz. Aliasing occurs, Figure 69: Sampling in Problem 47(iii) with sampling frequency 400 Hz. Aliasing occurs again,
x(t) 6= xr (t), compare the top and bottom axis in the figure right. x(t) 6= xr (t).
48. Problem: Real analog signal x(t), whose spectrum |X(jΩ)| is drawn in Figure 70, is
sampled with sampling frequency fs = 8000 Hz into a sequence x[n].
x3 (t) = cos(2π 750t) | original: 750 Hz
x3 [n] = x3 (n/fs ) = cos(2π(750/800)n) = cos(2π(750/800)n − 2πn) | 2π-periodicity a) In the sampling process aliasing occurs. What would have been smallest sufficient
= cos(2π(−50/800)n) = cos(2π(50/800)n) | even function sampling frequency, with which no aliasing would not happen?
x3r (t) = cos(2π 50t) | reconstructed: 50 Hz b) Analog signal x(t) is 0.2 seconds long. How many samples are there in the sequence
x[n]?
1
c) Sketch the spectrum |X(ejω )| of sampled sequence x[n].
x (t)
T=(1/750)=1.33ms
0
3
−1 d) Sequence x[n] is filtered with a LTI system, whose pole-zero plot is shown in Fig-
1
ure 70. After that filtered sequence y[n] is reconstructed (ideally) to continuous-time
x[n]
0
−1
yr (t). Sketch the spectrum |Yr (jΩ)| in range f = [0 . . . 20] kHz.
1
x (t)
0
3r
1
−1
0 2 4 6 8 10 12 14 16 18 20 t (ms) |X(jΩ)|
0.5
Figure 68: Problem 47(ii): Demonstration of aliasing of a single cosine. In top figure there is
a continuous cosine x3 (t) = cos(2π750t) whose period is T = 1/750 s ≈ 1.33 ms. Cosine is 0
21
sampled with fs = 800 Hz, i.e., Ts = 1/800 s = 1.25 ms. The sampling rate is too small in
order to capture the cosine of 750 Hz, because 750 Hz > (800/2) Hz. The sampled sequence −0.5
x3 [n] is plotted in middle figure. Then the sequence is ideally reconstructed back to analog,
that is, “slowest” possible cosine which fits the samples. In bottom figure 50 Hz cosine x3r (t) = 4 8 f (kHz) −1
−1 −0.5 0 0.5 1
cos(2π50t) is plotted. Hence, cosine of 750 Hz is folded down (aliased) to 50 Hz. Note that any
cosine x(t) = cos(2π(±50+k ·fs )t), k ∈ Z goes through the points x3 [n] = cos(2π(50/8000)n) =
Figure 70: Problem 48: Spectrum left. Pole-zero plot right.
cos((1/80)πn).
iii) fs = 400 Hz, highest frequency component fm = 750 Hz. The inequality 400 > 2 ·750
[L0419] Solution: The Shannon (Nyqvist) sampling theorem is discussed in (Mitra 2Ed
does not hold, hence, there is aliasing. All frequencies over 200 Hz are missed (300
Sec. 5.2, p. 302 / 3Ed Sec. 4.2, p. 176 ).
and 750 Hz). There are new alias components at 50 and 100 Hz. See Figure 69.
750
cos(2π 400 n) = cos(2π 750
400
n − 4πn) = cos(2π −50
400
50
n) = cos(2π 400 n) a) The highest frequency component in the analog signal is fh = 9 kHz. Thus the
cos(2π 300
400
n) = cos(2π 300
400
n − 2πn) = cos(2π −100
400
100
n) = cos(2π 400 n) required sampling frequency would be fT = 2fh = 18 kHz.
After ideal reconstruction (x[n] → xr (t)) there are the following components left:
b) The sampling frequency is 8 kHz, which means that there are 8000 samples each
(i) original 100, 300, 750 Hz.
second. Now
(ii) original 100, 300 Hz, and an alias 50 Hz. x 8000
=
(iii) original 100 Hz, and aliases 50, 100 Hz. 0.2 s 1s
There is a sampling (aliasing) demo demosampling.m in the course web pages. gives 1600 samples for 0.2 seconds.
T-61.3010 DSP 2009 85/170 PROBLEMS – Part E 43-49 T-61.3010 DSP 2009 86/170 PROBLEMS – Part E 43-49
c) Due to too low sampling frequency aliasing occurs. All frequency components above |Y(e jω)| |Y(j Ω)|
fT /2 = 4 kHz are aliased into low frequencies between 0 . . . 4 kHz. Sampling in the
frequency domain can be considered as copying the original analog spectrum at each
multiple of the sampling frequency (Mitra 2Ed Eq. 5.9, p. 302 / 3Ed Eq. 4.10, p. 4 8 f (kHz) 4 8 12 f (kHz) 20
174 )
1 X
∞
Figure 72: Problem 48: (a) Spectra |Y (e )| and (b) |Yr (jΩ)|. Discrete-time spectrum |Y (ejω )|
jω
Gdiscrete (jΩ) = Ganalog (j(Ω + kΩT )) is periodic every 2π (or every fT ), wheras continuous-time spectrum |Yr (jΩ)| is not periodic.
T k=−∞
Scaling factors are not taken into account.
Here we show another way of finding the discrete-time spectrum. If the analog signal
is real-valued and the amplitude spectrum therefore symmetric around y-axis, the
sampling can also be thought as flipping each fT /2 wide band of the analog spectrum 49. Problem: Suppose that there is an analog signal which will be sampled with 8 kHz. The
downwards into the fundamental range 0 . . . fT /2. interesting band is 0 . . . 2 kHz. Sketch specifications for an anti-aliasing filter. Determine
First, divide the spectrum to a set of bands, whose width is fT /2. In this case we the order of the filter when using Butterworth approximation and minimum stopband
have B0 = [0 . . . 4000) Hz, B1 = [4000 . . . 8000) Hz, and B2 = [8000 . . . 12000) Hz. attenuation is 50 dB. The variables in Table 7: Ωp is the passband edge frequency (in-
Flip the band B2 around 8000 Hz (mirror) down to B1 . Spectral components of B1 teresting part), ΩT is the sampling frequency, and Ω0 is the frequency after which the
and the mirrored B2 are summed together. See Figure 71 left top. aliasing components are small enough.
Finally, the band B1 is mirrored around 4000 Hz down to the fundamental band B0 , Ω0 = 2Ωp 3Ωp 4Ωp
and the spectral components are summed together. See Figure 71 left bottom and Attenuation (dB) 6.02N 9.54N 12.04N
the final result in Figure 71 right. Scaling factors (height) are here ignored. ΩT = 3Ωp 4Ωp 5Ωp
P P
To be exact, Gdiscrete = a k Ganalog,k is different from |Gdiscrete | = a k |Ganalog,k |,
and therefore the procedure with amplitude spectra |X| shown in Figure 71 does not Table 7: Approximate minimum stopband attenuation of a Butterworth lowpass filter (Mitra
hold. However, in practice (and in any DSP book) this can be considered as a good 2Ed Table 5.1, p. 336 / 3Ed Table 4.1, p. 210 ). See the text in Problem 49 for details.
approximation.
B0 B1 B2 |X(e jω)|
[L0418] Solution: An is an analog lowpass filter used in order to remove components,
which cause aliasing when sampling (Mitra 2Ed Sec. 5.6 / 3Ed Sec. 4.6 ). Consider an
analog signal x(t) and its spectrum X(jΩ) depicted in Figure 73.
B0
4
B1
8 12
|X(j Ω)|
|X|
4 8 12 4 8 f (kHz)
Figure 71: Problem 48: (a) Two steps when mirroring spectral bands down to the fundamental f
band 0 . . . 4 kHz. (b) Discrete-time spectrum |X(ejω )|. Scaling factors are ignored. 2 4 6 8 kHz
Figure 73: Spectrum X(jΩ) in Problem 49.
d) If pole-zero plots are not familiar, consult (Mitra 2Ed Sec. 4.3.4 / 3Ed Sec. 6.7.4 )
or Problem 54, p. 96. In the following, notations of (Mitra 2Ed Fig. 5.28 / 3Ed Fig. 4.34 ) are used, Ωp for
The sampling frequency is 8 kHz. In the pole-zero plot the whole circle 2π corre- passband edge frequency, Ω0 = ΩT −Ωp for stopband edge frequency, and ΩT for sampling
sponds 8 kHz. The upper part of the circle from ω = 0 to ω = π is 0 . . . 4 kHz. frequency. Now that the interesting band stops at Ωp = 2 kHz and the sampling frequency
There are zeros on the unit circle from 2 . . . 4 kHz. Hence, the filter is a lowpass is ΩT = 8 kHz, we can set the edge frequency for the stopband to be at Ω0 = (8 − 2) = 6
filter, whose cut-off frequency is about at 2 kHz. kHz (see Figure 74). After sampling there will be aliasing components in 2 . . . 4 kHz, but
The discrete-time signal x[n] is filtered with a lowpass filter. Here we use a rough we are not interested in them, i.e. we use digital filtering for that band.
approximation of the filter depicted with a pole-zero plot, an ideal lowpass filter
When the specifications are not so tight as they normally (cut-off at 4 kHz) are, also the
H(ejω ) with cut-off at 2 kHz. The spectrum of filtered signal is Y (ejω ) = H(ejω ) ·
order of the anti-aliasing filter is lower. The design of the anti-aliasing filter can be made
X(ejω ) shown in Figure 72(a). Note! Filter with zeros like in Figure 70 is not ideal.
even easier by increasing sampling frequency with analog circuits (order of anti-aliasing
You can plot its real amplitude response using Matlab.
filter decreases), and afterwards decrease sampling frequency using multirate techniques
After reconstructing ideally (ideal lowpass filter with cut-off at fT /2) the sequence (Mitra 2Ed Sec. 10 / 3Ed Sec. 13 ).
y[n] back to analog yr (t), the spectrum |Yr (jΩ)| is plotted in in Figure 72(b).
T-61.3010 DSP 2009 87/170 PROBLEMS – Part E 43-49 T-61.3010 DSP 2009 88/170 PROBLEMS – Part F 50-52
|X| 50. Problem: The exponent term in DFT/IDFT is commonly written WN = e−j2π/N .
components that would alias in 0 . . . 2 kHz without anti-aliasing filtering (gray). (IDFT), right, using N points are defined with WN = e− N as
N
X −1
X[k] = x[n]WNkn
Calculations using (Mitra 2Ed Table 5.1 / 3Ed Table 4.1 ) or Table 7: Ω0 /Ωp = 3 → N = n=0
⌈50/9.54⌉ = 6. Note that if the passband ended at 2 kHz and the stopband started at 4 N −1
1 X
kHz, the required order of the filter would be 10. x[n] = X[k]WN−kn
N k=0
DFT is discrete both in time and frequency, and can be calculated directly using com-
puters. For example, in Matlab a spectrum of a signal is computed in discrete frequency
points X[k], but so densely, that it seems to be continuous X(ejω ).
j2π
a) WN = e− N , now N = 3.
j2π
W30 = e− 3
·0
=1
√
− j2π 3
W31 = e 3
·1
= −0.5 − j
√2
j2π 3
W32 = e− 3
·2
= −0.5 + j
2
Notice that the exponent in WN defines the uniform angle jump in clockwise direc-
j2π j2π j2π
tion. WN is periodic with every N, e.g. W32·2 = W34 = e− 3 ·4 = e|−{z3 ·3} ·e− 3 ·1 =
=1
W31 . We can compute values of W3kn , when k = 0 . . . 2 and n = 0 . . . 2 into a table
below
k, n 0 1 2
(0·0) (0·1) (0·2)
0 W3 = W30 W3 = W30 W3 = W30
(1·0) (1·1) (1·2)
1 W3 = W30 W3 = W31 W3 = W32
(2·0) (2·1) (2·2)
2 W3 = W30 W3 = W32 W3 = W31
T-61.3010 DSP 2009 89/170 PROBLEMS – Part F 50-52 T-61.3010 DSP 2009 90/170 PROBLEMS – Part F 50-52
X = DN x
T-61.3010 DSP 2009 91/170 PROBLEMS – Part F 50-52 T-61.3010 DSP 2009 92/170 PROBLEMS – Part F 50-52
51. Problem: Consider a sequence 52. Problem: Let h[n] and x[n] be two finite-length sequences given below:
x1 [n] = 2δ[n] + 8δ[n − 3] = {2, 0, 0, 8}
−3, for n = 0,
5, for n = 0,
4, for n = 1,
h[n] = 2, for n = 1, x[n] =
and its DFT-4
4, for n = 2 0, for n = 2,
2, for n = 3
X1 [k] = 10δ[k] + (2 + 8j)δ[k − 1] − 6δ[k − 2] + (2 − 8j)δ[k − 3] = {10, 2 + 8j, −6, 2 − 8j}
a) Determine the linear convolution yL[n] = h[n] ⊛ x[n].
Having a circular shift (delay) of one, x2 [n] = x1 [< n − 1 >4 ], what is the DFT X2 [k]? b) Extend h[n] to length-4 sequence he [n] by zero-padding and compute the circular
Here < . >N computes modulo N. convolution yC [n] = he [n] 4 x[n].
c) Extend both sequences to length-6 sequences by zero-padding and compute the cir-
[L0296] Solution: The circular shift of a sequence, see (Mitra 2Ed Sec. 3.4.1 / 3Ed Sec. cular convolution yC [n] = he [n] 6 xe [n]. Show that now yC [n] = yL [n]!
5.4.1, 5.7 ) and Problem 7(g), gives
x2 [n] = 8δ[n − 2] + 2δ[n − 3] = {0, 0, 8, 2} [L0270] Solution: In this problem linear convolution yL [n] (Mitra 2Ed Sec. 2.5.1 / 3Ed
Sec. 2.5.1 ) and circular convolution yC [n] (Mitra 2Ed Sec. 3.4.2 / 3Ed Sec. 5.4.2 ) are
Instead of computing DFT again we are appling circular time-shifting which has a DFT computed using sequences h[n] = {5, 2, 4} and x[n] = {−3, 4, 0, 2}.
pair in (Mitra 2Ed Table 3.5, p. 141 / 3Ed Table 5.3, p. 264 ) Linear convolution y[n] = h[n] ⊛ x[n] can be computed using “flip and slide” method in
Figure 76(a). x[n] is flipped and at each n the items are multiplied and finally all summed
x[< n − n0 >N ] ↔ WN−k·n0 X[k]
together. In the figure, when n = 1, it gives yL[1] = h[0]x[1−0]+h[1]x[1−1]+h[2]x[1−2] =
where WN = e−j2π/N (typo error in 2nd Edition). 20 − 6 + 0 = 14.
Now we have N = 4 and n0 = 1. We compute the values X2 [k] = WN−k·n0 X1 [k] = Computation of circular convolution yC [n] = h[n] N x[n] can be illustrated with “a circular
W4−k X1 [k] in a table below. buffer” of length N in Figure 76(b) and (c). x[n] is flipped and at each n the items are
multiplied. There are always N terms to be added to get the result at n. In the figure,
k X1 [k] WN−kn0 X2 [k] when N = 4 and n = 1, it gives yC [1] = h[0]x[1] + h[1]x[0] + h[2]x[3] + h[3]x[2] =
0 10 W40 = 1 10 20 − 6 + 8 + 0 = 22.
1 2 + 8j W4−1 = j −8 + 2j
2 −6 W4−2 = −1 6 1 h[1] h[0] 0
2 5
3 2 − 8j W4−3 = −j −8 − 2j x[0] x[1]
k −3 −2 −1 0 1 2 3 −3 4 k −3 −2 −1 0 1 2 3
h[−3]h[−2] h[−1] h[0] h[1] h[2] h[3] k h[−3]h[−2] h[−1] h[0] h[1] h[2] h[3]
h[k] 0 0 0 5 2 4 0 h[k] 0 0 0 5 2 4 0
2 0
x[4] x[3] x[2] x[1] x[0] x[−1]x[−2] x[3] x[2] x[0] x[3] x[2] x[1] x[0] x[3] x[2]
4 0
x[1−k] 0 2 0 4 −3 0 0 2 h[2] h[3] 3 x[<1−k>4 ] −3 2 0 4 −3 2 0
Figure 76: Problem 52: Convolution depicted with “flip and slide” method, (a) left, linear
convolution, (b) right, circular convolution with N = 4. As an example, in both cases the
convolution sum is computed at n = 1.
P
a) Linear convolution: yL[n] = 2k=0 h[k]x[n−k]. Its length will be L{h[n]}+L{x[n]}−
1 = 6. Using “flip around and slide”:
yL [0] = h[0]x[0] = 5 · (−3) = −15
yL [1] = h[0]x[1] + h[1]x[0] = 5 · 4 + 2 · (−3) = 14
yL [2] = h[0]x[2] + h[1]x[1] + h[2]x[0] = 5 · 0 + 2 · 4 + 4 · (−3) = −4
yL [3] = h[0]x[3] + h[1]x[2] + h[2]x[1] = 5 · 2 + 2 · 0 + 4 · 4 = 26
yL [4] = h[1]x[3] + h[2]x[2] = 2 · 2 + 4 · 0 = 4
yL [5] = h[2]x[3] = 4 · 2 = 8
Therefore,
yL [n] = {−15, 14, −4, 26, 4, 8}
T-61.3010 DSP 2009 93/170 PROBLEMS – Part F 50-52 T-61.3010 DSP 2009 94/170 PROBLEMS – Part G 53-57
b) Circular convolution is computed in N = 4 points 53. Problem: Consider a LTI system depicted in Figure 77 with registers having initial
values of zero and the input sequence x[n] = (−0.8)n µ[n].
3
X
yC [n] = he [n] 4 x[n] = he [k]x[< n − k >4 ]
k=0
x[n] y[n]
z −1 z −1
where he [n] = {5, 2, 4, 0} is zero-extended version of h[n], and < n >4 is modulo-4 0.8 0.9
operation. Hence, h[< n − 5 >4 ] = h[< n − 1 >4 ], i.e. the sequence can be thought
to be periodic with the period {h[0], h[1], h[2], h[3]}.
z−1
yC [0] = he [0]x[< 0 − 0 >4 ] + he [1]x[< 0 − 1 >4 ] + −0.2
he [2]x[< 0 − 2 >4 ] + he [3]x[< 0 − 3 >4 ]
= he [0]x[0] + he [1]x[3] + he [2]x[2] + he [3]x[1]
= 5 · (−3) + 2 · 2 + 4 · 0 + 0 · 4 = −11 Figure 77: LTI system of Problem 53.
yC [1] = he [0]x[1] + he [1]x[0] + he [2]x[3] + he [3]x[2]
= 5 · 4 + 2 · (−3) + 4 · 2 + 0 · 0 = 22 a) What is the difference equation of the system?
yC [2] = he [0]x[2] + he [1]x[1] + he [2]x[0] + he [3]x[3] b) Compute X(z) using the definition of z-transform or consult the z-transform table.
= 5 · 0 + 2 · 4 + 4 · (−3) + 0 · 2 = −4 c) Apply z-transform to the difference equation. What is the transfer function H(z) =
yC [3] = he [0]x[3] + he [1]x[2] + he [2]x[1] + he [3]x[0] Y (z)/X(z)? Where are the constant multipliers of the system seen in Figure 77 in
difference equation and in transfer function? Hint: the z-transform of K w[n − n0 ]
= 5 · 2 + 2 · 0 + 4 · 4 + 0 · (−3) = 26
is K z −n0 W (z).
Thus, d) Now it is possible to compute the output y[n] without convolution in time-domain
yC [n] = {−11, 22, −4, 26} using the convolution theorem
c) Circular convolution using N = 6 points y[n] = h[n] ⊛ x[n] ↔ Y (z) = H(z) · X(z)
5
X Write down the equation for Y (z), use partial fraction expansion in order to achieve
yC [n] = he [n] 6 xe [n] = he [k]x[< n − k >6 ] rational polynomials of first order, and then use the inverse z-transform (equation
k=0 in (b)).
yC [n] = {−15, 14, −4, 26, 4, 8} ≡ yL[n] a) The input-output-relation is y[n] − 0.9y[n − 1] + 0.2y[n − 2] = x[n] + 0.8x[n − 1].
Notice that the coefficients in the diagram are also present in the difference equation
If N in circular convolution is chosen so that N ≥ L{yL [n]}, then yC [n] = yL[n]. (past output values maybe as opposite numbers).
b) If computing using the definition, see Problem 38(b). From the z-transform table
Remark. Circular convolution has a close connection to Discrete Fourier Transform directly:
(DFT). For example, in (b) 1
Z{an µ[n]} = ROC: |z| > |a|
yC [n] = he [n] 4 x[n] DFT-4 He [k] · X[k] = YC [k] IDFT-4 yC [n] 1 − az −1
−−−−→ −−−−−→ 1
(−0.8)n µ[n] ↔ |z| > 0.8
1 + 0.8z −1
−n0
c) Using the z-transform pair K · w[n − n0 ] ↔ K · z W (z):
y[n] − 0.9y[n − 1] + 0.2y[n − 2] = x[n] + 0.8x[n − 1] | z-transform
Y (z) − 0.9z −1 Y (z) + 0.2z −2 Y (z) = X(z) + 0.8z −1 X(z)
Y (z) 1 − 0.9z −1 + 0.2z −2 = X(z) 1 + 0.8z −1
1 + 0.8z −1
Y (z) = X(z) | /X(z)
1 − 0.9z −1 + 0.2z −2
1 + 0.8z −1
H(z) = Y (z)/X(z) = ROC: |z| > 0.5
1 − 0.9z −1 + 0.2z −2
T-61.3010 DSP 2009 95/170 PROBLEMS – Part G 53-57 T-61.3010 DSP 2009 96/170 PROBLEMS – Part G 53-57
The flow (block) diagram was given in direct form (DF) (Mitra 2Ed Sec. 6.4.1 / 54. Problem: Consider the pole-zero plots in Figure 78.
3Ed Sec. 8.4.1 ). The coefficients of the diagram are that of the difference equation
and transfer function. Coefficients in the loop (IIR subfilter) are in the denomi- a) What is the order of each transfer function?
nator polynomial and coefficients of the FIR part can be found in the numerator b) Are they FIR or IIR?
polynomial. c) Sketch the amplitude response for each filter.
d) Using convolution theorem d) What could be the transfer function of each filter?
Y (z) = H(z) · X(z)
1 + 0.8z −1 1 1 1 1
Imaginary Part
Imaginary Part
Imaginary Part
= ·
1 − 0.9z −1 + 0.2z −2 1 + 0.8z −1
1 4
= | partial fraction expansion 0 0 0
1 − 0.9z −1 + 0.2z −2
5 −4
= + | inverse z-transform
1 − 0.5z −1 1 − 0.4z −1 −1 −1 −1
y[n] = 5 · (0.5)n µ[n] − 4 · (0.4)n µ[n] −1 0 1 −1 0 1 −1 0 1
Real Part Real Part Real Part
[L0327] Solution: The z-transform of the impulse response h[n] of the LTI system is the
transfer function H(z) (with certain regions of convergence, ROCs, see Problem 56). It
can be written as a rational function in z −1 as follows
PM −k
B(z) b0 + b1 z −1 + b2 z −2 + . . . + bM z −M k=0 bk z
H(z) = = = PN
A(z) a0 + a1 z −1 + a2 z −2 + . . . + aN z −N k=0 ak z
−k
QM
(1 − z1 z −1 ) · (1 − z2 z −1 ) · . . . · (1 − zM z −1 ) −1
k=1 (1 − zk z )
= K · = K · QN
(1 − p1 z −1 ) · (1 − p2 z −1 ) · . . . · (1 − pN z −1 ) k=1 (1 − pk z )
−1
where bi are the coefficients of the numerator polynomial B(z), and ai are the coefficients of
the denominator polynomial A(z). The filter order , that is, order of H(z) is max{M, N}.
Those points zi where B(z) = 0 are called “zeros”, and points pi where A(z) = 0 are called
“poles”. The figure with zeros (circles) and poles (crosses) plotted in the complex plane
is called “pole-zero plot” (diagram) of the transfer function.
The rules of thumb for determining amplitude response from the pole-zero-diagram
(Mitra 2Ed Sec. 4.3.4 / 3Ed Sec. 6.7.4 )
1. Examine the frequencies ω ∈ (0 . . . π), in other words, the observation point moves on
the unit circle counterclockwise from (1, 0j) to (−1, 0j). In each point the amplitude
response |H(ejω )| is estimated. A “simple” function H(ejω ) has a smooth response.
2. The amplification is big, when a pole is close to unit circle (a small factor in de-
nominator) or a zero is far from unit circle. The closer the pole is to unit circle, the
narrower the amplification is in frequency area.
3. The amplification is small, when a pole is far from the unit circle (big factors in
denominator) or there is a zero close to unit circle.
4. The amplification is zero, if a zero is on the unit circle at observation frequency.
5. Poles or zeros in the origo do not affect at all because the distance is always 1.
T-61.3010 DSP 2009 97/170 PROBLEMS – Part G 53-57 T-61.3010 DSP 2009 98/170 PROBLEMS – Part G 53-57
6. The amplification cannot be found from pole-zero plot. Normally H(ejω ) is scaled 1 |H(e^jw)| 1
jω
0
|H (e )|
so that the maximum value is set to be 1: H(ejω ) ← H(ejω )/ max{|H(ejω )|}.
Imaginary Part
0.8 1
0.5 −20
1 20 log (|H (ej ω)|)
0.6 −40
10 1
0
dB
a) The order is the maximum of the number of poles or zeros (not in origo). −0.5
0.4
−60
0.2
So, (i) 2 poles, 1 zero: 2nd order; (ii) 4 zeros: 4th order; (iii) 6 poles, 6 zeros: 6th −1 0
−80
0
order. −1 0 1 0 0.5 1
−100
0 0.5 1
Real Part π/2 π ω*π ω*π
Note, in analog H(s) there are only poles, but in digital H(z) there can be both
poles and zeros. Figure 79: Problem 54(i): (a) Pole-zero-diagram, (b) an example of approximated amplitude
response, (c) actual amplitude response |H1 (ejω )| in linear scale, (d) actual amplitude response
b) If there is any pole (cross in the graph) outside the origo, it means that there is at |H1 (ejω )| in decibels.
least first-order polynomial in the denominator in H(z) ⇔ there is a feedback in the
system ⇔ IIR.
Hence, (i) IIR; (ii) FIR; (iii) IIR. linear-phase filter, see Problem 59. The minimum of |H(ejω )| ≈ 0.0114 (scaled) at
c) The analysis with graphs is done below for each case separately. ω ≈ 0.11π, which is different from π/6 estimated earlier. All “zero vectors” affect to
Shortly, (i) lowpass with narrow passband; (ii) highpass; (iii) a comb filter. the response, see the remark text below.
iii) Zeros are on the unit circle at uniform invervals forcing the amplification drop down
d) The transfer function can be constructed from zeros zi and poles pi
to zero, see Figure 80(right). This type of periodic filter is often called a comb filter.
QM −1 The maximum is scaled to one. Note that all poles and zeros affect, so that if there
k=1 (1 − zk z )
H(z) = K · QN were not exactly same intervals between poles and zeros, the amplitude response
k=1 (1 − p k z −1 )
would also turn out to be non-symmetric.
However, the scaling factor K cannot be seen from the pole-zero-plot. Therefore K
jω jω
is set so that max{|H(ejω )|} = 1. Problem 2 (ii)
|H2(e )|
Problem 2 (iii)
|H3(e )|
1 1 1 1
Next, a closer look at (c) and (d) is given for each filter.
Imaginary Part
Imaginary Part
0.5 0.5
4
0 0.5 0 0.5
i) Without computing any exact values of the amplitude response, it is possible to
−0.5 −0.5
approximate it by looking at the positions of zeros and poles. The angular frequency
−1 0 −1 0
gets values from 0 to π, and the observation is done on a unit circle counterclockwise. −1 0 1 −1 0 1
0 0.5 1 0 0.5 1
Real Part ω*π Real Part ω*π
Poles are close to unit circle at ω = ±π/30 in Figure 79(a). Therefore the amplitude
response gets the maximum approximately at that frequency and the filter is lowpass
type, see the sketch in Figure 79(b). The closer the poles are the unit circle, the Figure 80: Problem 54(ii),(iii): Pole-zero-diagram and corresponding amplitude response of
narrower the maximum area is. The value at ω = π is zero. |H2 (ejω )| left, and |H3 (ejω )| right.
In this case the exact locations of poles and zeros were known (z1 = −1, p1 =
0.8950 + 0.0947i, p2 = 0.8950 − 0.0947i). The actual transfer function is H(z) = Remark. Determining amplitude response from the pole-zero-diagram, theory in back-
K · (1 + z −1 )/(1 − 1.79z −1 + 0.81z −2 ) from which the actual frequency response is ground.
received by z ← ejω . Some values in range 0 . . . π are computed below, and K is Any transfer function H(z) can be expressed in form of
chosen so that the maximum of |H(z)| is one. Figures are plotted using Matlab in
both linear scale and in logarithmic scale in Figure 79(c) and (d), respectively. |p0 | (1 − z1 z −1 )(1 − z2 z −1 )...(1 − zM z −1 )
H(z) =
ω H(ejω ) |H(ejω )| ω H(ejω ) |H(ejω )| |d0 | (1 − p1 z −1 )(1 − p2 z −1 )...(1 − pN z −1 )
0 1 1 3π/4 −.0008 + .0023j .0025 In order to achieve this, all zeros (zi ) and poles (pi ) of H(z) has to be computed. Zeros
π/4 −.0277 + .0210j .0348 π 0 0 are the roots of the numerator polynomial and poles are the roots of the denominator
π/2 −.0049 + .0061j .0078 polynomial. Numerator part is “FIR part” (always stable, y[n] depends only on values of
ii) There are four zeros in Figure 80(left). At ω ≈ π/6 the zeros are closest to the x[n − ki ]), denominator is “IIR part” (feedback, in order to compute y[n] some old values
observation point, and the minimum of the response is probably reached (bandstop). of it has to be used).
At ω = π the zeros are much further away than at ω = 0, so the attenuation is much Frequency response is the transfer function computed on unit circle, i.e. substitution
stronger at low frequencies (highpass). Notice that |H(ej0)| = 6 0, because there is z = ejω :
not a zero on the unit circle at ω = 0. The filter can be a highpass or bandstop FIR |p0 | (1 − z1 e−jω )(1 − z2 e−jω )...(1 − zM e−jω )
H(ejω ) =
filter. |d0 | (1 − p1 e−jω )(1 − p2 e−jω )...(1 − pN e−jω )
Actually, H(z) = 1 − 3.753z −1 + 5.694z −2 − 3.753z −3 + z −4 . Filter coefficients have We are interested in amplitude response |H(ejω )|. Because the expression is in a product
a certain symmetry as well as the zeros lie in a certain symmetry, which implies a form, the absolute value of |H(ejω )| can be computed with its first order blocks. Let
T-61.3010 DSP 2009 99/170 PROBLEMS – Part G 53-57 T-61.3010 DSP 2009 100/170 PROBLEMS – Part G 53-57
K = |p0 |/|d0|, Bi be the length of a first order block in numerator polynomial, and Ai the 55. Problem: Consider the filter described in Figure 82.
length of a first order block in denominator polynomial:
x[n] y[n]
B B B
z }|1 { z }|2 { z M
}| { QM
|(1 − z1 e−jω )| |(1 − z2 e−jω )| . . . |(1 − zM e−jω )| Bk
|H(ejω )| = K · −jω −jω −jω = K · Qk=1
N -1 -1
|(1 − p1 e )| |(1 − p2 e )| . . . |(1 − pN e )| Z Z
| {z } | {z } | {z } k=1 Ak
A1 A2 AN
-1 -1
The frequency axis lies on the unit circle from ω = 0, which is a complex point ejω |ω=0 = 1 Z Z
to ω = π, which is situated at ejω |ω=π = −1. The observation frequency ω0 gets values
0 . . . π. -1 -0.81
Bi is called a “zero vector”, i.e. it is the length from the observation point ω0 to zero i.
Figure 82: LTI system of Problem 55.
Ai is a “pole vector” correspondingly.
Any small Ai (pole close to unit circle) gives big value of |H(ejω )|. Any small Bi (zero
close to unit circle) decreases |H(ejω )|. However, it should be noticed that |H(ejω )| is a a) Derive the difference equation of the system.
product of all zero vectors and all pole vectors. b) Calculate the transfer function H(z).
For example, in Figure 81(a) M = 2 and N = 2: c) Calculate the zeros and poles of H(z). Sketch the pole-zero plot. Is the system
B B
stable and/or causal?
z }|1 { z }|2 {
|(1 − z1 e−jω )| |(1 − z2 e−jω )| d) If the region of convergence (ROC) of H(z) includes the unit circle, it is possible to
jω
|H(e )| = K · −jω −jω derive frequency response H(ejω ) by applying z = ejω . Do this!
|(1 − p1 e )| |(1 − p2 e )|
| {z } | {z } e) Sketch the magnitude (amplitude) response |H(ejω )| roughly. Which frequency gives
A1 A2
the maximum value of |H(ejω )|? (If you want to calculate magnitude response
It can be roughly estimated that the filter is highpass, because around ω = 5π/6 A1 explicitely, calculate |H(ejω )|2 = H(ejω )H(e−jω ) and use Euler’s formula.)
is smallest and therefore |H(ejω )| is at maximum. Actually the maximum might be at f) Compute the equation for the impulse response h[n] using partial fraction expansion
ω = π, where A1 · A2 is probably smaller. The rough estimate of the amplitude response and inverse z-transform.
(0 . . . ω0 . . . π) is given in Figure 81(b).
π /2 ω0 [L0328] Solution: Notice that the same filter can be represented (i) as a block diagram,
z = e jω
B1 (ii) with a difference equation, (iii) with a transfer function (and ROC), (iv) with an
A1 |H(e^j ω )| impulse response, (v) with poles, zeros and gain.
B2 1
π ω =0 a) Difference equation: y[n] = x[n] − x[n − 2] − 0.81y[n − 2]
A2
b) Transfer function H(z) can be obtained from h[n] using z-transform pairs:
0 Z{x[n]} = X(z)
ω0
0 π /2 π Z{a · x[n − n0 ]} = a · z −n0 · X(z) ROC : |z| > |a|
(a) (b)
Hence,
Figure 81: (a) Zero vectors Bk and pole vectors Ak . ω runs 0..π. (b) Amplitude response
roughly from the pole-zero-diagram. y[n] = x[n] − x[n − 2] − 0.81y[n − 2]
Y (z) = X(z) − z −2 X(z) − 0.81z −2 Y (z)
(1 + 0.81z −2 ) · Y (z) = (1 − z −2 ) · X(z)
The rules of thumb were given on page 96.
1 − z −2
It can also be seen that the frequency response in discrete-time domain is always 2π- Y (z) = X(z) ·
1 + 0.81z −2
periodic. Because |H(ejω )| is an even function, it is only necessary to draw angles 0 . . . π. Y (z) 1 − z −2
H(z) = = ROC: |z| > 0.9
X(z) 1 + 0.81z −2
T-61.3010 DSP 2009 101/170 PROBLEMS – Part G 53-57 T-61.3010 DSP 2009 102/170 PROBLEMS – Part G 53-57
c) Zeros are the points, where the numerator of transfer function H(z) is zero: ω H(ejω ) |H(ejω )| ω H(ejω ) |H(ejω )|
1 − z −2 = 0 ⇔ z 2 = 1 ⇔ z = ±1. 0 0 0 5π/8 0.6352 + 2.5067 2.5859
Poles are the points, where the denominator of transfer function H(z) is zero: π/8 0.0199 − 0.4568j 0.4573 3π/4 0.1147 + 1.0929j 1.0989
1 + 0.81z −2 = 0 ⇔ z 2 = −0.81 ⇔ z = ±0.9j π/4 0.1147 − 1.0929j 1.0989 7π/8 0.0199 + 0.4568j 0.4573
3π/8 0.6352 − 2.5067j 2.5859 π 0 0
The pole-zero plot of the system is (a common notation is to use a for a zero and
π/2 10.5263 − 0.0000j 10.5263
a × for a pole) in Figure 83(a).
The system is causal, because current output does not depend on future values
|H(e^jw)|
of x[n] and y[n] (time-domain view). The system is stable, because the impulse
response h[n] is absolutely summable (time-domain view).
10.53
On the other hand, if all poles in the pole-zero plot are inside the unit circle, i.e.,
the region of convergence (ROC) includes both the unit circle and the infinity, the
filter is causal and stable (see Problem 56).
d) Frequency response of the system H(ejω ) (continuous systems H(jΩ)) is obtained 0
by applying z = ejω (continuous s = jΩ). If the unit circle is contained in the ROC, π/2 π
it is possible to apply H(ejω ) = H(z)|z=ejω :
Figure 84: A sketch of amplitude response after computing several values in Problem 55(e).
1 − e−2jω
H(ejω ) =
1 + 0.81e−2jω Third, the magnitude response can (only sometimes) be simplified. For example, this
time the simplified version is relatively simple. Simplification is sometimes needed
e) The amplitude response can be computed as exact as wanted using the mathematical to some proofs, etc.
functions. It can be computed also in specific points using calculator or computer.
These will be explained after the roughest way, which is graphical approximation |H(ejω )|2 = H(ejω )H ⋆ (ejω ) = H(ejω )H(e−jω ) | complex conjugate
from poles and zeros. 1 − e−2jω 1 − e+2jω
= ·
The sketch the magnitude (amplitude) response |H(ejω )| can be drawn by using 1 + 0.81e−2jω 1 + 0.81e+2jω
pole-zero plot. There are zeros at z = 1 and z = −1. The corresponding angular 1 + 1 − (e2jω + e−2jω )
=
frequencies are 0 and π, because ej0 = 1 + 0j and ejπ = −1 + 0j. Hence, amplitude 1 + 0.812 + 0.81(e2jω + e−2jω )
response is zero when ω = 0 and ω = π. It is also clear that the maximum value 2 − 2 cos(2ω)
is at ω = π/2, where the pole is closest to the unit circle. A sketch is given in = | square
1.6561 + 1.62 cos(2ω)
Figure 83(b).
jω π
|H(e )| gets the maximum value at frequency ω = 2
. The maximum value is
π
1
Problem 4. Pole−zero−diagram
0.4
5
0 1 f) Notice that the partial fraction expansion can be written in various forms, see Prob-
Imaginary Part
1
0.2
0
lem 10, for instance. The transform pair an µ[n] ↔ 1−az −1 is applied again.
1
−0.2
0.5
−0.4
0
1 − z −2
−0.6
0 H(z) =
−0.8
−1
−0.5
−1 0
0.5
1 1 + 0.81z −2
Im
π/2 π 1 1
−1 −0.5 0 0.5 1 −0.5
−1
− z −2 ·
Real Part Re
= | part. frac. exp.
1 + 0.81z −2 1 + 0.81z −2
Figure 83: Problem 55: (a) Pole-zero plot of H(z) and (b) |H(z)| as a grid and |H(ejω )| with 0.5 0.5 0.5 0.5
−2
solid curve plotted with Matlab. (c) A rough sketch of amplitude response by hands using = + −z +
1 − 0.9jz −1 1 + 0.9jz −1 1 − 0.9jz −1 1 + 0.9jz −1
pole-zero.
h[n] = 0.5 · ((0.9j)n µ[n] + (−0.9j)n µ[n]) −
Second, the amplitude response H(ejω ) = (1 − e−2jω )/(1 + 0.81e−2jω ) can be cal- 0.5 · (0.9j)n−2 µ[n − 2] + (−0.9j)n−2 µ[n − 2]
culated in certain poins. More points, more exact amplitude response. Start with ≈ {1.0000, 0, −1.8100, 0, 1.4661, 0, −1.1875, . . .}
points ω = {0, π/4, π/2, 3π/4, π}, and calculate more if it seems to be appropriate. If
your calculator does not support complex exponentials, decompose them by Euler’s Matlab (residuez) may give a different form of the same sequence:
formula. (Notice that in Matlab you can use directly function exp.) A new sketch
is drawn in Figure 84. h[n] ≈ −1.2346 · δ[n] + 1.1173 · (0.9j)n µ[n] + 1.1173 · (−0.9j)n µ[n]
T-61.3010 DSP 2009 103/170 PROBLEMS – Part G 53-57 T-61.3010 DSP 2009 104/170 PROBLEMS – Part G 53-57
1 − z −1
H(z) =
1 − 2z −1 + 0.75z −2
a) Compute the zeros and poles of H(z).
b) What are the three different regions of convergence (ROC)? Re Re
c) Determine the ROC and the impulse response h[n] so that the filter is causal.
d) Determine the ROC and the impulse response h[n] so that the filter is stable.
[L0329] Solution: Let us begin by reviewing some properties (Mitra 2Ed Sec. 3.8 / 3Ed
Sec. 6.3 )
Figure 85: Region of convergence (ROC) in gray in Problem 56: (i) ∞ belongs to ROC - causal
• The filter is causal ⇔ ∞ belongs to the region of convergence (ROC). filter, (ii) unit circle belongs to ROC - stable filter.
• The filter is stable ⇔ unit circle belongs to ROC, H(z) converges on the unit circle.
• ROC on z-plane must not contain any poles; it may be a ring between two poles, Note, that in this case we cannot have a filter that is both causal and stable.
the disc limited by the closest pole to origin or the plane outside the most distant At this point, when we calculate the impulse response h[n], we have to do an inverse
pole from origin. z-transformation for the transfer function H(z). To do this we express the H(z)
• It is easiest to do the the inverse z-transform (here) by calculating first the fractional as a partial fraction expansion as then we may apply the formula of the sum of a
expansion of the H(z) and then inverting each part of it individually using the sum geometric series.
of a geometric series. Using the poles and zeros we may write the transfer function as follows:
• The sum of a geometric series is (1 − z1 z −1 )(1 − z2 z −1 ) 1 − z −1
H(z) = =
∞
(1 − p1 z −1 )(1 − p2 z −1 ) (1 − 0.5z −1 )(1 − 1.5z −1 )
X 1
qk = , |q| < 1 A B
k=0
1−q ⇔ H(z) = +
1 − 0.5z −1 1 − 1.5z −1
• The z-transform of h[n] is ⇔ 1 − z −1 ≡ A(1 − 1.5z −1 ) + B(1 − 0.5z −1 )
∞
X
−k We solve A and B by letting z → 0.5 and z → 1.5
h[n]z
n=−∞ z → 0.5 : 1 − 0.5−1 = A(1 − 1.5 · 0.5−1 ) + B(1| − 0.5{z· 0.5−1})
=0
a) First we have to solve the poles and zeros: ⇒ A = 0.5
1 − z −1 z(z − 1) z → 1.5 : 1 − 1.5−1 = A(1| − 1.5{z· 1.5−1}) + B(1 − 0.5 · 1.5−1 )
H(z) = = 2
1 − 2z −1 + 0.75z −2 z − 2z + 0.75 =0
⇒ B = 0.5
Poles:
√ Now we may write the expansion
2± 4 − 4 · 0.75
z 2 − 2z + 0.75 = 0 ⇔ z = ⇔ z1 = 0.5, z2 = 1.5 0.5 0.5
2 H(z) = +
1 − 0.5z −1 1 − 1.5z −1
Zeros:
c) Causal filter ⇒ we know that |z| > 1.5. We notice that both fractions in
z(z − 1) = 0 ⇔ z1 = 0, z2 = 1
0.5 0.5
b) Now we may answer to the questions about stability and causality using different H(z) = +
1 − 0.5z −1 1 − 1.5z −1
ROCs, see Figure 85:
represent a sum of a geometric series, as |0.5z −1 | < 1 and |1.5z −1 | < 1 as required.
i) If we require causality, the region of convergence has to include z = ∞ Thus, We conclude
the region of convergence has to be ”outside” the pole z = 1.5, that is |z| > 1.5.
ii) If we require stability, the unit circle has to be on the region of convergence. hcausal [n] = Z −1 {H(z)} = 0.5 · 0.5n µ[n] + 0.5 · 1.5n µ[n]
Thus the region is a ring between the poles: 0.5 < |z| < 1.5 See Figure 86(a), the impulse response grows to infinity, i.e. it Pis not absolutely
iii) If ROC is the inner cicle |z| < 0.5, we will have a noncausal and astable filter. summable, and therefore the filter is not stable with the criterion n |h[n]| < ∞.
T-61.3010 DSP 2009 105/170 PROBLEMS – Part G 53-57 T-61.3010 DSP 2009 106/170 PROBLEMS – Part G 53-57
P
d) Stable filter ⇒ we know that 0.5 < |z| < 1.5. We note that ∞ n −n
n=0 1.5 z does not 57. Problem: Magnitude specifications are normally expressed in normalized form. The
converge as | 1.5
z
| ≥ 1. We have to convert the expression to higher terms in order to maximum of the amplitude response is scaled to one, and the frequency axis is scaled up
get the denominator to suitable form: to half of the sampling frequency, 0 . . . π. The first term of the denominator polynomial
should also be 1.
1 1 Consider the following digital lowpass filter of type Chebyshev II:
Hp2 (z) = · | · (−(2/3)z)/(−(2/3)z)
2 1 − (3/2)z −1 0.71 − 0.36z −1 − 0.36z −2 + 0.71z −3
H(z) = K ·
1 1 1 − 2.11z −1 + 1.58z −2 − 0.40z −3
= − z
3 1 − (2/3)z Normalize the maximum of the amplitude response to the unity (0 dB).
∞ n
1 X 2
= − z zn [L0612] Solution: Chebyshev II approximation is monotonic in the passband, see Fig-
3 n=0 3
ure 87.
n
∞
1 2X H(z) = K ⋅ B(z) / A(z)
= − µ[n]z n+1 | let −m = n + 1
3 n=−∞ 3 10
∞ −m−1 8
1 X 2
= − µ[−m − 1]z −m
3 m=−∞ 3 6
−n−1
1 2 2
hstable [n] = 0.5 · 0.5n µ[n] − µ[−n − 1]
3 3
0
0 0.2 0.4 0.6 0.8 1
which is plotted in Figure 86(b). The impulse response is non-zero for indices n < 0,
and the filter is not causal with criterion h[n] < 0, n < 0. The filter is stable.
Figure 87: Problem 57, H(z) = K · B(z)/A(z) without magnitude scaling.
20 0.6
15 0.4 Therefore the maximum value of the amplitude response of the lowpass Chebyshev II
filter is at ω = 0. The gain K can be computed also in z-plane using z = ejω |ω=0 = 1.
0.2
10
0
5
0.71 − 0.36z −1 − 0.36z −2 + 0.71z −3
|H(z)| = K
−0.2 1 − 2.11z −1 + 1.58z −2 − 0.40z −3
0 −0.4
−2 0 2 4 6 8 −4 −2 0 2 4 0.71 − 0.36z −1 − 0.36z −2 + 0.71z −3
|H(z)|z=1 = K =1
1 − 2.11z −1 + 1.58z −2 − 0.40z −3
Figure 86: Problem 56: Left, 56(c) where ROC: |z| > 1.5 ⇔ filter is causal but not stable. 0.70
Right, 56(d) where ROC: 0.5 < |z| < 1.5 ⇔ filter is not causal but stable. = K =1
0.07
Remark. In practice, we operate with causal and stable filters, which means that
⇒ K = 0.1
all poles should be inside the unit circle.
In a similar way if the maximum is at ω = π (highpass), compute z = ejω |ω=π = −1, etc.
Remark. When |H(z)|max = 1, then the maximum reference level is in (power) desibels
|H(z)|max = 20 log10 (1) = 0 dB.
T-61.3010 DSP 2009 107/170 PROBLEMS – Part H 58-61 T-61.3010 DSP 2009 108/170 PROBLEMS – Part H 58-61
58. Problem: Show that the filter H(z) = 1 − 2z −1 + 2z −2 − z −3 has linear phase response. using Euler’s formula ejω = cos(ω) + j sin(ω). Recall that ∠(A · B) = ∠A + ∠B. When
computing phase ∠H(ejω ), we get
[L0510] Solution: If N-length h[n] is either symmetric (h[n] = h[N − 1 − n]) or antisym-
∠H(ejω ) = ∠e−j1.5ω + ∠j + ∠(2 sin(1.5ω) − 4 sin(0.5ω))
metric (h[n] = −h[N − 1 − n]), then the filter has linear phase response (Mitra 2Ed Sec.
4.4.3 / 3Ed Sec. 5.5.2 ). At the same time, the locations of zeros are mirror-imaged with = −1.5ω + 0.5π + ∠C(ω)
respect to the unit circle (r · e±jω ↔ (1/r) · e±jω ).
where C(ω) = 2 sin(1.5ω) − 4 sin(0.5ω), and ∠C(ω) gets values 0 or π, when C(ω) > 0
All possible linear-phase filters: or C(ω) < 0, respectively. Now ∠H(ejω ) is piecewise linear function of ω. The phase
Type 1: symmetric odd length, response is depicted in Figure 89(c).
Type 2: symmetric even length, Hence, H(ejω ) is said to have linear phase response3 . All frequency components are
Type 3: antisymmetric odd length, delayed by the same 1.5. Therefore the waveform is preserved as much as possible for a
Type 4: antisymmetric even length. given amplitude response.
Zero-phase filter is a special case when the sequence is symmetric around origo, i.e., delay
4
is zero and the filter is noncausal. 2
1
3
Some examples of four types of linear-phase filters are given in Figure 88. 1
0.5
Imaginary Part
2
0 3
0
4 1 1
−1 −0.5
2
Type 1
6 0
0 0
−2 −1
0 1 2 3 −1 −0.5 0 0.5 1 0 1 2 3
−2 n Real Part ω
−1
0 2 4 6 −2 0 2
Figure 89: Problem 58: (a) One type of antisymmetric impulse response h[n], (b) pole-zero
1
4
plot, and (c) linear phase response ∠H(ejω ). Notice the points of discontinuity (“jumps”) at
Type 2
2 5
0
0 0 and ±π/3, when there is a zero on the unit circle. This kind of discontinuities (by π) are
−2 −1 allowed in the definition of linear-phase filters.
0 1 2 3 4 5 −2 0 2
5 1
Type 3
6
0 0
−5 −1
0 2 4 6 −3 −2 −1 0 1 2
4 1
2
Type 4
2 5
0 0
−2
−4 −1
0 1 2 3 4 5 −2 0 2
Figure 88: Problem 58: Examples of four types of linear-phase filters with impulse response
h[n] in left and pole-zero-plot in right.
The inverse transform of H(z) is the impulse response h[n] of even length N = 4
59. Problem: Examine the following five filters and connect them at least to one of the 4
1 0
2
following categories (a) zero-phase, (b) linear-phase, (c) allpass, (d) minimum-phase, (e) 2 0.5
−20
maximum-phase. 0 0
8
0
−0.5 −40
h1 [n] = −δ[n + 1] + 2δ[n] − δ[n − 1] −2
−2
−1
−4 −60
1 + 3z −1 + 2.5z −2 −4 −2 0 2 4 −1 0 1 0 pi/2 pi 0 pi/2 pi
T-61.3010 DSP 2009 111/170 PROBLEMS – Part H 58-61 T-61.3010 DSP 2009 112/170 PROBLEMS – Part H 58-61
6
1 1 1
4 1 0 LP
2 HP
0.8
2 0.5 0.5 0.5
−20 0.6
0 cont. 0 0 0 0
0.4
−2 −0.5 −0.5 −0.5
−40 0.2
−4 −2
−1 −1 −1 0
−6 −1 0 1 2 −60
0 5 10 0 pi/2 pi 0 pi/2 pi −1 0 1 −1 0 1 0 pi/2 pi
Figure 92: An example of a minimum-phase transfer function in Problem 59. Figure 94: An example of power-complementary LP and HP filters in Problem 59.
H4) If the amplitude response (z ← ejω ) is |H(ejω )| = 1 for all frequencies, then the H5) Linear-phase. This impulse response is a shifted (delayed) version of h1 [n]. The
filter is allpass (Mitra 2Ed Sec. 4.6 / 3Ed Sec. 7.1.3 ). The phase response differs frequency response is not any more real-valued, but still the phase response is linear
from filter to filter. Allpass-filters contain both zeros and poles mirror-symmetrically, and the group delay constant.
and there is a certain symmetry in the coefficients of numerator and denominator
polynomials, too. Note that gain cannot be seen from the pole-zero plot. H5 (ejω ) = e−jω · H1 (ejω )
In Figure 93 an allpass transfer function |H5 (ejω )| = |H1(ejω )| = |2 − 2 cos(ω)|
∠H5 (ejω ) = −ω | linear
−0.288 + 0.4785z −1 − 0.007771z −2 − 0.09443z −3 + z −4
H(z) = −3.4722 · d
1 − 0.09443z −1 − 0.007771z −2 + 0.4785z −3 − 0.288z −4 − ∠H5 (ejω ) = 1 | constant
dω
2 10
There are four types of linear-phase transfer functions (Mitra 2Ed Sec. 4.4.3 / 3Ed
1
1
2
Sec. 7.3 ). Impulse response of Type 1 is symmetric and odd-length. Type 2 is
0
0
cont. 0.5 0
−2 symmetric and even-length. Type 3 is antisymmetric and odd-length. Type 4 is
0
−1
−0.5 −10
−4 antisymmetric and even-length. The zeros have mirror-image symmetry respect to
−6
−2
−1 −8
the unit circle.
−3 −20
0 5 10 −1 0 1 2 0 pi/2 pi 0 pi/2 pi In Figure 95 there is a Type 1 (length: 9, order: 8) impulse response, which is a
(i) (ii) (iii) (iv) shifted version of the filter in Figure 90.
Figure 93: An example of an allpass transfer function in Problem 59. h[n] = {1, 3.2893, 3.8875, 0.0884, −3.0407, 0.0884, 3.8875, 3.2893, 1}
X
H(z) = h[n]z −n
Remark. A complemantary transfer function (Mitra 2Ed Sec. 4.8 / 3Ed Sec. 7.5 ) n
can be obtained using allpass filters. An example of a lowpass filter
HLP (z) = 0.5 A0 (z) + A1 (z) 4
1 0
−1
−a + z 2 0.5
0
= 0.5 1 + 8
−20
1 − az −1 0 0
−5
1 − a + z −1 − az −1 −0.5 −40
−2
= 0.5 −1
1 − az −1 −4
0 2 4 6 8 −1 0 1
−60
0 pi/2 pi
−10
0 pi/2 pi
where A0 (z) and A1 (z) are allpass transfer functions and its power-complementary (i) (ii) (iii) (iv)
highpass filter Figure 95: An example of a linear-phase transfer function in Problem 59.
HHP (z) = 0.5 A0 (z) − A1 (z)
−a + z −1
= 0.5 1 −
1 − az −1
1 + a 1 − z −1
= ·
2 1 − az −1
In Figure 94(iii) is shown that |HLP (z)|2 + |HHP (z)|2 = 1, as expected by the defi-
nition of power-complementary transfer functions.
T-61.3010 DSP 2009 113/170 PROBLEMS – Part H 58-61 T-61.3010 DSP 2009 114/170 PROBLEMS – Part H 58-61
a) Derive a minimum-phase FIR filter with exactly same amplitude response (Mitra
Imaginary Part
Imaginary Part
Imaginary Part
Imaginary Part
2 2 2
0 0 0 0
2Ed Sec. 4.7, p. 246 / 3Ed Sec. 7.2.3, p. 365 ). −0.5 −0.5 −0.5 −0.5
−1 −1 −1 −1
b) Derive an inverse filter of the minimum-phase FIR filter computed in (a) (Mitra 2Ed −1 −0.5 0 0.5
Real Part
1 1.5 2 −1 −0.5 0 0.5
Real Part
1 1.5 2 −1 −0.5 0 0.5
Real Part
1 1.5 2 −1 −0.5 0 0.5
Real Part
1 1.5 2
Sec. 4.9, p. 253 / 3Ed Sec. 7.6, p. 396 ). Figure 96: Problem 60: (a) H1 (z), (b) A(z), (c) H2 (z) = H1 (z) · A(z), (d) H3 (z) = 1/H2 (z).
[L0332] Solution: Minimum-phase filter has all zeros inside the unit circle whereas
maximum-phase filter filter has all zeros outside the unit circle. A filter with zeros inside 61. Problem: Consider a stable and causal discrete-time LTI system S1 , whose zeros zi and
and outside the unit circle is often called a mixed-phase filter (Mitra 2Ed Sec. 4.7, p. 246 poles pi are
/ 3Ed Sec. 7.2.3, p. 365 ).
zeros: z1 = 1, z2 = 1
Two causal LTI discrete-time systems with impulse responses h1 [n] and h2 [n] are inverses
if h1 [n] ⊛ h2 [n] = δ[n]. After z-transform H1 (z) · H2 (z) = 1, or H1 (z) = 1/H2 (z). If poles: p1 = 0.18, p2 = 0
H1 (z) = B(z)/A(z), then H2 (z) = A(z)/B(z), that is, all zeros are replaced by poles,
Add a LTI FIR filter S2 in parallel with S1 as shown in Figure 97 so that the whole system
and vice versa. If the filter is minimum-phase FIR with all zeros inside the unit circle,
S is causal second-order bandstop filter, whose minimum is approximately at ω ≈ π/2
then its inverse is stable. Inverse filtering can be used, e.g., in recovering a signal which
and whose maximum is scaled to one. What are transfer functions S2 and S?
has been distorted in an imperfect transmission channel (Mitra 2Ed Sec. 4.9, p. 253 /
3Ed Sec. 7.6, p. 396 ). In the case of non-minimum-phase FIR filter the situation is more
complex (Mitra 2Ed Sec. -, p. - / 3Ed Sec. 7.6.2, p. 398 ).
S1
a) A second-order FIR filter H1 (z) with zeros at z = 2 ± j is drawn in Figure 96(a). It x[n] K y[n]
is clearly a high-pass filter. Its tranfer function can be written
5 − 4z −1 + z −2 √ Figure 97: Problem 61: Filter S constructed from LTI subsystems S1 and S2 .
A(z) = ROC: |z| < 5
1 − 4z −1 + 5z −2
which has poles at p = 2 ± j and zeros at z = 0.4 ± 0.2j, and |A(z)| ≡ 1 for [L0345] Solution: Denote transfer functions of the system S1 by H1 (z) = B1 (z)/A1 (z),
all frequencies. Poles and zeros are mirror-images pi = rej±θ , and zi = (1/r)ej∓θ . S2 by H2 (z) = B2 (z)/A2 (z), and the total system S by H(z) = K ·B(z)/A(z). The system
Note also that the inverse of a pole gives a complex conjugate of a mirrored zero, S2 is FIR, so A2 (z) = 1, and therefore H2 (z) = B2 (z). The subsystems are parallel which
1 2−j 2−j gives
2+j
= (2+j)(2−j) = 4+2j−2j+1 = 0.4 − 0.2j. Now, the minimum-phase FIR filter H2 (z) B (z)
is received by H2 (z) = H1 (z) · A(z), see Figure 96(c) 1 B(z)
H(z) = K · H1 (z) + H2 (z) = K · + B2 (z) = K ·
A1 (z) A(z)
5 − 4z −1 + z −2 The system S1 is clearly a high-pass filter, see Figure 98(a),(b),
H2 (z) = (1 − 4z −1 + 5z −2 ) · = 5 − 4z −1 + z −2
1 − 4z −1 + 5z −2
(1 − z1 z −1 ) · (1 − z2 z −1 ) (1 − z −1 ) · (1 − z −1 ) 1 − 2z −1 + z −2
The amplitude response of H2 (z) is exactly the same as that of H1 (z), because H1 (z) = = =
1 − p1 z −1 1 − 0.18z −1 1 − 0.18z −1
|H2 (z)| = |H1 (z)| · |A(z)|, where |A(z)| = 1 by definition of all-pass filter. The phase
responses of H1 (z) and H2 (z) differ. H2 (z) has two zeros at z = 0.4 ± 0.2j. We would like to have a bandstop filter H(z) whose minimum is approximately at ωm =
b) The inverse filter is now received directly H3 (z) = 1/H2 (z) π/2. Zeros do not necessarily need to lie on the unit circle, but with the angle ωm and
−ωm , see Figure 98(c),(d). The numerator polynomial of H(z), i.e., B(z) is of form
1 0.2 √
H3 (z) = = ROC: |z| > 0.2
5 − 4z −1 + z −2 1 − 0.8z −1 + 0.2z −2 B(z) = (1 − rjz −1 ) · (1 + rjz −1 ) = 1 + r 2 z −2
H3 (z) is a stable lowpass all-pole filter with poles at p = 0.4 ± 0.2j, see Figure 96(d).
Next we will compute two different solutions for bandstop filters. In the first case, zeros
lie inside the unit circle (r < 1), and in the second case they are on the unit circle (r = 1).
T-61.3010 DSP 2009 115/170 PROBLEMS – Part H 58-61 T-61.3010 DSP 2009 116/170 PROBLEMS – Part H 58-61
1 0 1
0 Computing the unknowns gives a ≈ −0.35 and b ≈ 1.94, leading to B2 (z) = −0.35 +
0.5
−20
0.5
−5 1.94z −1 and
Imaginary Part
Imaginary Part
2
−40
2 1 + z −2
H ′ (z) = 0.65 ·
dB
dB
0 0 −10
−0.5
−60
−1
−100
−1
−20 whose pole-zero plot and (scaled) magnitude response are plotted in Figure 99(c),(d).
−1 −0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1 −1 −0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1
Real Part *π Real Part *π
1 − 0.18z −1 0
−10
0.5 0.5
−5
It can be seen that the order of B2 (z) cannot be more than 1 because B(z) has to be −20
Imaginary Part
Imaginary Part
dB
dB
0 −10 0 −30
(1 − 2z −1 + z −2 ) + (1 − 0.18z −1 ) · (a + bz −1 )
−50
H ′ (z) =
−20
−1 −1 −60
−1 −0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1 −1 −0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1
1 − 0.18z −1 Real Part *π Real Part *π
62. Problem: Derive the transfer function of the feedback system shown in Figure 100. 63. Problem: The filter in Figure 104 is in canonic direct form II (DF II). Draw it in DF I.
What is the transfer function H(z)?
x[n] w[n] y[n]
E(z) F(z)
x[n] w[n] y[n]
G(z)
z −1
0.9 0.8
Figure 100: System in Problem 62.
z−1
[L0500] Solution: Systems in parallel, see Figure 101: Hp (z) = H1 (z)+H2 (z) in frequency
−0.2
domain and hp [n] = h1 [n] + h2 [n] in time domain. Systems in cascade, see Figure 102:
H1 (z)
Figure 104: The block diagram of direct form II of Problem 63.
H2 (z) [L0508] Solution: Direct form structure means that the coefficients of the block diagram
are the same (or negative values) as in the difference equation and transfer function. There
Figure 101: Systems in parallel, example in Problem 62. are also other structures, e.g. lattice. The transfer function for any direct form (I, II,
and transposes IT , IIT , respectively, see Page 120) is the same. Some differences (may)
Hc (z) = H1 (z)H2 (z) in frequency domain and hc [n] = h1 [n] ⊛ h2 [n] in time domain. occur when working with finite word length. There are also differences in computational
The flow diagram of the system being investigated with temporary variable w[n] is in load and memory storage.
Y (z) F (z)E(z) If we want to convert it into direct form I without any calculations (done below
H(z) = =
X(z) 1 − F (z)G(z) in (b)), we can duplicate the registers. The same signal w[n] goes into the both
branches. See Figure 106(a).
Then we can denote the part in left as an “IIR subsystem” and the structure in right
E(z)X(z)
X(z) W(z) Y(z) Y(z) as an “FIR subsystem”. Because both of them are LTI, we can change the order of
E(z) F(z) them, as in any LTI system, for example, using impulse responses
Now we have direct form I in Figure 106(b), and the difference equation and the
Figure 103: System in Problem 62.
transfer function can be obtained directly without any temporal variables! However,
there are now three registers instead of two.
T-61.3010 DSP 2009 119/170 PROBLEMS – Part I 62-65 T-61.3010 DSP 2009 120/170 PROBLEMS – Part I 62-65
"FIR" "IIR"
Figure 107: Direct form I. You may connect FIR and IIR parts in the middle sum line.
When transposing (Figure 108) transfer function stays, but structure changes. “Rules”
for transposing:
1 Change directions
2 Nodes to sums
3 Sums to nodes
4 Flip the whole structure
T-61.3010 DSP 2009 121/170 PROBLEMS – Part I 62-65 T-61.3010 DSP 2009 122/170 PROBLEMS – Part I 62-65
y[n]
1
x[n] x[n] w[n] 1 y[n]
y[n] "IIR" 1 x[n] x[n] 1 "IIR" y[n]
w[n] w[n]
−1 −1 -1 -1
z z z z z
-1
z
−1
0.2 0.2 0.5
0.5 0.2 0.5 0.5 0.2
−1 -1
z z
−0.4 -0.4 -1 −1
-0.4 z z −0.4
"FIR"
"FIR"
"FIR" "IIR" "IIR" "FIR"
Phases 1-3 Phase 4: flip around. You may connect Phases 1-3 Phase 4: flip around
parts in the middle line.
Figure 110: Transposed direct form II.
Figure 108: Transposed direct form I.
64. Problem: Analyze the digital filter structure shown in Figure 111 and determine its
Direct form II contains minimum number of delay registers. Draw in order “IIR” and transfer function H(z) = Y (z)/X(z).
1
then “FIR”. Think the transfer function in order H(z) = D(z) · P (z). Because LTI, the
order of subfilters can be changed. Connect the delay registers, because there are the a) Is the system LTI?
same signals (see Book). So you get canonic form, where the number of delays is the b) Is the structure canonic with respect to delays?
same as order of the filter (Figure 109).
c) Compute H(z)H(z −1 ) (the squared amplitude response). What is the type of this
x[n] 1 y[n] x[n] w[n]
1 y[n] filter (lowpass/highpass/bandpass/bandstop/allpass)?
w[n]
w[n] w[n]
−1 −1
-1
z z z y[n]
0.2 0.2 0.5 x[n]
0.5 z−1 z−1
K
−1 -1 −1
z z
−0.4 -0.4
A B
"IIR" "FIR" "IIR" "FIR" −1
IIR-FIR before connecting Canonic form z −1
z−1
Figure 109: Direct form II. Figure 111: The flow diagram of the system in Problem 64.
.
Corresponding transponing IIT , see Figure 110.
Example on direct form, cascade and parallel system. Consider a second order transfer [L0502] Solution: Let us use three temporary signals w1 [n], w2 [n], and w3 [n], in the
function following locations in Figure 112.
1 1
H(z) = = From the figure we get the following expressions in transform-domain (W ≡ W (z)):
(1 + 13 z −1 )(1 − 41 z −1 ) 1 −1
1 + 12 1 −2
z − 12 z
with difference equation W1 = KX + z −1 W3
1 1
y[n] = − y[n − 1] + y[n − 2] + x[n] W2 = (z −1 − A)W1
12 12
Cascade form can be written as W3 = AW1 − Bz −1 W1 = (A − Bz −1 )W1
1 1
H(z) = Y = z −1 W2 + BW1
1 + 13 z −1 1 − 41 z −1
and parallel form using partial fraction (draw!) Substituting the equation from third line to first line we get
4 3
7 7 W1 = KX + z −1 (A − Bz −1 )W1
H(z) = +
1 + 31 z −1 1 − 14 z −1 (1 − Az −1 + Bz −2 )W1 = KX
T-61.3010 DSP 2009 123/170 PROBLEMS – Part I 62-65 T-61.3010 DSP 2009 124/170 PROBLEMS – Part I 62-65
65. Problem: Develop a polyphase realization of a length-9 FIR transfer function given by
W1 W2 y[n]
x[n] 8
z−1 z−1 X
K H(z) = h[n]z −n
n=0
−1
with (a) 2 branches and (b) 4 branches.
A B [L0501] Solution: Polyphase realizations (Mitra 2Ed Sec. 6.3.3 / 3Ed Sec. 8.3.3 ) can
be used in multirate techniques.
−1
W3 a) Two branches
z−1 z−1 8
X
H(z) = h[n]z −n
n=0
Figure 112: The filter with temporary signals w1 , w2 , and w3 in Problem 64.
= h[0] + h[1]z −1 + h[2]z −2 + h[3]z −3 + h[4]z −4 +
Next, substituting second line in fourth line we get h[5]z −5 + h[6]z −6 + h[7]z −7 + h[8]z −8
Y = [z −1 (z −1 − A) + B]W1 = h[0] + h[2]z −2 + h[4]z −4 + h[6]z −6 + h[8]z −8 +
z −1 h[1] + h[3]z −2 + h[5]z −4 + h[7]z −6
Finally, we get rid of the last temporary variable W1 , and get
= H0 (z 2 ) + z −1 H1 (z 2 )
Y (z) B − Az −1 + z −2
H(z) = =K· where
X(z) 1 − Az −1 + Bz −2
H0 (z) = h[0] + h[2]z −1 + h[4]z −2 + h[6]z −3 + h[8]z −4
a) It is LTI. There are only multiplications by constants, delays, and sums of sequences.
b) Since the structure employs 4 unit delays to implement a second-order transfer func- H1 (z) = h[1] + h[3]z −1 + h[5]z −2 + h[7]z −3
tion, it is not canonic.
Canonic structure: the number of registers, i.e. delay components, is the same
as the filter order. Direct form I is not canonic, but it is intuitive and its difference H0 (z 2 )
equation is easy to obtain. Direct form II is canonic. It is more efficient to use
canonic structures. (Consider, for example, Problem 71. If canonic structure is
used, there are only 8 storage locations instead of 10.) z −1
c)
H1 (z 2 )
B − Az −1 + z −2 B − Az 1 + z 2 z −2
H(z)H(z −1 ) = K 2 | ·
1 − Az −1 + Bz −2 1 − Az 1 + Bz 2 z −2
−1 −2
−2 −1
B − Az + z Bz − Az + 1 Figure 113: Polyphase realization with two branches in Problem 65(a).
= K2
1 − Az −1 + Bz −2 z −2 − Az −1 + B
= K2 b) Four branches
8
Therefore |H(ejω )| = K for all values of ω and hence |H(ejω )| = 1 if K = 1. H(z) is X
H(z) = h[n]z −n
an allpass transfer if K = 1. n=0
= H0 (z 4 ) + z −1 H1 (z 4 ) + z −2 H2 (z 4 ) + z −3 H3 (z 4 )
T-61.3010 DSP 2009 125/170 PROBLEMS – Part I 62-65 T-61.3010 DSP 2009 126/170 PROBLEMS – Part J 66-68
where 66. Problem: Sketch the following specifications of a digital filter on paper. Which of the
amplitude responses of the realizations in Figure 115 do fulfill the specifications?
H0 (z) = h[0] + h[4]z −1 + h[8]z −2
Specifications: Digital lowpass filter, sampling frequency fT 8000 Hz, passband edge fre-
H1 (z) = h[1] + h[5]z −1 quency fp 1000 Hz, transition band 500 Hz (transition band is the band between passband
and stopband edge frequencies!), maximum passband attenuation 3 dB, minimum stop-
H2 (z) = h[2] + h[6]z −1 band attenuation 40 dB.
(a) Elliptic, N=4 (b) Chebychev II, N=10 (c) FIR/Hamming, N=50
H3 (z) = h[3] + h[7]z −1
0 0 0
−10 −10 −10
−20 −20 −20
H0 (z 4 )
−30 −30 −30
dB
dB
dB
−40 −40 −40
z −1
−50 −50 −50
−60 −60 −60
H1 (z 4 )
−70 −70 −70
0 2000 4000 0 2000 4000 0 π/2 π
Hz Hz ω
z −1
Figure 115: Three realizations in Problem 66: amplitude responses of (a) 4th order elliptic, (b)
H2 (z 4 ) 10th order Chebychev II, (c) 50th order FIR using Hamming window.
z −1
[L0644] Solution: The frequency specifications are in Hertz, radians, and in normalized
H3 (z 4 )
Matlab frequency in Table 8 and they are drawn in Figure 116 with dashed line.
Now that specifications are written and sketched, the filter order and the filter coefficients
are computed using a specific software (e.g. Matlab, ellipord and ellip, buttord and
butter, etc.). Then the amplitude response |H(ejω )| of the calculated filter is plot-
ted in the same picture as the sketch of the specifications (e.g. Matlab, [...] =
freqz(B,A,...);). If the amplitude response curve fits in the specifications, we have
succeeded. In other case, the specifications and the code for the filter are re-checked.
The elliptic IIR filter in Figure 116(a) (via bilinear transform) is of order 4 and it fulfills
the specifications exactly.
Chebychev II filter (Figure 116(b)), which is 10th order IIR, is monotonic in passband
and has stopband attenuation of 50 dB instead of 40. The amplitude response fits in the
allowed area, and it is already too strict. Probably the order N = 8 would be sufficient.
The third filter (Figure 116(c)) is 50th order FIR, whose transition is narrow enough
but at the wrong cut-off frequency. So, this is the only filter, which does not fulfill the
specifications. One should check the cut-off frequency so that the amplitude response fits.
T-61.3010 DSP 2009 127/170 PROBLEMS – Part J 66-68 T-61.3010 DSP 2009 128/170 PROBLEMS – Part J 66-68
(a) Elliptic, N=4 (b) Chebychev II, N=10 (c) FIR/Hamming, N=50
Approximation M 2Ed Sec. M 3Ed Sec. Response
Ampl.resp. Ampl.resp. Ampl.resp.
0 Specifications 0 Specifications 0 Specifications
dB
dB
1
−40 −40 −40 Chebyshev I 5.4.3 4.4.3 |Ha (jΩ)|2 = 2 (Ω/Ω )
1+ǫ2 TN p
−50 −50 −50
−60 −60 −60 1
Chebyshev II 5.4.3 4.4.3 |Ha (jΩ)|2 = T (Ω /Ωp ) 2
−70
0 2000 4000
−70
0 2000 4000
−70
0 π/2 π 1+ǫ2 [ TN (Ωs /Ω) ]
Hz Hz ω N s
1
Elliptic 5.4.4 4.4.4 |Ha (jΩ)|2 = 2 (Ω/Ω )
Figure 116: Three realizations in Problem 66: amplitude responses (solid line) with specifica- 1+ǫ2 RN p
tions (dashed line) of (a) 4th order elliptic (OK!), (b) 10th order Chebychev II (OK, too tight
realization?), (c) 50th order FIR using Hamming window (bad cut-off frequency).
Table 9: Analog filter approximations in Problem 67.
Chebychev I, N = 7 Elliptic, N = 4
67. Problem: Connect first each amplitude response to the corresponding pole-zero plot 0 0
Chebychev II, N = 7 Elliptic, N = 4
1 1
in Figure 117. Then recognize the following digital IIR filter algoritms: Butterworth,
−20 −20 0.5 0.5
Chebyshev I, Chebyshev II, Elliptic. The conversion from analog to digital form is done 0 0
using bilinear transform. The sampling frequency in figures is 20 kHz. −40 −40
−0.5 −0.5
−60 −60 −1 −1
0 0 0 5000 10000 0 5000 10000
1 1 Hz II, N = 7 −1 0 1 −1 0 1
Butterworth, N = 19 Chebychev
Chebychev I, N = 7 Butterworth, N = 19
−20 −20 0.5 0.5 0 0
1 1
0 0
−40 −40 −20 −20 0.5 0.5
−0.5 −0.5
0 0
−60 −60 −40 −40
0 5000 10000 0 5000 10000
−1 −1
−1 0 1 −1 0 1 −0.5 −0.5
−60 −60
0 0 0 5000 10000 0 5000 10000 −1 −1
1 1 Hz −1 0 1 −1 0 1
−20 −20 0.5 0.5
−40 −40
0 0 Figure 118: Problem 67, see the titles of each subfigure for filter type and order.
−0.5 −0.5
−60 −60
0 5000 10000 0 5000 10000 −1 −1
−1 0 1 −1 0 1
68. Problem: Consider the following prototype analog Butterworth-type lowpass filter
(a) (b)
1
Figure 117: Problem 67. Digital filters from analog approximations through bilinear transform, HprotoLP (s) =
s+1
(a) amplitude responses with specifications, fs = 20000 Hz (b) pole-zero plots.
a) Form an analog first-order lowpass filter with cutoff frequency Ωc by substituting
H(s) = HprotoLP ( Ωsc ). Draw the pole-zero plot in s-plane.
b) Implement a discrete first-order lowpass filter HImp (z), whose cutoff frequency (-3
[L0643] Solution: Analog filter design is represented in (Mitra 2Ed Sec. 5.4 / 3Ed Sec. dB) is at fc = 100 Hz and sampling rate is fs = 1000 Hz, applying the impulse-
4.4 ). The approximations are given with magnitude-squared responses of Nth order in invariant method to H(s). Draw the pole-zero plot of the filter HImp (z).
Table 9.
c) Implement a discrete first-order lowpass filter HBil (z) with the same specifications
The response of Butterworth is monotonic. Chebyshev I is equiripple in the passband applying the bilinear transform to H(s). Prewarp the edge frequency. Draw the
and monotonic in the stopband whereas Chebyshev II is monotonic in the passband and pole-zero plot of the filter HBil (z).
equiripple in the stopband. Elliptic approximation is equiripple both in the passband
and stopband. The filter order can often be obtained by computing the number of local
maximum and minimum. [L0613] Solution: The solution to the problem starts from the page 129. Two methods
for digital IIR design are shown in the lecture slides, impulse invariant method and bilinear
The digital filters are obtained through bilinear transform (Mitra 2Ed Sec. 7.2 / 3Ed Sec.
transform method.
9.2 ). Hence, approximations, amplitude responses and pole-zero plots are related to each
other according to the Figure 118. Analog Butterworth lowpass filter
Analog Butterworth filter is discussed in (Mitra 2Ed Sec. 5.4.2 / 3Ed Sec. 4.4.2 ).
The definition of an analog Butterworth filter with cut-off frequency Ωc is |Ha (jΩ)|2 =
T-61.3010 DSP 2009 129/170 PROBLEMS – Part J 66-68 T-61.3010 DSP 2009 130/170 PROBLEMS – Part J 66-68
1/(1 + ( ΩΩc )2N ) (Mitra 2Ed Eq. 5.31 / 3Ed Eq. 4.33 ). The first order (N = 1) filter is a) Substitution gives directly
therefore
Ωc
1 H(s) = HprotoLP (s/Ωc ) =
|Ha (jΩ)|2 = 2 s + Ωc
1 + ΩΩc
The pole-zero plot of a lowpass filter in s-plane is in Figure 119.
1 1
Ha (s)Ha (−s) = 2 = 2 Analog LP filter H (s)=Ω /(s+Ω )
a c c
s s
1+ jΩc
1− Ωc Im s
=H(s) H(−s)
z }| { z }| {
1 1
= · Re s
1 + Ωsc 1 + −s
Ωc
Ω
c
where s = jΩ
Ωc
⇒ Ha (s) =
s + Ωc
The pole in s-plane is at s = −Ωc . Figure 119: Problem 68(a), LP in s-plane. The stable pole is at s = −Ωc in the left subspace,
Here, Ω refers to frequency in analog domain (H(jΩ)) and ω to frequency in digital the y-axis is the frequency.
domain (H(ejω )).
As said earlier, there are two ways to convert analog filter to digital. The inpulse-invariant b) Transfer function using the impulse-invariant method.
method is straigtforward but it has severe limitations. The bilinear transform is a standard Ωc
way. Ha (s) = 7→ ha (t) = Ωc e−Ωc t µ(t) 7→
s + Ωc
Impulse-invariant method, see, e.g. lecture slides: ∞
X Ωc
h[n] = ha (nT ) = Ωc e−Ωc nT µ[n] 7→ H(z) = Ωc e−Ωc nT z −n =
1 − e−Ωc T z −1
Ha (s) 7→ ha (t) 7→ h[n] = ha (nT ) 7→ H(z) n=0
The constant K is introduced in order to scale the maximum of |H(ejω )| into unity.
In the impulse-invariant method the target is to get impulse response of digital filter h[n]
Using (Mitra 2Ed Eq. 7.7 / 3Ed Eq. 9.7 ), ωc = Ωc /fT = 2πfc /fT and values fT = 1
to be the same as the sampled impulse response of analog filter ha (nT ). Because IIR
kHz (sampling frequency) and fc = 100 Hz (cut-off frequency),
filters have normally an impulse response of infinite length, this method brings distortion.
The bilinear transformation is acquired when K K
H(z)Imp = =
1 − e−ωc z −1 1 − e−π/5 z −1
1 − z −1
s=k· We also know that the maximum is located at zero frequency, because the frequency
1 + z −1
response of a Butterworth filter is monotonic. Thus we get
is inserted into the system function (Mitra 2Ed Eq. 7.21 / 3Ed Eq. 9.15 )
K
= 1 ⇔ K = 1 − e−π/5
H(z) = Ha (s)|s=k· 1−z−1 1 − e−π/5
1+z −1
Note that here k is a parameter used in the derivation of the bilinear transformation. It The transfer function of the filter is therefore
is originally k = (2/T ) but can be set k = 1 to simplify the procedure. 1 − e−π/5 1
H(z)Imp = = 0.4665 ·
The frequency is warped before the bilinear transformation (Mitra 2Ed Fig. 7.4, 7.5 / 1 − e−π/5 z −1 1 − 0.5335z −1
3Ed Fig. 9.3, 9.4 ). In the small frequencies the difference is not big, but it is significant There is a pole at z = 0.5335, see Figure 120 for the amplitude response in linear
in high frequencies. Therefore the discrete-time normalized angular cut-off frequency ωc
scale, in desibels and the pole-zero plot.
has to be first prewarped into analog-time prewarped cut-off frequency Ωpc :
ω c) Transfer function using bilinear transform. Compute the normalized angular discrete-
c
Ωpc = k · tan time cut-off frequency ωc ,
2
where ωc = 2πfc /fT = 2πfc T = Ωc T , and 0 < ωc < π, and [fc ] = Hz, and fT = 1/T 2πΩc 2π2πfc 2πfc
ωc = = = = 0.2π
is the sampling frequency. For example, if discrete-time fc = 100 Hz and fs = 1000 Hz, Ωs 2πfT fT
then Ωpc = 2000 · tan(0.1π), and fpc ≈ 103.4 Hz. Analog design has to be done using fpc and the prewarped cut-off frequency Ωpc (k = 2/T ):
instead of fc in order to get the cut-off frequency to 100 Hz in the digital filter.
ωc
Solution to Problem 68 Ωpc = k · tan( ) = k · tan(0.1π)
2
T-61.3010 DSP 2009 131/170 PROBLEMS – Part J 66-68 T-61.3010 DSP 2009 132/170 PROBLEMS – Part K 69-71
1 1
1 1
0 0
0.8 0.8
−10 0.5 −10 0.5
Imaginary Part
Imaginary Part
0.6 0.6
(dB)
(dB)
−20 0 −20 0
0.4 0.4
−30 −0.5 −30 −0.5
0.2 0.2
−40 −40
0 −1 0 −1
0 100 200 300 400 500 0 100 200 300 400 500 −1 −0.5 0 0.5 1 0 100 200 300 400 500 0 100 200 300 400 500 −1 −0.5 0 0.5 1
f (Hz) f (Hz) Real Part f (Hz) f (Hz) Real Part
H(z) = H(s)|s=k· 1−z−1 , a) Show that the best finite-length approximation to the ideal infinite length impulse
Ωc =Ωpc =k·tan(0.1π)
1+z −1 response in the mean square error sense is obtained by truncated Fourier series
Ωc method.
= | 1−z −1
s + Ωc s=k· 1+z−1 , Ωc =Ωpc =k·tan(0.1π) b) What is the disadvantage of this method and what are the solutions to this problem?
k · tan(0.1π)
= | 6k
1−z −1
k · 1+z −1 + k · tan(0.1π)
[L0618] Solution:
tan(0.1π)(1 + z ) −1 a) Let the Hd (ejω ) denote the desired frequency response function. Since Hd (ejω ) is a
= periodic function of ω with the period 2π, it can be expressed as a Fourier series:
(1 + tan(0.1π)) − (1 − tan(0.1π))z −1
∞
The last task is to normalize the transfer function. The constant term in denominator X
Hd (ejω ) = hd [n]e−jωn ,
polynomial should be scaled to 1, and the maximum value of the amplitude response
n=−∞
to 1. While this is a Butterworth lowpass filter, the maximum is reached at
ω = 0, i.e., z = ejω |ω=0 = 1. where the Fourier coefficients hd [n] are the corresponding impulse response samples
given by Z π
1+z −1 1
|H(z)Bil |max = K · =1 hd [n] = Hd (ejω ) ejωn dω, −∞ ≤ n ≤ ∞
1−tan(0.1π) −1 z=1 2π −π
1− 1+tan(0.1π)
z
For most practical solutions, hd is of infinite length and noncausal. Therefore we
Finally, try to find a finite-duration impulse response sequence ht [n] of length 2M+1, whose
1 + z −1 DTFT Ht (ejω ) approximates the Hd (ejω ) in some sense. One commonly used ap-
HBil (z) = 0.2452 ·
1 − 0.5095z −1 proximation criteria is to minimize the integral squared-error
Z π
There is a zero at z = −1 and a pole at z = 0.5095. See Figure 121 for the amplitude 1
response in linear scale, in (power) desibels (20*log10(A)=10*log10(A2 )), and the Φ= |Ht (ejω ) − Hd (ejω )|2 dω
2π −π
pole-zero plot. Compare also to the filter obtained through the impulse-invariant
method in Figure 120. where
M
X
Ht (ejω ) = ht [n]e−jωn .
n=−M
It obvious from the latter form that the integral-squared error is a minimum when 70. Problem: Use windowed Fourier series method and design a FIR-type (causal) lowpass
ht [n] = hd [n], for −M ≤ n ≤ M, that is the best finite-length approximation to the filter with cutoff frequency 3π/4. Let the order of the filter be 4.
ideal infinite-length impulse response in the mean-square error sense is obtained by See Figure 122, in left the amplitude response of the ideal lowpass filter H(ejω ) with
truncation. cut-off frequency at 3π/4. In right, the corresponding inverse transform of the desired
The causality is achieved by delaying the ht [n] by M samples. (Mitra 2Ed Sec. 7.6.1, ideal filter hd [n], which is sinc-function according to the transform pair rect(.) ↔ sinc(.):
p. 447 / 3Ed Sec. 10.2.1, p. 527 )
b) Disadvantage is the oscillatory behaviour of Ht (ejω ) (Gibbs phenomenon). This hd [n] = {. . . , −0.1592, 0.2251, 0.75, 0.2251, −0.1592, . . .}
is caused by simple truncation (window function with abrupt transitions in time
domain) and the instability of the ideal filter. Possible solutions are the use of tapered
Ideal LP w = 3 π/4 → h [n], n ∈ (−10,..,10)
windows (fixed or adjustable) and specification of FIRs with smooth transitions. 1
c d
0.8
Magnitude
0.6
0.4
0.2
−0.2
π ω −10 −5 0 5 10
Figure 122: Problem 70: (a) The amplitude response of the ideal lowpass filter, and (b) the
corresponding impulse response h[n] values. The cut-off frequency is at ωc = 3π/4.
a) Use the rectangular window of length 5, see Figure 123(a). The window function is
wr [n] = 1, −M ≤ n ≤ M, M = 2
b) Use the Hamming window of length 5, see Figure 123(b). The window function is
2πn
wh [n] = 0.54 + 0.46 cos , −M ≤ n ≤ M, M = 2
2M
1 1
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
0 0
−4 −2 0 2 4 −4 −2 0 2 4
Figure 123: Problem 70: (a) rectangular window wr [n] of length 5, and (b) Hamming window
wh [n] of length 5.
[L0614] Solution: Digital FIR filter design with windowed (truncated) Fourier series
method. The idea is to find infinite-length impulse response of the ideal filter and truncate
it so that a realizable finite-length filter is obtained.
T-61.3010 DSP 2009 135/170 PROBLEMS – Part K 69-71 T-61.3010 DSP 2009 136/170 PROBLEMS – Part K 69-71
(a) hd [n] (IIR), (b) wr [n], and (c) ht [n] = hd [n] · wr [n] (FIR). 0.4 0.6 0.4
(a) Hd (ejω ) (ideal, desired), (b) Wr (ejω ), and (c) Ht (ejω ) = Hd (ejω ) ⊛ Wr (ejω ) (real- 0 0.2 0
−10 −5 0 5 10 −4 −2 0 2 4 −4 −2 0 2 4
Ideal LP wc = 3 π/4 → hd[n], n ∈ (−10,..,10) Rectangular window ht[n] using rectangular window
(a) (b) (c)
0.8 1 0.8
0 0.2 0
−0.2 0 −0.2
1 Wr(e )
jω jω
Ht(e ) using Hamming window
−10 −5 0 5 10 −4 −2 0 2 4 −4 −2 0 2 4 2.5 1
Magnitude
Figure 124: Problem 70(a): time domain view, (a) hd [n], (b) wr [n],(c) ht [n]. 1.5 0.6
1 0.4
0.5 0.2
π ω 0
0 0.2pi 0.4pi 0.6pi 0.8pi pi
0
0 0.2pi 0.4pi 0.6pi 0.8pi pi
1 W (e )
r
jω
jω
Ht(e ) using rectangular window
5
1 (a) (b) (c)
Magnitude
4
0.8
Figure 127: Problem 70(b): frequency domain (0 . . . π), (a) Hd (ejω ), (b) Wh (ejω ), (c) Ht (ejω ).
3 0.6
2 0.4
c) Some examples of window functions:
1 0.2
domain w[n]. The causal version can be obtained by shifting. Bottom left figure is 0.8
0.9
the window function in frequency domain W (ejω ). The third figure in right is the 0.6
0.8
0.4
amplitude frequency of actual filter which is obtained via window function method. 0.2
0.7
The desired lowpass filter Hd (ejω ) is drawn in dashed line, the implemented filter 0
−30 −20 −10 0 10 20 30
0.6
Ht (ejω ) = Hd (ejω ) ⊛ W (ejω ) is solid line. The cut-off frequency is at 100 Hz, and Hamming−window W(ejω), N=65
0.5
1 0.4
the sampling frequency is 1000 Hz. 0.8 0.3
0.4
0.1
i) Rectangular N=11 gives insufficient result. 0.2
0
ii) Rectangular N=65 gives sharp transition band but oscillates (Gibbs phenomenon). 0
0 0.5 1 1.5 2 2.5 3 3.5
0 50 100 150 200 250
frequency, Hz
300 350 400 450 500
iii) Hamming N=65 is flat both in passband and stopband but the transition band
is not as tight as in (ii).
Figure 130: Hamming window N = 65, see the text in Problem 70(c).
N=11, |Ht1(ejω)| = |Hd(ejω) * W1(ejω)|
Rectangular−window w[n], N=9
1
0.8
1
71. Problem: The following transfer functions H1 (z) and H2 (z) representing two different
filters meet (almost) identical amplitude response specifications
0.9
0.6
0.8
0.4
b0 + b1 z −1 + b2 z −2
0.2 0.7
0 0.6
H1 (z) =
−8 −6 −4 −2 0 2 4 6 8
0.5 1 + a1 z −1 + a2 z −2
Rectangular−window W(ejω), N=9
1 0.4
0.8
0.3
where b0 = 0.1022, b1 = −0.1549, b2 = 0.1022, a1 = −1.7616, and a2 = 0.8314, and
0.6
0.2
0.4
12
X
h[k]z −k
0.1
0.2
0
H2 (z) =
0 0 50 100 150 200 250 300 350 400 450 500
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 frequency, Hz k=0
where h[0] = h[12] = −0.0068, h[1] = h[11] = 0.0730, h[2] = h[10] = 0.0676,
Figure 128: Rectangular window N = 11, see the text in Problem 70(c). h[3] = h[9] = 0.0864, h[4] = h[8] = 0.1040, h[5] = h[7] = 0.1158, h[6] = 0.1201.
For each filter,
N = 65, |Ht2(ejω)| = |Hd(ejω) * W2(ejω)|
Rectangular−window w[n], N=65 a) state if it is a FIR or IIR filter, and what is the order
1
0.8 1
b) draw a block diagram and write down the difference equation
0.6
0.4
0.8 c) determine and comment on the computational and storage requirements
0.2
0
−30 −20 −10 0 10 20 30 0.6
d) determine first values of h1 [n]
Rectangular−window W(ejω), N=65
1
0.4
0.8
0.6
[L0730] Solution: The transfer functions H1 (z) and H2 (z) have been designed using the
0.4
0.2
same amplitude specifications, see Figure 131.
0.2
0
0
0 0.5 1 1.5 2 2.5 3 3.5
0 50 100 150 200 250
frequency, Hz
300 350 400 450 500
a) H1 (z) is IIR. There is a denominator polynomial.
H2 (z) is FIR. There is only the nominator polynomial.
Figure 129: Rectangular window N = 65, see the text in Problem 70(c). b) H1 (z) is an IIR filter. In order to show the feedback in time domain one has to use
inverse z-transform:
Y (z) b0 + b1 z −1 + b2 z −1
= H(z) =
X(z) 1 + a1 z −1 + a2 z −1
Y (z) 1 + a1 z −1 + a2 z −1 = X(z) b0 + b1 z −1 + b2 z −1 | Z −1 {.}
y[n] + a1 y[n − 1] + a2 y[n − 2] = b0 x[n] + b1 x[n − 1] + b2 x[n − 2]
From the difference equation the block diagram can be drawn (Figure 132). Note
that the same coefficients can be found also in the form of H1 (z).
T-61.3010 DSP 2009 139/170 PROBLEMS – Part K 69-71 T-61.3010 DSP 2009 140/170 PROBLEMS – Part L 72-76
−10 −10
h0 h1 h2 h12
y[n]
Power dB
Power dB
−20 −20
−30 −30
72. Problem: See the digital filter structure in Figure 134. Write down all equations for wi [n]
|H1 (ejω )| |H2 (ejω )| and y[n]. Create an equivalent matrix representation y[n] = Fy[n] + Gy[n − 1] + x[n],
T
Figure 131: Amplitude responses of H1 (z) and H2 (z) in Problem 71. where y[n] = w1 [n] w2 [n] w3 [n] w4 [n] y[n] . Verify the computability condition by
examining the matrix F. Develop a computable set of time-domain equations. Develop
the precedence graph (Mitra 2Ed Sec. 8.1, p. 515 / 3Ed Sec. 11.1, p. 589 ).
x[n] b0 y[n]
2
x[n] y[n]
z −1 −a1 z −1
b1 w1 −3
z −1 z −1 −1 w2 5
b2 −a2 Z−1
1 w3
Z−1
Figure 132: H1 (z) as a block diagram in Problem 71.
−2
Z−1 w4
The impulse response h[n] of FIR filter H2 (z) is directly seen and its length is 13
(finite impulse response). The block diagram consists only of multipliers and delays Figure 134: Problem 72: Digital filter structure.
(Figure 133).
c) From examination of the two difference equations the computational and storage
requirements for both filters are summarized in Table 10.
[L0701] Solution: In this problem issues of computable set of time-domain equations are
FIR IIR considered (Mitra 2Ed Sec. 8.1, p. 515 / 3Ed Sec. 11.1, p. 589 ). See the digital filter
Number of multiplications 13 5 structure in Figure 134.
Number of additions 12 4 The difference equations for wi [n] and y[n] can be written as
Storage locations (coefficients and data) 26 10
w1 [n] = x[n] − w3 [n] + w2 [n]
Table 10: Computational and storage requirements of H1 (z) and H2 (z). w2 [n] = −15w1 [n − 1]
w3 [n] = −3w1 [n − 1] + w4 [n]
It is evident that the IIR filter is more econimical in both computational and storage
w4 [n] = −2w3 [n − 1]
requirements than the FIR filter. However, there are some tricks to improve FIR
filter structure, see e.g. (Mitra 2Ed Sec. 6.3.3, 6.3.4 / 3Ed Sec. 8.3.3, 8.3.4 ) y[n] = 2x[n] − 3w1 [n]
d) A simple way to determine the impulse response is to insert an impulse x[n] = δ[n] Note that you cannot compute this ordered set of time-domain equatios in this order,
into input and compute recursively with difference equation what comes out in y[n]. i.e., the set is noncomputable. For instance, in order to get the value of w1 [n] one has
The registers are assumed to be zero in the initial moment. Another way to solve to compute w2 [n] and w3 [n] first. It is not directly seen either, if the structure contains
first values of h1 [n] is to apply long division. Unfortunately, both cases are heavy by delay-free loops (like wu [n] = ax[n] + . . . + bwu [n]).
hands. Inverse z-transform can be used in order to receive exact h[n]. Using Matlab,
We start from forming a matrix representation for the above set of equations using
h1 [n] = {0.1022, 0.0251, 0.0615, 0.0875, 0.1029, 0.1086, . . .}
y[n] = Fy[n] + Gy[n − 1] + x[n]
T-61.3010 DSP 2009 141/170 PROBLEMS – Part L 72-76 T-61.3010 DSP 2009 142/170 PROBLEMS – Part L 72-76
T
where y[n] = w1 [n] w2 [n] w3 [n] w4 [n] y[n] . F contains coefficients at the time
moment n, and G coefficients at the previous time n − 1. The matrix representation is
x[n] w1 w2 w3 w4 y[n] x[n] w1 w2 w3 w4 y[n]
w1 [n] 0 1 −1 0 0 w1 [n] 0 0 0 0 0 w1 [n − 1] x[n]
w2 [n] 0 0 0 0 0 w2 [n] −15 0 0 0 0 w2 [n − 1] 0
w3 [n] = 0 0 0 1 0 w3 [n] + −3 0 0 0 0 w3 [n − 1] + 0
Figure 136: Problem 72: (a) The reduced signal flow-graph obtained by removing outgoing
w4 [n] 0 0 0 0 0 w4 [n] 0 0 −2 0 0 w4 [n − 1] 0
branches from the input and all delay branches. All nodes with only outgoing brances, w2 and
y[n] −3 0 0 0 0 y[n] 0 0 0 0 0 y[n − 1] 2x[n] w4 , belong to the set {N1 }. (b) All outgoing branches from nodes in the set {N1 } have been
removed. All nodes with only outgoing brances, w3 , belong to the set {N2 }.
See the matrix F closer. If the diagonal element in F is nonzero, then the computation
of the present value wi[n] requires knowledge of itself (delay-free loop), which makes the
structure totally noncomputable.
The computable ordered set of equations is
Any nonzero element in the top triangular of F makes the ordered set of equation non-
computable. The task is to re-order the equations so that this triangular becomes zero. w2 [n] = −15w1 [n − 1]
A signal flow-graph representation of the filter structure is created in Figure 135. The w4 [n] = −2w3 [n − 1]
dependent and independent signal variables y[n] are represented as nodes. Note that here w3 [n] = −3w1 [n − 1] + w4 [n]
all different coefficients have been replaced by a single constant C = 1 (omitted) because w1 [n] = x[n] − w3 [n] + w2 [n]
we are not interested in exact values of variables.
y[n] = 2x[n] − 3w1 [n]
D
x[n] w1 D w2 w3 D w4 y[n]
w2[n]
Figure 137: Problem 72: Presedence graph with node sets Ni . Coefficients have been omitted.
First, remove all delay branches and branches going out from the input node, see the
reduced signal-flow chart in Figure 136(a). Label all those nodes which have only outgoing
brances into a set {N1 }. Second, remove all outgoing branches from nodes {N1 }, see
Figure 136(b). Label all nodes which have only outgoing brances into a set {N2 }. Repeat
until there is no nodes left. If the algorithm stops before, there is a delay-free loop and
the whole system is noncomputable. Here we get
{N1 } = {w2 , w4 }
{N2 } = {w3 }
{N3 } = {w1 }
{N4 } = {y}
The graph with branches and nodes shown in Figure 137 is called precedence graph
(Mitra 2Ed Sec. 8.1.2, p. 518 / 3Ed Sec. 11.1.2, p. 592 ). The computational order of
the variables inside the same set {Ni } can be chosen arbitrary.
T-61.3010 DSP 2009 143/170 PROBLEMS – Part L 72-76 T-61.3010 DSP 2009 144/170 PROBLEMS – Part L 72-76
73. Problem: Suppose that the calculation of FFT for a one second long sequence, sampled 74. Problem: Using radix-2 DIT FFT algorithm with modified butterfly computational
with 44100 Hz, takes 0.1 seconds. Estimate the time needed to compute (a) DFT of a one module compute discrete Fourier transform for the sequence x[n] = {2, 3, 5, −1} (Mitra
second long sequence, (b) FFT of a 3-minute sequence, (c) DFT of a 3-minute sequence. 2Ed Sec. 8.3.2, p. 538 / 3Ed Sec. 11.3.2, p. 610 ). The equation pair on rth level (Mitra
The complexities of DFT and FFT can be approximated with O(N 2 ) and O(N log2 N), 2Ed Eq. 8.42a, 8.42c, p. 543 / 3Ed Eq. 11.45a, 11.45c, p. 614 )
respectively.
Ψr+1 [α] = Ψr [α] + WNl Ψr [β]
[L0700] Solution: Fast Fourier Transform (FFT) is a computationally effective algorithm Ψr+1 [β] = Ψr [α] − WNl Ψr [β]
for calculating the Discrete Fourier Transform (DFT) of a sequence (Mitra 2Ed Sec. 8.3.2
/ 3Ed Sec. 11.3.2 ).
[L0766] Solution: Discrete Fourier transform (DFT)
The computational complexity of FFT is O(N log N) where N is the length of the se-
quence. The complexity of the basic algorithm for DFT is quadratic to the input length N
X −1
i.e. O(N 2 ). X[k] = x[n]WNnk k = 0...N − 1
Here, it is supposed that the calculation of FFT for a one second long sequence, sam- n=0
pled with 44100 Hz, takes 0.1 seconds. Thus, the length of the sequence is N = 1 s ×
where WN = e−j2π/N , can be computed efficiently using fast Fourier transform (FFT)
44100 Hz = 44100 samples and we can approximate the number of operations needed
algorithms. Algorithms are based on “divide and rule” – decomposing the N-point DFT
for the calculation as N log2 N (using the base-2 logarithm). Since performing these
computation into smaller ones, and taking advantage of the periodicity and symmetry
operations takes 0.1 seconds, we get the (average) execution time for a single operation:
properties of WNnk . The computational complexity of DFT is quadratic O(N 2 ) whereas
0.1s that of FFT is O(N log2 N). The difference is remarkable with large N. N is required
t= ≈ 147 ns to be power of two 2µ = N. In addition, the temporary results during the algorithm
44100 log2 (44100)
can be saved in the same registers (in-place computation), which is desirable for memory
a) The time needed to compute DFT of a one second long sequence is estimated as the management. See the literature for more details about deriving FFT algorithms (Mitra
number of operations needed times the execution time for a single operation: 2Ed Sec. 8.3.2, p. 540 / 3Ed Sec. 11.3.2, p. 610 ).
Here we apply radix-2 DIT FFT algorithm to compute DFT. DIT stands for decimation-
N 2 t = 441002 × 147 ns ≈ 300 s ≈ 5 min in-time and radix-2 means that the decimation factor is 2 at each step. Modified butterfly
module is depicted in Figure 138 and with equations (Mitra 2Ed Eq. 8.42a, 8.42c, p. 543
b) A 3-minute sequence, sampled with 44100 Hz, consists of N ′ = 180 s × 44100 Hz = / 3Ed Eq. 11.45a, 11.45c, p. 614 )
7938000 samples. Calculating FFT for N ′ takes approximately:
Ψr+1 [α] = Ψr [α] + WNl Ψr [β]
N ′ log2 (N ′ )t = 7938000 log2 (7938000) × 147 ns ≈ 30 s
Ψr+1 [β] = Ψr [α] − WNl Ψr [β]
c) Calculating DFT for N ′ takes approximately:
where r is the level of computation r = 1, . . . , µ, constant µ = log2 Nx[n] , and at each level
r the coefficients WNl : N = N(r) = 2r = 21 , . . . , 2µ , and l = 0, . . . , 2r−1 − 1. The number
(N ′ )2 t = 79380002 × 147 ns ≈ 9 · 106 s ≈ 100 d
of Ψr [m] is Nx[n] , m = 0, . . . , Nx[n] − 1.
It should be noted that these are only very crude approximations of the actual time it
takes to calculate the FFT and DFT algorithms with different sizes of input sequences. Ψr [α] Ψr+1[α]
The O(·) notation omits all additive constants and constant coefficients of the complexity
and concerns only the asymptotic behavior of complexity when N grows without limit.
In addition, the length of N is assumed to be a power of 2 in FFT algoritms. WN −1
Ψr [β] Ψr+1[β]
Here {Ψ1 [m]} is the input sequence in the bit-reversed order to be transformed, that is, a
sample x[(bµ . . . b2 b1 b0 )2 ] appears in the location m = (b0 b1 b2 . . . bµ )2 as Ψ1 [(b0 b1 b2 . . . bµ )2 ]
(bits bi ∈ {0, 1}).
The algorithm is efficient also in the sense that only values of one level r (number of Nx[n] )
has to be kept in the memory, this is called in-place computation.
T-61.3010 DSP 2009 145/170 PROBLEMS – Part L 72-76 T-61.3010 DSP 2009 146/170 PROBLEMS – Part L 72-76
Ψ2[0] Ψ3[0]
Hence, here we apply radix-2 DIT FFT algorithm to compute DFT of the sequence Ψ1[0] Ψ4[0]
x[n] = {2, 3, 5, −1}, where Nx[n] = 4 and µ = log2 4 = 2. Bit-reversed order gives the
starting point 0
W2 −1 Ψ2[1] Ψ3[1]
Ψ1[1] Ψ4[1]
(index (0)10 = (00)2 ) Ψ1 [0] = x[0] = 2 (bit-reversed (00)2 = (0)10 )
(index (1)10 = (01)2 ) Ψ1 [1] = x[2] = 5 (bit-reversed (10)2 = (2)10 ) Ψ2[2]
0
W4 −1 Ψ3[2]
Ψ1[2] Ψ4[2]
(index (2)10 = (10)2 ) Ψ1 [2] = x[1] = 3 (bit-reversed (01)2 = (1)10 )
(index (3)10 = (11)2 ) Ψ1 [3] = x[3] = −1 (bit-reversed (11)2 = (3)10 ) 0
W2 −1 Ψ2[3] 1
W4 −1 Ψ3[3]
Ψ1[3] Ψ4[3]
0
The flow-graph for the algorithm is depicted in Figure 139. Computing the layer r = 1 Ψ2[4] Ψ3[4] W8 −1
Ψ1[4] Ψ4[4]
where WNl = {W20 } = {1}
Ψ2 [0] = Ψ1 [0] + W20 Ψ1 [1] = 2 + 5 = 7 0
W2 −1 Ψ2[5] Ψ3[5] W8
1
−1
Ψ1[5] Ψ4[5]
Ψ2 [1] = Ψ1 [0] − W20 Ψ1 [1] = 2 − 5 = −3
0 2
Ψ2[6] Ψ3[6]
Ψ2 [2] = Ψ1 [2] + W20 Ψ1 [3] = 3 − 1 = 2 Ψ1[6]
W4 −1 W8 −1
Ψ4[6]
Ψ2 [3] = Ψ1 [2] − W20 Ψ1 [3] = 3 + 1 = 4
3
0 Ψ2[7] 1 Ψ3[7] W8
and the layer r = 2 with WNl = {W40 , W41 } = {1, −j} Ψ1[7]
W2 −1 W4 −1 −1
Ψ4[7]
W2
0
−1 Ψ2[1]
Ψ1[1] Ψ3[1] [L0768] Solution: Negative fractions are often represented in two’s complement form,
which is received from a positive fraction by inverting all bits and adding one.
0
Ψ2[2] W4 −1 a) 0∆ 10101 + 0∆ 01111
Ψ1[2] Ψ3[2]
1 1 1 1 1 carry
0
Ψ2[3] W1 0 ∆ 1 0 1 0 1
W2 −1 −1
Ψ1[3]
4 Ψ3[3] + 0 ∆ 0 1 1 1 1
1 ∆ 0 0 1 0 0
Figure 139: Problem 74: Flow-graph of the radix-2 DIT FFT algorithm with modified butterfly As the sign bit is 1, there has been overflow and the sum is not correct.
module.
b) 0∆ 01011 + 0∆ 10001
Remark. Radix-2 DIT FFT for the sequence of length N = 8 is just adding one layer 1 1 carry
more as can be seen in Figure 140. In practice N depends on the application, e.g., in 0 ∆ 0 1 0 1 1
speech processing N corresponding to 20 milliseconds with fT = 44100 Hz results to + 0 ∆ 1 0 0 0 1
0.02 · 44100 → either N = 512 or N = 1024. 0 ∆ 1 1 1 0 0
T-61.3010 DSP 2009 147/170 PROBLEMS – Part L 72-76 T-61.3010 DSP 2009 148/170 PROBLEMS – Part L 72-76
No overflow occured this time. 76. Problem: Express the decimal number −0.3125 as a binary number using sign bit and
c) The difference 0∆ 10101−0∆ 01111 can be carried out as an addition of positive binary four bits for the fraction in the format of (a) sign-magnitude, (b) ones’ complement, (c)
fraction 0∆ 10101 andd thw two’s-complement representation of −0∆ 01111, which is two’s complement. What would be the value after truncation, if only three bits are saved.
given by 1∆10001.
[L0764] Solution: The binary number representation is discussed in (Mitra 2Ed Sec. 8.4
1 1 carry / 3Ed Sec. 11.8 ). Now, −0.3125 = −5/16. We can express it in fixed-point representation
0 ∆ 1 0 1 0 1 using a sign bit s and four bits for the fraction.
+ 1 ∆ 1 0 0 0 1 There are three different forms for negative numbers, for which all the sign bit is 0 for a
10 ∆ 0 0 1 1 0 positive number and 1 for a negative number.
The extra 1 bit on the left of the sign bit is dropped resulting in 0∆00110, which is
the correct difference. a) Sign-magnitude format:P1∆ 0101.
b-bit fraction is always bi=1 a−i 2−i . For a negative number s = 1:
d) 0∆ 01011 − 0∆ 10001. The complement of −0∆ 10001 is given by 1∆01111.
S = −(0 · 2−1 + 1 · 2−2 + 0 · 2−3 + 1 · 2−4 ) = −0.3125.
1 1 1 1 carry b) Ones’ complement: 1∆ 1010. P
0 ∆ 0 1 0 1 1 Decimal number S = −s(1 − 2−b ) + bi=1 a−i 2−i . The negative number can also be
+ 1 ∆ 0 1 1 1 1 achieved by complementing all bits of the corresponding positive value (+0.3125 ,
1 ∆ 1 1 0 1 0 0∆ 0101 → 1∆ 1010 , −0.3125).
S = −1(1 − 2−4 ) + (1 · 2−1 + 0 · 2−2 + 1 · 2−3 + 0 · 2−4 )
which can be changed back to a positive fraction by inverting bits and adding one: = −0.9375 + 0.625 = −0.3125
−0∆ 00110.
c) Two’s complement: 1∆ 1011. P
Decimal number S = −s+ bi=1 a−i 2−i . It can also be achieved by complementing all
bits and adding 1 to the least-significant bit (LSB) (+0.3125 , 0∆ 0101 → 1∆ 1010 +
1 = 1∆ 1011 , −0.3125).
S = −1 + (1 · 2−1 + 0 · 2−2 + 1 · 2−3 + 1 · 2−4 )
= −1 + 0.6875 = −0.3125
After truncation
a) 1∆ 0101 → 1∆ 01 , −0.25
b) 1∆ 1010 → 1∆ 10 , −0.25
c) 1∆ 1011 → 1∆ 10 , −0.5
it can be seen that in this case truncation of (a) and (b) produced a bigger number, but
(c) a smaller. The analysis of quantization (truncation) process (Mitra 2Ed Sec. 9.1 /
3Ed Sec. 12.1 ) results to quantization errors depicted in Problem 78.
T-61.3010 DSP 2009 149/170 PROBLEMS – Part M 77-80 T-61.3010 DSP 2009 150/170 PROBLEMS – Part M 77-80
77. Problem: In the following Figure 141, some error probability density functions of the
Z ∞ Z b b
quantization error are depicted. 1 1 .1 2
f(e) (a) me = ef (e)de = e de = e
−∞ a b−a b−a 2
a
1 1 1 1 1
−∆/2 ∆/2 e = (b2 − a2 ) = (b − a)(b + a) = (b + a)
2b−a 2b−a 2
f(e) (b)
Z ∞ Z b 2
1 1
σe2 = (e − me )2 f (e)de = e − (a + b) de
−∆/2 ∆/2 e
−∞ a 2 b−a
f(e) (c) b 3
1 .1 1
= e − (a + b)
b−a 3 2
a
−∆ ∆ e
( 3 3 )
1 1 1 1
= b − (a + b) − a − (a + b)
Figure 141: Problem 77: Error density functions. 3b−a 2 2
( 3 3 )
1 1 1 1 1 1
(a) Rounding = b− a − a− b
3b−a 2 2 2 2
(b) Two’s complement truncation
(c) Magnitude (one’s complement) truncation 1 1 1
= (b − a)3 = (b − a)2
12 b − a 12
is used to truncate the intermediate results. Calculate the expectation value of the quan-
tization error me and the variance σe2 in each case.
R∞ Computation of mean and variance for each tree cases in the exercise paper, (a) rounding,
E[E] = −∞ f (e) e de, Var[E] = E[(E − E[E])2 ] = E[E 2 ] − (E[E])2
(b) two’s complement truncation, and (c) magnitude truncation.
[L0752] Solution: In this problem we are analysing different types of quantization meth- a) Rounding: a = − ∆2 , b = ∆
2
ods. ∆ here means the quantization step, ∆ = 2−B . For example, if we are using
(B + 1) = (4 + 1) bits and fixed-point numbers with two’s complement representation, 1 ∆ ∆
me = (− + ) = 0
possible 2B+1 = 32 quantized values are 2 2 2
{−1, −15/16, −14/16, . . . , 14/16, 15/16}. 2
1 ∆ ∆ ∆2
The area (integral) of the propability density function f (e) is always one. All the dis- σe2 = − − =
tributions are uniform. Hence, f (e) (height of the box) of each pdf is easily computed. 12 2 2 12
We first compute E[E] = me and Var[E] = E[(E − E[E])2 ] = σe2 for general uniform b) Two’s complement truncation: a = −∆, b = 0
distribution (see Figure 142).
1 ∆
me = (−∆ + 0) = −
f(e) 2 2
1/(b−a) 1 ∆2
σe2 = [0 − (−∆)]2 =
e 12 12
a b
c) Magnitude truncation: a = −∆, b = ∆
Figure 142: Computing the mean and variance of general uniform distribution in Problem 77. 1
me = (−∆ + ∆) = 0
2
1 1 ∆2
[∆ − (−∆)]2 =
a≤e≤b σe2 =
f (e) = b−a 12 3
0 e< a∨e> b
T-61.3010 DSP 2009 151/170 PROBLEMS – Part M 77-80 T-61.3010 DSP 2009 152/170 PROBLEMS – Part M 77-80
78. Problem: In this problem we study the roundoff noise in direct form FIR filters. Consider Transfer functions from noise sources to the output are equal to unity. Total output
an FIR filter of length N having the transfer function noise is thus
N
X −1
N −1 e[n] = ei [n] .
X
i=0
H(z) = h[k]z −k .
k=0 The expectation of the total noise is E[e[n]] = 0 because rounding was applied. The
Sketch the direct form realization of the transfer function. variance of the noise is
2
σe,tot = E e2 [n] − E[e[n]] 2
a) Derive a formula for the roundoff noise variance when quantization is done before | {z }
summations. =0 (rounding)
!2
b) Repeat (a) for the case where quantization is done after summations, i.e. a double N
X −1
N
[L0753] Solution: Direct form realization of the filter. Quantization blocks are marked X −1
NX−1
2−2B
= E e2i [n] = σe2 = Nσe2 = N
by Q in Figure 143. 12
i=0 i=0
x[n]
z −1 z −1 z −1
b) The model, when quantization is done after summations, is drawn in Figure 145.
Now there is only one quantization point, i.e., there is only one noise source, e[n].
h[0] h[1] h[N − 1] The expectation of the total noise is again E[e[n]] = 0. However, variance is smaller.
This is achieved by using more bits in temporary computations.
2 2−2B
Q Q Q ⇒ σe,tot = σe2 = .
12
y[n]
x[n]
z −1 z −1 z −1
a) The roundoff noise model (ei [n]:s are error sources), when quantization is done before
y[n]
summations, is depicted in Figure 144.
Q
x[n]
z −1 z −1 z −1
Figure 145: Filter with only one quantization point in Problem 78.
h[0] h[1] h[N − 1]
Remark. Consider a receipt with several products. In (a) you would round each purchase
y[n] before summing whereas in (b) you sum all purchases and round them in the end. While
this is done for a set of receipts, expectation and variance can be computed.
Figure 144: Roundoff noise model with N quantization points in Problem 78.
It is assumed that the quantization is done using rounding. B + 1 bits are used in
the coefficient quantization (∆ = 2−B ):
2−2B
⇒ σe2 = , me = 0 for all ei [n], i = 0, . . . , N − 1.
12
T-61.3010 DSP 2009 153/170 PROBLEMS – Part M 77-80 T-61.3010 DSP 2009 154/170 PROBLEMS – Part M 77-80
79. Problem: The effect of the additive quantization noise e[n] on the input signal x[n] can 80. Problem: The quantization errors occuring in the digital systems may be compensated
be evaluated by computing the signal-to-quantization noise ratio (SNR A/D ) in dB defined by error-shaping filters (Mitra 2Ed Sec. 9.10 / 3Ed Sec. 12.10 ). The error components
by 2 are extracted from the system and processed e.g. using simple digital filters. In this way
σx part of the noise at the output of the system can be moved to a band of no interest.
SNR A/D = 10 log10 dB ,
σe2 Consider a lowpass DSP system with a second-order noise reduction system in Figure 146.
where σx2 and σe2 are the input signal and noise variances, respectively.
a) What is the transfer function of the system if infinite wordlength is used?
b) Derive an expression for the transform of the quantized output, Y (z), in terms of
For a bipolar (b + 1)-bit A/D converter, the quantization noise power can be expressed as the input transform, X(z), and the quantization error, E(z), and hence show that
2−2b (RF S )2 the error feedback network has no adverse effect on the input signal.
σe2 = , c) Deduce the expression for the error feedback function.
48
d) What values k1 and k2 should have in order to work as an error-shaping system?
where RF S = Kσx is the full-scale range of the converter.
z−1 z−1
Derive the formula for SNR A/D in the case of a bipolar (b + 1)-bit A/D converter and e[n]
calculate the SNR A/D ratios for 8, 12, and 16 bit converters with K = 6. k2 k1
−1
[L0770] Solution: Signal-to-quantization noise ratio in the case of a bipolar (b + 1)-bit
x[n] y[n]
A/D converter: Q
1 w[n]
2 z−1 z−1
σx
SNR A/D = 10 log10
σ2
e 2 1.75
48σx2 z−1 z−1
= 10 log10
2−2b (RF S )2
σx2 1 −0.81
= −10 log10 2−2b + 10 log10 48 + 10 log10
(RF S )2
Figure 146: Second-order system with second-order noise reduction in Problem 80.
RF S
= 6.02b + 16.81 − 20 log10 dB
σx
Now, RF S = Kσx = 6σx and b is the used bitrate minus one. Therefore, we get: [L0765] Solution: The quantization errors produced in digital systems may be com-
pensated by error-shaping filters. First-order and second-order feedback structures are
b=7 : SNR A/D = 6.02 · 7 + 16.81 − 20 log10 (6) = 43.39 dB
introduced in (Mitra 2Ed Sec. 9.10.1, 9.10.2 / 3Ed Sec. 12.10.1, 12.10.2 ). The error
b = 11 : SNR A/D = 6.02 · 11 + 16.81 − 20 log10 (6) = 67.47 dB components are extracted from the system and processed e.g. using simple digital filters.
b = 15 : SNR A/D = 6.02 · 15 + 16.81 − 20 log10 (6) = 91.56 dB This way the noise at the output of the system can be reduced.
Consider first the block diagram shown in Figure 147(a) and its round-off noise model in
Figure 147(b).
a) If infinite precision is used, the quantization is not needed and e[n] ≡ 0 (see Fig-
ure 147(b) with e[n] = 0). In that case, the system function is
1 + 2z −1 + z −2
H(z) =
1 − 1.75z −1 + 0.81z −2
Computing zeros and poles we get a pole-zero diagram from which it can be derived
that the filter is lowpass (Figure 148).
b) From Figure 147(a) it can be obtained the following difference equations:
e[n] = y[n] − w[n]
w[n] = (x[n] + 2x[n − 1] + x[n − 2])
+ (1.75y[n − 1] − 0.81y[n − 2])
+ (k1e[n − 1] + k2 e[n − 2])
T-61.3010 DSP 2009 155/170 PROBLEMS – Part M 77-80 T-61.3010 DSP 2009 156/170 PROBLEMS – Part M 77-80
z−1 z−1 z−1 z−1 d) Without error-shaping the quantized output spectrum is
e[n]
k2 k1 k2 k1 Yu (z) = H(z)X(z) + Heu (z)E(z)
e[n]
−1
Error-shaping filter Hes (z) should efficiently discard the effects of the poles of Heu (z).
x[n] y[n] x[n] y[n] Error-feedback coefficients are chosen to be simple integers or fractions (ki = 0, ±0.5, ±1, ±2),
Q
1 w[n] 1 w[n] so that the multiplication can be performed using a binary shift operation and it
z−1 z−1 z−1 z−1 will not introduce an additional quantization error. Choosing k1 = −2, k2 = 1,
Hes (z) = 1 − 2z −1 + z −2 is a highpass filter with two zeros at z = 1. Finally, the
2 1.75 2 1.75 compensated output spectrum Ys (z) with random white round-off noise E(z) = 1,
z−1 z−1 z−1 z−1 can be written as (see Figure 149)
80 20 0.5
0.5
Imaginary Part
15
60 0
2
0
10
−0.5
40
5
−0.5 −1
20 −1 −0.5 0 0.5 1
0 Real Part
0 0.5 1 1.5 2 2.5 3
−1 1
4
0
−1 −0.5 0 0.5 1 0 0.5 1 1.5 2 2.5 3
3.5
0.5
Imaginary Part
3
Figure 148: Problem 80: (a) The pole-zero plot and (b) the magnitude response of H(z) = 2.5
0
2
1.5 −0.5
1
0.5 −1
After z-transform, 0
−1 −0.5 0 0.5 1
0 0.5 1 1.5 2 2.5 3 Real Part
h 1 + 2z −1 + z −2 i h 1 + k z −1 + k z −2 i
1 2 1
Y (z) = X(z) + E(z) 1.5
1 − 1.75z −1 + 0.81z −2 1 − 1.75z −1 + 0.81z −2
0.5
Imaginary Part
= H(z)X(z) + He (z)E(z) 1
0
2
It can be observed that the noise transfer function He (z) modifies only the quanti- −0.5
0.5
zation error.
−1
c) The noise transfer function is 0
−1 −0.5 0 0.5 1
0 0.5 1 1.5 2 2.5 3 Real Part
1 + k1 z −1 + k2 z −2
He (z) = = Heu (z) Hes (z)
1 − 1.75z −1 + 0.81z −2 Figure 149: Problem 80: First row, Heu (z), error without feedback. Second row, Hes (z), com-
Notice that without error-shaping feedback structure, i.e., k1 = 0 and k2 = 0, the pensation by FIR-2 error feedback. Third row, He (z), compensation by FIR-2 error feedback.
noise transfer function is (u = unshaped)
1
Heu (z) =
1 − 1.75z −1 + 0.81z −2
So, the error-feedback circuit is actually shaping the error spectrum by (s = shaping)
Hes (z) = 1 + k1 z −1 + k2 z −2
T-61.3010 DSP 2009 157/170 PROBLEMS – Part N 81-86 T-61.3010 DSP 2009 158/170 PROBLEMS – Part N 81-86
spectrum is a peak at the frequence f = 10 Hz (top middle) or at ω = 2πf /fs = 0.2π 0.5
0.5 0.5
x[n]
0 0.3 0.3
a) Sketch the output sequence xu [n] with circles using up-sampler with up-sampling
0.2 0.2
factor L = 2, and draw its spectra into second row. Original sequence values of x[n]
−0.5
are marked with crosses. The spectrum in middle column is 0..200 Hz and in right 0.1 0.1
0
0.2 0.2 In the frequency domain the sampling frequency is multiplied by L, hence, the new
0 0 sampling frequency is 200 Hz. L − 1 images from the original spectrum are emerged
−1
0 0.05 0.1 0.15 0.2 0 50 100 150 200 0 1 2 equivalently between 0 and fs,new .
1
xu[n] = x[n/2]
0.6 0.6 1
0.6 Image fs 0.6 ωs/2
0.4 0.4
0 0.5
0.5 0.5
xu[n] = x[n/2]
0 0.3 0.3
−1 0 0 0.2 0.2
0 0
−1
Figure 150: Empty figures for Problem 81. The up-sampling factor L = 2, and the down- 0 0.05 0.1 0.15 0.2 0 50 100 150 200 0 pi 2pi
sampling factor M = 2. Left column: sequence x[n] with circles, fill in the sequences xu [n] Figure 152: Problem 81(a). Up-sampled signal xu [n], factor L = 2. The sampling frequency is
and xd [n]. X-axis: time (0 . . . 0.2 s). Middle column: Spectrum X(ejf ) (10 Hz component, increased to 200 Hz, and there is an image spectrum.
100 Hz sampling frequency), fill in the spectra Xu (ejf ) and Xd (ejf ). X-axis: frequency
(0 . . . 200 Hz). Right column: Spectrum X(ejω ) (2π · (10/100) = 0.2π), fill in the spectra
Notice that if you ideally convert the sequence xu [n] into continuous-time xu (t) you
Xu (ejω ) and Xd (ejω ). X-axis: angular frequency (0 . . . 2π).
will find also a high frequency component, an image component. Normally images
are filtered out using a lowpass filter (see anti-imaging and anti-aliasing filters). See
Figure 153.
b) Down-sampling with factor M = 2 means taking only every second sample.
[L0910] Solution: Sometimes it is necessary or useful to change the sampling frequency
fs . Consider music formats DAT (48 kHz) and CD (44.1 kHz). xd [n] = x[nM] = x[2n]
T-61.3010 DSP 2009 159/170 PROBLEMS – Part N 81-86 T-61.3010 DSP 2009 160/170 PROBLEMS – Part N 81-86
0 z −1 z −1
u
T = 0.1 s, f = 10 hz
−1 1 1
0
uLP
x
−1
Upsampled and LP−FILTERED (image filtered out), x [n]
Figure 155: Multirate system of Problem 82.
uLP
0.5 0.5
version of the input as X ′ (z) = z −1 X(z). Furthermore, note that W2−1 = ej2π/2 = −1.
0.5
1
1X 1 1
X(z 1/2 W2−k ) = X(z 1/2 ) + X(−z 1/2 )
0 0.3 0.3
V (z) =
0.2 0.2
2 k=0 2 2
−0.5
0.1 0.1
0 0 1
−1 1 X ′ 1/2 −k 1 1
0 0.05 0.1 0.15 0.2 0 50 100 150 200 0 pi 2pi
W (z) = X (z W2 ) = z −1/2 X(z 1/2 ) − z −1/2 X(−z 1/2 )
Figure 154: Problem 81(b). Down-sampled signal xd [n], factor M = 2. The sampling frequency 2 k=0 2 2
is decreased to 50 Hz. 1 1
Vu (z) = V (z 2 ) = X(z) + X(−z)
2 2
2 1 −1 1
Wu (z) = W (z ) = z X(z) − z −1 X(−z)
2 2
Y (z) = z −1 Vu (z) + Wu (z) = z −1 X(z)
83. Problem: Show that the factor-of-L up-sampler xu [n] and the factor-of-M down-sampler 84. Problem: Consider the multirate system shown in Figure 156 where H0 (z), H1 (z), and
xd [n] defined as in Problem 81 are linear systems. H2 (z) are ideal lowpass, bandpass, and highpass filters, respectively, with frequency re-
sponses shown in Figure 157(a)-(c). Sketch the Fourier transforms of the outputs y0 [n],
[L0911] Solution: First, consider the up-sampler. Let x1 [n] and x2 [n] be two arbitrary y1 [n], and y2 [n] if the Fourier transform of the input is as shown in Figure 157(d).
inputs with y1 [n] and y2 [n] as the corresponding outputs. Now, y0 [n]
H0 (z)
x1 [n/L] : n = 0, ±L, ±2L, . . .
y1 [n] =
0 : otherwise x[n] y1 [n]
↓3 ↑3 H1 (z)
x2 [n/L] : n = 0, ±L, ±2L, . . .
y2 [n] =
0 : otherwise
y2 [n]
H2 (z)
Let us now apply the input x3 [n] = αx1 [n] + βx2 [n] with the corresponding output y3 [n]
as Figure 156: Multirate system of Problem 84.
αx1 [n/L] + βx2 [n/L] : n = 0, ±L, ±2L, . . . H0 (ejω ) H1 (ejω )
y3 [n] =
0 : otherwise
1 1
αx1 [n/L] βx2 [n/L] : n = 0, ±L, ±2L, . . .
= +
0 0 : otherwise
= αy1 [n] + βy2 [n]
0 ω 0 ω
0 π/3 2π/3 π 0 π/3 2π/3 π
Thus, the up-sampler is a linear system.
Now, consider the down-sampler with the inputs x1 [n] and x2 [n] and the corresponding
H2 (ejω ) X(ejω )
outputs y1 [n] and y2 [n]. Now, y1 [n] = x1 [nM] and y2 [n] = x2 [nM]. By applying the input
x3 [n] = αx1 [n] + βx2 [n] we get the corresponding output y3 [n] = x3 [nM] = αx1 [nM] + 1 1
Figure 157: (a)-(c) Ideal filters H0 (z), H1 (z), H2 (z), (d) Fourier transform of the input of
Problem 84.
[L0912] Solution: First, let us denote the down-sampled signal as xd [n] and the again
up-sampled signal as xu [n], shown in Figure 158.
y0 [n]
H0 (z)
y2 [n]
H2 (z)
The corresponding Fourier transforms (spectra) Xd (z) and Xu (z) are as follows (notice
the reduced amplitude) in Figure 159.
Now, the Fourier transforms of the outputs Y0 (z), Y1 (z), and Y2 (z), are obtained by
(ideally) filtering Xu (z). The output spectra are in Figure 160.
T-61.3010 DSP 2009 163/170 PROBLEMS – Part N 81-86 T-61.3010 DSP 2009 164/170 PROBLEMS – Part N 81-86
2πn
w[n] = 0.54 + 0.46 cos( ) − M ≤ n ≤ +M
2M
0 ω 0 ω 0 ω
0 π/3 2π/3 π 0 π 2π 0 π 2π
The window length is 2M + 1 and the window/filter order N = 2M. When having
the specifications ωp = 0.15π and ωs = 0.2π we get ∆ω = 0.05π. The connection of
Figure 159: Original, upsampled and downsampled spectrum in Problem 84. M and transition band ∆ω with Hamming window is
H0 (ejω ) H1 (ejω ) H2 (ejω ) 3.32π
M =⌈ ⌉
1 1 1 ∆ω
where ⌈.⌉ is rounding up to the next integer. Minimum order with Hamming window
0 0 0
is
0 π/3 2π/3 π
ω
0 π/3 2π/3 π
ω
0 π/3 2π/3 π
ω 3.32π 3.32
Y0 (ejω ) Y1 (ejω ) Y2 (ejω ) N = 2M = 2 · ⌈ ⌉ = 2·⌈ ⌉ = 134
∆ω 0.05
1 1 1
3 3 3
c) The cut-off frequency of the filter in the window method is defined to be ωc =
0.5 · (ωp + ωs ). The filter of order N = 2M is computed by
0 ω 0 ω 0 ω
0 π/3 2π/3 π 0 π/3 2π/3 π 0 π/3 2π/3 π hF IR [n] = hideal [n] · w[n], −M ≤ n ≤ M
where hF IR [n] is the filter constructed from the ideal filter with cut-off at ωc = 0.175π
Figure 160: Bandpass filters in top row, and corresponding Output spectra in bottom row in multiplied by a Hamming window with M = 67
Problem 84.
sin(ωc n) ωc ωc n
hideal [n] = = sinc( ) = 0.175 sinc(0.175n) −∞<n<∞
85. Problem: Consider a FIR filter, whose specifications are (i) lowpass, (ii) passband ends πn π π
2πn
at ωp = 0.15π, (iii) stopband starts from ωs = 0.2π, (iv) passband maximum attenuation w[n] = 0.54 + 0.46 cos( ) − 67 ≤ n ≤ 67
134
is 1 dB, (v) stopband minimum attenuation is 50 dB. The filter is to be implemented 2πn
using truncated Fourier series method (window method) with Hamming window. hF IR [n] = 0.175 sinc(0.175n) · 0.54 + 0.46 cos( ) − 67 ≤ n ≤ 67
134
a) Sketch the specifications on paper. In the origo w[0] = 1 and hF IR [0] = hideal [0] = 0.175. The magnitude response of
b) The filter order N can be estimated using (Mitra 2Ed Table 7.2 / 3Ed Table 10.2 ): the filter is in Figure 161(b) with thick line HF IR (z). It can be seen that the filter
the transition bandwith is ∆ω = |ωp −ωs |, and for Hamming window ∆ω = 3.32π/M, fulfills given specifications.
where the window w[n] is in range −M ≤ n ≤ +M. What is the minimum order N 10 HFIR(z)
which fulfills the specifications? 0 0
H (z)
IFIR
c) The cut-off frequency of the filter in the window method is defined to be ωc = −10
Passband
Passband
−20
0.5 · (ωp + ωs ). Derive an expression for hF IR [n] when using (a) and (b). What is −20
−30 Stopband
the value of hF IR [n] at n = 0? Stopband
−40
−40
d) Consider now another way to implement a FIR filter with the same specifications. In −50 −60
the interpolated FIR filter (IFIR) (Mitra 2Ed Sec. 10.3, p. 680 / 3Ed Sec. 10.6.2, −60
p. 568 ) the filter is a cascade of two FIR filters HIF IR (z) = G(z L ) · F (z). Using −70
−80
the factor L = 4 compute the order of HIF IR (z) = G(z L ) · F (z) and compare to the 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Using the factor L = 4 the following filters will be implemented, see also Fig- T-61.3010 Digital Signal Processing and Filtering
ure 162(a): G(z) with cut-offs ωp = 4 · 0.15π = 0.6π and ωs = 4 · 0.2π = 0.8π. Formulas for spring 2009. Corrections and comments to [email protected], thank you! This
After upsampling, there will be L − 1 zeros between each g[n], and L − 1 spectrum list is available also as a two-page two-column version from the course web page.
“images”. The normalized cut-off frequencies for G(z 4 ) are ωp = 0.15π and ωs = 0.2π.
The target of F (z) is to filter out all “image” components. So, the stopband can start Formulas
from that frequency where the first “image” appears: ωp = 0.15π and ωs = 0.3π.
Both filters G(z) and F (z) are implemented in the same way with Hamming window. Basic math stuff
The order of G(z) is 34 with ∆ω = |0.8π − 0.6π| and ωc = 0.7π. After that G(z) Even and odd functions:
is modified to G(z 4 ) by adding zeros in g[n]. The order of F (z) is 46 with ∆ω = Even{x(t)} = 0.5 · [x(t) + x(−t)]
|0.3π − 0.15π| and ωc = 0.225π. All corresponding magnitude responses are plotted Odd{x(t)} = 0.5 · [x(t) − x(−t)]
in Figure 162(b). The magnitude response of HIF IR(z) is drawn in Figure 161(b) Roots of second-order polynomial: √
with thin line HIF IR(z). Specifications are met and the overall behavior is very ax2 + bx + c = 0, x = (−b ± b2 − 4ac)/(2a)
similar to that of HF IR (z). Logarithms, decibels:
log (A · B/C)D = D · log A + log B − log C
G(z) G(z) 0 loga b = logc b/ logc a
−30
−60 decibels: 10 log10 (B/B0 ), 20 log10 (A/A0 )
0 0.6 0.8 1 −90 10 log10 (0.5) ≈ −3.01 dB, 20 log10 (0.5) ≈ −6.02 dB
0 0.2 0.4 0.6 0.8 1
G(z) 20 log10 (0.1) = −20 dB, 20 log10 (0.01) = −40 dB
0
G(z4)
F(z) 0
−30 ejθ = cos(θ) + j sin(θ) (Euler’s formula)
IFIR
0.15
−60 cos(θ) = (1/2) · (ejθ + e−jθ ), sin(θ) = (1/2j) · (ejθ − e−jθ )
H
T-61.3010 DSP 2009 167/170 FORMULAS T-61.3010 DSP 2009 168/170 FORMULAS
(
1, t > 0 Time reversal. Transform variable is reversed, e.g.,
µ(t) = x[−n] ↔ X(e−jω )
0, t < 0
d Differentiation. In time and frequency domain, e.g.,
δR∆ (t) = dt µ∆ (t), δ(t) = lim∆→0 δ∆ (t) (Dirac’s delta) d
∞ x[n] − x[n − 1] ↔ (1 − e−jω )X(ejω ), nx[n] ↔ j dω X(ejω )
δ(t) dt = 1
R−∞
∞ Duality. Convolution property: convolution in time domain corresponds multiplication in
δ(t − t0 )x(t) dt = x(t0 )
−∞ R transform domainR x1 [n] ⊛ x2 [n] ↔ X1 (e ) · X2 (ejω ) and multipication property, vice versa,
jω
In DSP notation 2πδ(t) is computed 2π δ(t) · 1 dt = 2π, when t = 0, and = 0 elsewhere. 1
x1 [n] · x2 [n] ↔ 2π X1 (ejθ )X2 (ej(ω−θ) ) dθ
2π P R
1
Discrete-time
( unit impulse and
( unit step functions: Parseval’s relation. Energy in signal and spectral components: |x[n]|2 = 2π 2π
|X(ejω )|2 dω
1, n = 0 1, n ≥ 0 Fourier
δ[n] = µ[n] = Pseries of jkΩ
continuous-time periodic signals:
0, n 6= 0 0, n < 0 x(t) = R ∞ k=−∞ ak e
0t
(synthesis)
1 −jkΩ0 t
Periodic signals ak = T T x(t) e dt (analysis)
∃T ∈ R : x(t) = x(t + T ), ∀t ∈ R x(t − t0 ) ↔ ak ejkΩ0t0
jM Ω0 t
∃N ∈ Z : x[n] = x[n + N], ∀n ∈ Z Re x(t) ↔ ak−M
Fundamental period T0 , N0 is the smallest T > 0, N > 0. x (τ )xb (t −Pτ ) dτ ↔ T ak bk
T a
xa (t)xb (t) ↔ l al bk−l
Convolution d
x(t) ↔ jkΩ0 ak
dt
Convolution is commutative, associative and distributive.
R∞
y(t) = h(t) ⊛ x(t) = −∞ h(τ )x(t − τ ) dτ Continuous-time
R∞ Fourier-transform (CTFT):
1
P+∞ x(t) = 2π X(jΩ) ejΩt dΩ (synthesis)
y[n] = h[n] ⊛ x[n] = k=−∞ h[k]x[n − k] R−∞∞ −jΩt
P −1 X(jΩ) = −∞ x(t) e dt (analysis)
yC [n] = h[n] N x[n] = N k=0 h[k]x[< n − k >N ]
x(t − tk ) ↔ ejΩtk X(jΩ)
Correlation:
P e jΩk t
x(t) ↔ X(j(Ω − Ωk ))
rxy [l] = +∞ x[n]y[n − l] = x[l] ⊛ y[−l] xa (t) ⊛ xb (t) ↔ Xa (jΩ)Xb (jΩ)
Pn=−∞
rxx [l] = +∞
n=−∞ x[n]x[n − l] xa (t)xb (t) ↔ 2π 1
Xa (jΩ) ⊛ Xb (jΩ)
d
Mean and variance of random signal: dt
x(t) ↔ jΩX(jΩ)
d
R
mX =RE[X] = xpX (x)dx tx(t) ↔ j dΩ X(jΩ)
2
σX = (x − mX )2 pX (x)dx = E[X 2 ] − m2X ejΩ0 t ↔ 2πδ(Ω − Ω0 )
cos(Ω0 t) ↔ π[δ(Ω − Ω0 ) + δ(Ω + Ω0 )]
Frequencies, angular frequencies, periods: sin(Ω0 t) ↔ jπ[δ(Ω + Ω0 ) − δ(Ω − Ω0 )]
Here fs (also fT later) is the sampling frequency. x(t) = ( 1 ↔ 2πδ(Ω)
Frequency f , [f ] = Hz = 1/s.
1, |t| < T1
Angular frequency Ω = 2πf = 2π/T , [Ω] = rad/s (analog). x(t) = ↔ 2 sin(ΩT
Ω
1)
Normalized angular frequency ω = 2πΩ/Ωs = 2πf /fs , [ω] = rad/sample (digital). 0, |t| > T1
(
Normalized frequency in Matlab fM AT LAB = 2f /fs , [fM AT LAB ] = 1/sample. sin(W t) 1, |Ω| < W
πt
↔ X(jΩ) =
Sampling of xa (t) by sampling frequency fT 0, |Ω| > W
xp [n] = xa (nT δ(t) ↔ 1
P) = xa (n/fT )
Xp (jΩ) = T1 ∞ k=−∞ Xa (j(Ω − kΩT ))
δ(t − tk ) ↔ ejΩtk
1
e−at µ(t) ↔ a+jΩ , where Real{a} > 0
Integral transforms. Properties
Here all integral transforms share some basic properties. Examples given with CTFT, x[n] ↔ Discrete-timeR Fourier-transform (DTFT):
1
X(ejω ), x1 [n] ↔ X1 (ejω ), and x2 [n] ↔ X2 (ejω ) are time-domain signals with corresponding x[n] = 2π P2π
X(ejω ) ejωn dω (synthesis)
jω ∞
transform-domain spectra. a and b are constants. X(e ) = n=−∞ x[n] e−jωn , periodic with 2π (analysis)
Linearity. All transforms are linear. x[n − k] ↔ e−jkω X(ejω )
ax1 [n] + bx2 [n] ↔ aX1 (ejω ) + bX2 (ejω ) ejωk n x[n] ↔ X(ej(ω−ωk ) )
Time-shifting. There is a kernel term in transform, e.g., x1 [n] ⊛ x2 [n] ↔ XR1 (ejω ) · X2 (ejω )
1
x[n − k] ↔ e−jkω X(ejω ) x1 [n] · x2 [n] ↔ 2π 2π
X1 (ejθ )X2 (ej(ω−θ) ) dθ
d
Frequency-shifting. There is a kernel term in signal e.g., nx[n] ↔ j dω PX(ejω )
jω0 n
ejωk n x[n] ↔ X(ej(ω−ωk ) ) e ↔ 2π lP δ(ω − ω0 − 2πl)
Conjugate symmetry x∗ [n] ↔ X ∗ (e−jω ). If x[n] ∈ R, then X(ejω ) = X ∗ (e−jω ), |X(ejω )| = cos(ω0 n) ↔ π Pl [δ(ω − ω0 − 2πl) + δ(ω + ω0 − 2πl)]
|X(e−jω )|, ∠X(ejω ) = −∠X(e−jω ). If x[n] ∈ R and even, then X(ejω ) ∈ R and even. If sin(ω0 n) ↔ jπ P l [δ(ω + ω0 − 2πl) − δ(ω − ω0 − 2πl)]
x[n] ∈ R and odd, then X(ejω ) purely ∈ C and odd. x[n] = 1 ↔ 2π l δ(ω − 2πl)
T-61.3010 DSP 2009 169/170 FORMULAS T-61.3010 DSP 2009 170/170 FORMULAS
(
1, |n| ≤ N1 sin(ω(N1 +0.5)) H[k] = H(ejω )|ω=2πk/N
x[n] = ↔ sin(ω/2) Group delay τ (ω) = − dω d
∠H(ejω )
0, |n| > N1
( Four types of linear-phase FIR filters, h[n] = h[N − 1 − n] (even/odd symmetric), or h[n] =
sin(W n) W 1, 0 ≤ |ω| ≤ W −h[N − 1 − n] (e/o antis.). Zeros symmetric w.r.t. unit circle: r e±jθ and (1/r) e∓jθ .
πn
= π
sinc( Wπn ) ↔ X(ejω ) =
0, W < |ω| ≤ π Important transform pairs and properties:
δ[n] ↔ 1 a δ[n − k] ↔ a e−jkω ↔ a z −k
δ[n − k] ↔ e−jkω an µ[n] ↔ −jω −1
P 1/[1 − a e ] ↔ 1/[1 − a z ]
an µ[n] ↔ 1−ae1−jω , |a| < 1 h[n]P= i ki · ani µ[n] ↔ H(ejω ) =P ...
N-point Discrete Fourier-transform (DFT): . . . i ki /[1 − ai e−jω ] ↔ H(z) = i ki /[1 − ai z −1 ]
Connection to DTFT: X[k] = X(ejω )|ω=2πk/N a x[n − k] ↔ a e−jkω X(ejω ) ↔ a z −k X(z)
WN = e−j2π/N y[n] = h[n] ⊛ x[n] ↔ Y (z) = H(z) · X(z)
P −1
x[n] = N1 N −kn rectangular ↔ sinc, sinc ↔ rectangular
P −1 k=0 X[k]WN , 0 ≤ n ≤ N − 1 (synthesis)
X[k] = N n=0 x[n]W N
kn
, 0 ≤ k ≤ N − 1 (analysis) LTI filter design (synthesis)
−kn0
x[< n − n0 >N ] ↔ WN X[k] Bilinear transform H(z) = H(s)|s and prewarping
WN−nk0 x[n] ↔ X[< k − k0 >N ] s = k · (1 − z −1 )/(1 + z −1 ), k = 1 or k = 2/T = 2fT
yC [n] = h[n] N x[n] ↔ H[k] · X[k] = Y [k] Ωprewarp,c = k · tan(ωc /2), k = 1 or k = 2/T = 2fT
Spectral transformations, ω̂c desired cut-off
Laplace transform:
LP-LP z −1 = (ẑ −1 − α)/(1 − αẑ −1 ), where
Convergence with a certain ROC (region of convergence). Connection to continuous-time
α = sin(0.5(ωc − ω̂c ))/ sin(0.5(ωc + ω̂c ))
Fourier-transform:
R σ+j∞ s = stjΩ
1 LP-HP z −1 = −(ẑ −1 + α)/(1 + αẑ −1 ), where
x(t) = 2πj X(s)e ds (synthesis)
R ∞ σ−j∞ −st α = − cos(0.5(ωc + ω̂c ))/ cos(0.5(ωc − ω̂c ))
X(s) = −∞ x(t) e dt (analysis)
Windowed(Fourier series method
z-transform: 1, |ω| < ωc
H(ejω ) = ↔ h[n] = sin(ω c n)
= ωπc sinc( ωπc n )
Convergence with a certain ROC (region of convergence). Connection to discrete-time Fourier- 0, |ω| ≥ ωc πn
normalized angular frequency (normalisoitu kul- sampling frequency (näytteenottotaajuus), 23, wavread, 33
mataajuus), 12, 23 33, 76
notch filter (lovisuodin), 25 sekoitevaiheinen suodin (mixed-phase filter), 113 yksikköaskelfunktio (unit step function), 32
number representation (numeron esittäminen sequence (lukujono), 23, 32 yksikköimpulssifunktio (unit impulse function),
tietokoneessa), 15 Shannon sampling theorem (Shannonin näyt- 32
numeron esittäminen tietokoneessa (number rep- teenottoteoreema), 76 yksipuoleinen spektri (one-sided spectrum), 26
resentation), 15 Shannonin näytteenottoteoreema (Shannon sam- ympyräpuskuri (circular buffer), 15
näytteenottotaajuus (quantization level), 33 pling theorem), 76 ympyräsiirto (circular shift), 15, 91
näytteenottotaajuus (sampling frequency), 23, short-time Fourier transform (STFT) (lyhytaika zero-phase filter (nollavaiheinen suodin), 107
33, 76 Fourier-muunnos (STFT)), 27 zeros – roots of numerator polynomial (nollat
signaalin jaksollisuus (periodicity of signal), 34 – osoitinpolynomin juuret), 17
odd function (pariton funktio), 7 siirtofunktio (transfer function), 17, 31
one-sided spectrum (yksipuoleinen spektri), 26 sinc (sinc), 14, 21 äärellisen pitkä impulssivaste, FIR (finite im-
order (asteluku), 16 spectrogram (spektrogrammi), 27 pulse response, FIR), 38
osamurtohajotelma (partial fraction decompo- spectrum estimation (spekrin estimointi), 26 äärettömän pitkä impulssivaste, IIR (infinite
sition), 18 spekrin estimointi (spectrum estimation), 26 impulse response, IIR), 39
osamurtokehitelmä (partial fraction expansion), spektrogrammi (spectrogram), 27
18 stabiilisuusehto (stability condition), 48, 73
osoitin (phasor), 7, 10 stability condition (stabiilisuusehto), 48, 73
parillinen funktio (even function), 7 stationaarinen signaali (stationary signal), 27
pariton funktio (odd function), 7 stationary signal (stationaarinen signaali), 27
partial fraction decomposition (osamurtohajotelma),step response (askelvaste), 51
18 suodin, suodatin (filter), 24
partial fraction expansion (osamurtokehitelmä), suora muoto (direct form), 120
18 suorakulmainen koordinaatisto (Cartesian co-
periodicity of signal (signaalin jaksollisuus), 34 ordinate system), 6
perusjakso (fundamental period), 34 suotimen asteluku (filter order), 96
phasor (osoitin), 7, 10 superpositio (superposition), 44, 47
phasor.m, 10 superposition (superpositio), 44, 47
pienin yhteinen jaettava (least common multi- suurin yhteinen jakaja (greatest common divi-
ple), 36 sor), 36
poles – roots of denominator polynomial (navat taajuus (frequency), 23
– nimittäjäpolynomin juuret), 17 taajuustaso (frequency-domain), 31
polynomin juuret (roots of a polynomial), 16 taajuusvaste (frequency response), 31, 38, 39
pwelch, 26 tehokas laskenta (FFT) (in-place computation
quantization level (näytteenottotaajuus), 33 (FFT)), 144
quasi-periodic (kvasijaksollinen), 36 time-domain (aikataso), 31
transfer function (siirtofunktio), 17, 31
radiaanit (radians), 6 transform-domain (muunnostaso), 31
radians (radiaanit), 6 two-point moving average (kahden pisteen keskiar-
rajataajuus (cut-off frequency), 24 voistava suodin), 37
rajavärähtely (border effect), 37, 39 two-sided spectrum (kaksipuolinen spektri), 26
reaalimaailman signaalit (real-life signals), 36
real-life signals (reaalimaailman signaalit), 36 unit impulse function (yksikköimpulssifunktio),
remainder (jakojäännös), 15 32
residue (jäännös), 15 unit step function (yksikköaskelfunktio), 32
residuez, 18 vahvistaa (amplify), 24
ristikorrelaatio (cross-correlation), 64 vaimentaa (attenuate), 24
roots, 17 viivaspektri (line spectrum), 26
roots of a polynomial (polynomin juuret), 16 virtauskaavio (flow diagram), 38, 39