Digital Signal Processing Exercises with...
Transcript of Digital Signal Processing Exercises with...
Digital Signal Processing
Exercises with solutions
Nathalie Thomas
Master SATCOM
2018− 2019
Chapitre 1
Exercises
1.1 Digital Fourier Transform
The exercises in this section resume, on an example, the approximations
which have to be done in order to go from FT to DFT.
1.1.1 Exercise 1 : E�ect of sampling
Let's consider x(t) = cos(2πf0t), f0 = 10 kHz.
1. Plot the DFT of x(t) : X(f).
2. Is it possible to sample x(t) without loss of information ?
3. Plot the DFT of x(t), sampled at Te = 1/Fe, between 0 and Fe when :
(a) Fe = 30 kHz.
(b) Fe = 8 kHz.
4. From obtained samples we want to recover x(t) by lowpass �ltering at
Fe/2. What will be the obtained signal for each case of the previous
question ?
1.1.2 Exercise 2 : DFT of a function with continuous spec-
trum, e�ect of the limitation of the signal duration
Let's consider the following signal :
x(t) =
{e−at if t ≥ 0, a > 0
0 if t < 0(1.1)
1
x(t) is observed on a limited duration [0, L].
1. Show that the DFT of this limited part of x(t) can be written as :
XL(f) = X(f)G(f, L), where X(f) represents the DFT of the unli-
mited signal x(t) and G(f, L) has to be determined.
2. Determine the modulus of G(f, L).
3. Show that |G(f, L)| ∈[1− e−aL, 1 + e−aL
].
4. Evaluate the bounds for L = 4a .
5. Determine the phase of G(f, L).
6. Using limited developments when L >> 1a , show that we can get :
Arg [G(f, L)] ' e−aL sin(2πfL)
7. Evaluate the upper and lower bounds of Arg [G(f, L)] for L = 4/a.
8. Conclusion ?
1.1.3 Exercise 3 : DFT of a function with continuous spec-
trum, signal sampling e�ect
Let's consider the following signal :
x(t) =
{e−at if t ≥ 0, a > 0
0 if t < 0(1.2)
1. Determine the Fourier transform X(f) of the signal x(t) and plot
|X(f)|.
2. Is it possible to sample x(t) without loss of information ?
3. Considering that the spectrum is negligible for a minimum attenua-
tion of 40 dB compared to its maximum value, what is the minimum
sampling frequency Fe ?
4. Determine the DFT Xe(f) of the signal sampled at Te (meaning the
Fourier transform of {x(kTe)} for k = −∞, ...,+∞).
5. Show that Xe(f) is periodical with a period Fe and compare it to
X(f).
2
1.1.4 Exercise 4 : DFT of a function with continuous spec-
trum, signal sampling and limitation of the signal du-
ration e�ects
Let's consider the following signal :
x(t) =
{e−at si t ≥ 0, a > 0
0 si t < 0(1.3)
1. Give the expression of the Fourier transform of a signal x(t) sampled
at Te and limited to N points, meaning the Fourier transform of
{x(kTe)} for k = 0, ..., N − 1. It will be denoted XD(f).
2. Determine XD(f) for the signal given by (1.3). Compare XD(f) with
X(f).
1.1.5 Exercise 5 : DFT of a function with non continuous
spectrum, spectrum sampling e�ect
Let's consider :
x(t) = Aej(2πf0t+φ), t ∈ R (1.4)
1. Compute the DFT X(f) of x(t).
2. x(t) is observed on a limited duration [0, L]. Compute the DFTXL(f)
of this limited part of x(t) and compare it to X(f).
3. Determine the DFT, XD(f), considering N points of the signal sam-
pled at Te and compare it to XL(f).
4. Only a �nite number of points are able to be computed to get the
DFT : X(n) ≡{XD(nFe
N )}for n = 0, ..., N − 1. Determine X(n) and
plot |X(n)|, for the fwo following cases :
� when f0 = n0N Fe, where n0 ∈ Z,
� when f0 = n0+εN Fe, where n0 ∈ Z and 0 < ε < 1
Conclusion ?
1.2 z-transform
z transform is the tool used to study the time invariant linear digital
systems.
3
1.2.1 Exercise 1
Let's consider a real a ∈]0, 1[ and call u(n) the Heaviside function :
u(n) =
{1 for n > 0
0 for n ≤ 0(1.5)
1. Compute the z-transform of x(n) = anu(n), with |a| < 1 and precise
X(z) convergence region.
2. Compute the z-transform of y(n) = −anu(−n− 1), with |a| < 1 and
precise Y (z) convergence region.
3. Let's consider a real number b > a and |b| < 1 and a system whose
transfer function is :
H(z) =1
(1− az−1) (1− bz−1)(1.6)
Determine the system impulse response h(n) for the 3 following cases :
� When the convergence region of H(z) is |z| < a,
� When the convergence region of H(z) is a < |z| < b,
� When the convergence region of H(z) is |z| > b.
1.2.2 Exercise 2
Let's consider a device de�ned by the following equation between its
input x(n) and its output y(n) : y(n)− ay(n− 1) = x(n), with |a| < 1.
1. Determine the system response to x(n) = bnu(n) with |b| < 1, assu-
ming the system is causal.
2. Determine the system transfer function and its impulse response.
1.3 Digital �ltering
1.3.1 Exercise 1
Let's consider a �lter whose transfer function is given by :
H(z) =1
(1− az−1) (1− bz−1)(1.7)
where a et b are reals ∈]0, 1[ such as b > a, |a| < 1 and |b| < 1.
4
1. What is the �lter order ?
2. Determine the recurrence equation de�ning the �lter in the time do-
main.
3. Is it a FIR or IIR �lter ? Justify your answer.
4. Is the �lter stable ? Justify your answer.
5. By re-using the results obtained in exercise 1.2.1 determine the im-
pulse response h(n) in order to be able to implement this �lter.
1.3.2 Exercise 2
Let's de�ned a �lter in the time domain by the following recurrence
equation :
y(n) = x(n)− ax(n− 1) (1.8)
where x(n) is the �lter input and y(n) the �lter output.
1. Determine the �lter transfer function H(z).
2. Determine the z-transform of δ(n) and δ(n−1), where δ(n) represents
the digital Dirac function :
δ(n) =
{1 for n = 0
0 for n 6= 0(1.9)
. Deduce the �lter impulse response.
3. Determine the z-transform of u(n) and its convergence �eld, where
u(n) represents the Heaviside function. Deduce the step �lter response
(response to u(n)).
4. Is the �lter de�ned by equation (1.8) a FIR or a IIR �lter ? Justify
your answer.
5. Is the �lter de�ned by equation (1.8) stable ? Justify your answer.
6. Is the �lter de�ned by equation (1.8) causal ? Justify your answer.
1.3.3 Exercice 3 : FIR low pass �lter synthesis
The objective of this exercise is to synthesize a low-pass �lter, trying to
approach the ideal frequency response plotted on �gure 1.1 by a FIR �lter.
5
Give the expression of the 2N + 1 �lter coe�cients using a rectangular trun-
cation window and the 2N+1 �lter coe�cients using a Hamming truncation
window given by w(n) = 0.54 + 0.46 cos( 2πn2N+1).
Figure 1.1 � Low pass �lter - Ideal transfer function
Note : from the low-pass impulse response it is possible to obtain the
impulse responses of all other basic �lters (high-pass, bandpass, notch).
For example, the frequency response of an ideal high-pass �lter with cuto�
frequency f̃c is
HIPH(f̃) = 1−HIPB
(f̃)
where HIPB(f̃) is the frequency response of the ideal low-pass �lter with the
same cuto� frequency. Then, we can deduce the impulse response for the
ideal high-pass �lter, hIPH(n), from the one of the corresponding low-pass
�lter, hIPB(n) :
hIPH(n) = δ(n)− hIPB
(n)
This ideal impulse response will then be truncated to 2N + 1 coe�cients to
give hPH(n), the wanted impulse response.
1.3.4 Exercice 4 : second order �lter cell
Purely recursive cell
This cell is de�ned by the following expression :
y(n) = x(n)− a1y(n− 1)− a2y(n− 2)
1. Compute its transfer function H(z).
2. In the coe�cients (a1, a2) plane, plot the �lter stability area.
3. Give the �lter frequency response as a function of a1 and a2.
6
4. What is the condition to get a resonance pulsation ω̃0 = 2πf̃0 ?
5. Show that |H(ω̃0)| is inversely proportional to the distance between
the �lter poles and the circle of radius 1. Consider for this question
that a21 < 4a2 and write |H(ω̃0)| in a polar form. We give :
|H(ω̃0)| =2√a2
(1− a2)√
4a2 − a21
6. Compute the �lter impulse response as a function of the polar pole
coordinates r and θ when a21 < 4a2.
7. Propose an implementation structure for this �lter.
General second order �lter cell
This cell is de�ned by the following expression :
y(n) = x(n) + b1x(n− 1) + b2x(n− 2)− a1y(n− 1)− a2y(n− 2)
1. Compute its transfer function H(z).
2. Show that this cell can be considered as a series of a pure recursive
cell and a FIR �lter.
3. Propose an implementation structure for this �lter.
4. For b2 = 1 show that the FIR phase is linear.
1.3.5 Exercise 5 : guided IIR synthesis
The objective of this exercise is to synthesize a digital IIR lowpass �lter.
The speci�cations to comply with are given by �gure 1.2. To simplify the
computations the sampling frequency will be considered equaled to 1Hz.
1. IIR synthesis uses analog �lter model libraries. To do so it needs
analog speci�cations. So, the �rst step of the synthesis consists in
going from digital speci�cations (on H(f̃)) to analog speci�cations
(on H(f)).
Plot the speci�cations to comply with on H(f).
2. Analog synthesis : from the speci�cations on H(f) the analog synthe-
sis will lead to an H(p) transfer function ful�lling these speci�cations.
7
Figure 1.2 � Filter speci�cations
(a) Fisrt step : choose the analog model and compute its parameter
in order to ful�ll the speci�cations.
For this exercise, we impose to consider a Butterworth lowpass
�lter model. Its transfer function is given by :
|H(ω)|2 =1
1 +(ωωc
)2N
where ωc represents the cuto� pulsation.
Show that the minimum value for parameter N is 3 in order to
ful�ll the speci�cations.
(b) second step : go from |H(ω)|2 to H(p).
|H(ω)|2 =[|H(p)|2
]p=jω
leading, for N = 3, to :
|H(p)|2 =1
1− p6= H(p)H(−p)
(forgetting 1ωc
for the moment. We will replace p by pωc
at the end
of the analog synthesis).
Among the 6 poles of |H(p)|2, 3 belong to H(p), 3 belong to
H(−p). We choose for H(p) :
p0 = −1, p1 = −1
2− j√
3
2, p2 = −1
2+ j
√3
2
8
Explain why.
Then this gives :
H(p) =1
(p+ 1)(p2 + p+ 1)
and by replacing p by pωc
:
H(p) =ω3c
(p+ ωc)(p2 + pωc + ω2c )
(c) Third step : bilinear transformation on H(p) to obtain :
H(z) = H1(z)H2(z)
with
H1(z) =0.43(1 + z−1
1− 0.29z−1, H2(z) =
0.135 + 0.27z−1 + 0.135z−2
1− 0.753z−1 + 0.4z−2
3. Is the obtained �lter stable ? Justify your answer.
4. Is the obtained �lter resonant ? Justify your answer.
5. We want to �lter a signal x using the synthesized IIR �lter. Calling y
the output signal (or �ltered signal), propose a matlab code allowing
to get y from x. This code will be able to be tested to �lter sine
functions during the practical work sessions.
9
Chapitre 2
Some solutions
2.1 Digital Fourier Transform
2.1.1 Exercise 1 : E�ect of sampling
Let's consider x(t) = cos(2πf0t), f0 = 10 kHz.
1. The DFT of x(t), X(f), is plotted on �gure 2.1.
Figure 2.1 � Fourier transform of x(t) = cos(2πf0t), f0 = 10 kHz.
2. It is possible to sample x(t) without loss of information if Fe > 2f0 =
20 kHz (Shannon condition).
3. The DFT of x(t), sampled at Te = 1/Fe, is plotted between 0 and
Fe :
(a) on �gure 2.2 when Fe = 30 kHz.
(b) on �gure 2.3 when Fe = 8 kHz.
4. By low pass �ltering of the sampled signal with cuto� frequency Fe/2,
we will obtained :
(a) x(t) = cos(2πf0t), f0 = 10 kHz, when Fe = 30 kHz.
(b) x(t) = cos(2πf1t), f1 = 2 kHz, when Fe = 8 kHz.
10
Figure 2.2 � Fourier transform of x(t) = cos(2πf0t), f0 = 10 kHz, Fe = 30kHz.
Figure 2.3 � Fourier transform of x(t) = cos(2πf0t), f0 = 10 kHz, Fe = 8kHz.
2.1.2 Exercise 2 : DFT of a function with continuous spec-
trum, e�ect of the limitation of the signal duration
X(f) =
∫ +∞
−∞x(t)ej2πftdt =
∫ +∞
0e−(a+j2πf)tdt =
1
a+ j2πf(2.1)
XL(f) =
∫ L
0x(t)ej2πftdt = X(f).G(f, L)
with
G(f, L) = 1− e−(a+j2πf)L
Then :
|G(f, L)|2 = 1−2e−aLcos(2πfL)+e−2aL →(1− e−aL
)6 |G(f, L)| 6
(1 + e−aL
)
Arg [G(f, L)] = Arctan
(e−aL sin(2πfL)
1− e−aL cos(2πfL)
)
11
For L << 1a :
e−aL << 1→ |G(f, L)| ' 1→ |XL(f)| = |X(f)||G(f, L)| ' |X(f)|
Arg [G(f, L)] ' Arctan(e−aL sin(2πfL)
)' e−aL sin(2πfL)
|Arg [G(f, L)] | ≤ e−aL ' 0
→ Arg [XL(f)] = Arg [X(f)] +Arg [G(f, L)] ' Arg [X(f)]
Thus the Fourier transform is not distorted a lot when the signal is obser-
ved on a su�cient time duration (true for L = 4a , then e
−aL ' 0.02 << 1).
! !Be careful ! ! If we call wL(t) the window modeling the signal limi-
tation to a L duration, we actually have TF [x(t)wL(t)] = X(f) ∗WL(f),
where WL(f) represents the window Fourier transform (rectangular window
here). We just show, in this exercise, that, in that case, the Fourier transform
degradation (due to the convolution with WL(f)) is a multiplicative error
called G(f, L), meaning : TF [x(t)wL(t)] = X(f) ∗W (f) = X(f)G(f, L).
2.1.3 Exercise 3 : DFT of a function with continuous spec-
trum, signal sampling e�ect
X(f) (see equation 2.1) has a unbounded support. Thus, theoretically
x(t) cannot be sampled without loss of information. However, X(f) tends to
0 when f → ∞. Practically the signal x(t) can be sampled considering an
"acceptable" loss of information. This "acceptable" loss of information in the
exercise consists in considering that X(f) is null for an attenuation higher
than 40 dB compared to its maximum value. Then a maximum frequency
Fmax can be deducted and used to dimension the sampling frequency Fe.
20log|X(Fmax)| = 20log|X(0)| − 40dB = 20log|X(0)| − 20log102
⇒ Fmax '100a
2π⇒ Fe >
100a
π
12
The sampled signal Fourier transform is then written as :
Xe(f) =+∞∑
k=−∞x(kTe)e
−j2πfkTe (2.2)
which gives, for the considered signal :
Xe(f) =+∞∑k=0
[e−(a+j2πfTe)
]k=
1
1− e−(a+j2πf)Te
X(f) is periodical, of period Fe : X(f + pFe) = X(f), p ∈ Z. For
f << Fe2 ⇒
2fFe
<< 1 it is possible to write a limited development of the
exponential function (we also have aTe = 100π << 1) leading to :
Xe(f) ∼ 1
a+ j2πfTe= FeX(f)
This result can be explained by the impact of the �rst order periodization,
increasing when f tends to de Fe2 but staying low when f << Fe
2 . Factor Fe
is due to the de�nition of the DFT (equation (2.2)) forgetting factor Te.
Remark : do not forget to use an anti-aliasing �lter before sampling x(t).
2.1.4 Exercise 4 : DFT of a function with continuous spec-
trum, signal sampling and limitation of the signal du-
ration e�ects
The Fourier transform of the sampled and N points limited signal can
be written as :
XD(f) =N−1∑k=0
x(kTe)e−j2πfkTe (2.3)
and computed for the considered signal :
XD(f) =N−1∑k=0
[e−(a+j2πfTe)
]k=
1− e−(a+j2πf)NTe
1− e−(a+j2πf)Te
Here the two previous approximations are combined.
13
2.1.5 Exercise 5 : DFT of a function with non continuous
spectrum, spectrum sampling e�ect
Let's consider :
x(t) = Aej(2πf0t+φ), t ∈ R (2.4)
1. Compute the DFT X(f) of x(t).
2. x(t) is observed on a limited duration [0, L]. Compute the DFTXL(f)
of this limited part of x(t) and compare it to X(f).
3. Determine the DFT, XD(f), considering N points of the signal sam-
pled at Te and compare it to XL(f).
4. Only a �nite number of points are able to be computed to get the
DFT : X(n) ≡{XD(nFe
N )}for n = 0, ..., N − 1. Determine X(n) and
plot |X(n)|, for the fwo following cases :
� when f0 = n0N Fe, where n0 ∈ Z,
� when f0 = n0+εN Fe, where n0 ∈ Z and 0 < ε < 1
Conclusion ?
2.1.6 Exercise 6 : DFT of a function with non continuous
spectrum, spectrum sampling e�ect
In order to better appreciate the impact of the last approximation (only
N points are computed for the DFT) we will work with a signal whose
spectrum is discontinuous.
1. x(t) = Aejφej2πf0t → X(f) = Aejφδ (f − f0)
2. We have two ways to calculate XL(f) :
XL(f) =
∫ L
0x(t)ej2πftdt = ALejφsinc (π(f − f0)L) e−jπ(f−f0)L
or
XL(f) = TF
[x(t)ΠL
(t− L
2
)]= X(f) ∗ {Lsinc(πfL)e−jπfL}
= ALejφsinc (π(f − f0)L) e−jπ(f−f0)L (2.5)
ΠL
(t− L
2
)represents the rectangular truncation window of length L
centered around t = L2 .
14
3. The Fourier transform considering N points of the signal sampled at
Te can be written as :
XD(f) = AejφN−1∑k=0
[e−jπ(f−f0)Te)
]k=
1− e−j2π(f−f0)NTe
1− e−j2π(f−f0)Te
= Aejφe−jπ(f−f0)(N−1)Te sin (π(f − f0)NTe)
sin (π(f − f0)Te)(2.6)
4. Only a �nite number of points (N) are able to be computed to get
the DFT. These N points are computed on a period Fe, leading to a
computation step FeN : X(n) ≡
{XD(nFe
N )}for n = 0, ..., N − 1. The
frequency variable f becomes nFeN , with n = 0, ..., N − 1. In the case
where f0 = n0FeN , we obtain :
XD(n) = Aejφe−jπ(n−n0)
N(N−1) sin (π(n− n0))
sin(π (n−n0)
N
)giving XD(n) = AejφN for n = n0 and 0 elsewhere. Figure 2.4 gives
an example for XD(n) when n0 = 4. Note that this represents the
theoretical Fourier transform for an exponential with frequency is
f0 : a Dirac at f0. However, the case where f0 = n0FeN is a very par-
ticular case. Most of the time f0 = (n0 + ε)FeN . An example of the
corresponding XD(n) is plotted on �gure 2.5. With this plot it is not
obvious to deduct that this Fourier transform corresponds to an expo-
nential function. The solution to get a better spectrum visualization
is to make an interpolation. This interpolation is usually done using
the Zero Padding technic.
Figure 2.4 � Exemple de représentation de XD(n) dans le cas où n0 = 4.
15
Figure 2.5 � Exemple de représentation de XD(n) dans le cas où n0 = 4.
2.2 z-Transform
2.2.1 Exercise 1
1.
x(n) = anu(n), |a| < 1→ X(z) =
+∞∑n=0
[az−1
]n=
1
1− az−1
Domain of existence :
limn→+∞n√|anz−n| < 1 for |z| > |a|
2.
y(n) = −anu(−n− 1), |a| < 1
→ Y (z) =−1∑
n=−∞−[az−1
]n=
+∞∑n=1
−[a−1z
]n= −
{+∞∑n=0
[a−1z
]n − 1
}=
1
1− az−1
Domain of existence :
limn→+∞n√|a−nzn| < 1 for |z| < |a|
Conclusion : the inverse z-transform is not unique. Its expression de-
pends on the closed curve chosen to compute it. If this curve encloses
all the poles a causal solution is obtained, else not.
3. Several methods are possible to solve this question. For example, a
partial fraction decomposition can be used :
H(z) =1
a− b
{a
1− az−1− b
1− bz−1
}16
� for |z| < a :
h(n) =1
a− b{−an+1u(−n− 1) + bn+1u(−n− 1)
}No poles are included in the considered closed curve. h(n) is non
causal.
� pour a < |z| < b :
h(n) =1
a− b{an+1u(n) + bn+1u(−n− 1)
}The considered closed curved encloses z = a and excludes z = b.
h(n) has a causal part and a non causal part.
� for |z| > b :
h(n) =1
a− b{an+1 − bn+1
}u(n)
The considered closed curved encloses all the poles (z = a et
z = b). The inverse z-transform h(n) is causal.
2.2.2 Exercice 2
1.
y(n)− ay(n− 1) = bnu(n)→ Y (z)− az−1Y (z) =1
1− bz−1
→ Y (z) =
{1
1− az−1
}{1
1− bz−1
}If we want to obtain a causal system, then :
y(n) =1
a− b{an+1 − bn+1
}u(n)
2.
y(n)−ay(n−1) = x(n)→ Y (z)−az−1Y (z) = X(z)→ H(z) =Y (z)
X(z)=
1
1− az−1
h(n) = TZ−1 [H(z)] = anu(n) (causal filter).
17
2.3 Digital �ltering
2.3.1 Exercise 1
H(z) =1
(1− az−1) (1− bz−1)(2.7)
1. The �lter de�ned by H(z) is a 2−order �lter (degree of the denomi-
nator).
2.
Y (z)(1− (a+ b)z−1 + abz−2
)= X(z)
TZ−1
−−−→ y(n) = x(n) + (a+ b)y(n− 1)− aby(n− 2)
3. This �lter is a RII �lter because it includes a feedback loop : the
output at time instant n depends on the input at time instant n but
also on the output past values.
4. This �lter will be stable if the poles of H(z) have a modulus lower
than 1. For that we need |a| < 1 and |b| < 1, which is the case here.
Thus, the �lter is stable.
5. h(n) = 1a−b
{an+1 − bn+1
}u(n) leads to a causal �lter.
2.3.2 Exercice 2
1.
Y (z) = X(z)− az−1X(z)→ H(z) =Y (z)
X(z)= 1− az−1
2.
δ(n)→ ∆(z) =
+∞∑n=−∞
δ(n)z−n = δ(0)z0 = 1
TZ [δ(n− 1)] = z−1TZ [δ(n)] = z−1
So :
H(z) =Y (z)
X(z)= 1− az−1 → h(n) = TZ−1 [H(z)] = δ(n)− aδ(n− 1)
18
Note : it was possible to directly obtain h(n) by taking x(n) = δ(n)
in the recursive equation de�ning the system.
3.
U(z) =
+∞∑n=0
z−n =1
1− z−1
Domain of existence :
limn→+∞n√|z−n| < 1 for |z| > 1
Step response :
Y (z) = H(z)U(z) =1− az−1
1− z−1=
1
1− z−1− az−1
1− z−1→ y(n) = u(n)−au(n−1)
Note : it was possible to directly obtain the step response by taking
x(n) = u(n) in the recursive equation de�ning the system.
4. This �lter is a �nite impulse response (FIR) �lter because there is'nt
any feedback loop : the output at time instant n does not depend on
its past values.
5. A FIR �lter is stable if its coe�cients are �nite, which is the case
here.
6. This �lter is causal because its impulse response is null for n < 0.
2.3.3 Exercise 3 : FIR low pass �lter synthesis
The ideal frequency response HIPB(f̃) is periodical, thus can be decom-
posed in Fourier series :
HIPB(f̃) =
+∞∑k=−∞
hIPB(k) e−j2πf̃k (2.8)
where the Fourier series coe�cients hIPB(k) represent the elements (or points
or coe�cients) of the �lter impulse response. Here :
hIPB(k) =
∫ +∞
−∞HIPB
(f̃)e+j2πf̃kdf̃ =
∫ f̃c
−f̃ce+j2πf̃kdf̃ (2.9)
19
leading to, after calculations, hIPB(k) = 2f̃csinc(2πf̃ck). Practically, the
number of coe�cients de�ning the �lter must be limited to a given num-
ber, 2N + 1, called �lter order. This limitation is modeled by the use of a
truncation (or weighted) window, w(k), of length 2N + 1 :
hPB(k) = hIPB(k)× w(k)
It leads to an approximated frequency response :
HPB(f̃) = HIPB(f̃) ∗W (f̃)
where W (f̃) is the Fourier transform of w(k).
Two truncation windows are proposed in this exercise : rectangular or Ham-
ming. Using the rectangular window it comes :
hPB (k) = 2f̃csinc(2πf̃ck) for k = −N, ..., N
= 0 elsewhere (2.10)
Using the Hamming window we get :
hPB (k) = 2f̃csinc(2πf̃ck)×(
0.54 + 0.46 cos
(2πk
2N + 1
))for k = −N, ..., N
= 0 elsewhere (2.11)
Figures 2.6 and 2.7 plot the impulse responses and transfer functions
of the two obtained lowpass �lters for a cut o� frequency fc = 100 Hz, a
sampling frequency Fe = 800 Hz and an order N = 31.
Figure 2.8 plots an example of input and output signals using the �lter
with rectangular truncation window. A delay between the output and the
input signal can be observed. It is due to the shifted impulse response (to get
a causal �lter). The output signal is distorted compared to the input one.
Indeed some frequencies have been removed by the �lter, as it is shown in
�gure 2.9.
20
Figure 2.6 � Low pass �lter impulse responses for fc = 100 Hz, Fe = 800Hz and N = 31.
Figure 2.7 � Low pass �lter transfer functions for fc = 100 Hz, Fe = 800Hz and N = 31.
21
Figure 2.8 � Example of input and output signals using a FIR lowpass�lter synthesized with the following parameters : fc = 100 Hz, Fe = 800 Hz,order = 31, rectangular truncation window.
Figure 2.9 � DFT of input and output signals using a FIR lowpass �ltersynthesized with the following parameters : fc = 100 Hz, Fe = 800 Hz,order = 31, rectangular truncation window..
22
2.3.4 Exercice 4 : second order �lter cell
Purely recursive cell
1.
y(n) = x(n)−a1y(n−1)−a2y(n−2)TZ−−→ Y (z) = X(z)−a1z
−1Y (z)−a2z−2Y (z)
So :
H(z) =Y (z)
X(z)=
1
1 + a1z−1 + a2z−2
2. This �lter will be stable if the poles of H(z) have a modulus lower
than 1 (enclosed in the circle with a radius of 1). Let's compute the
poles :
H(z) =z2
z2 + a1z + a2=
z2
a(z − z1)(z − z2)
We have to solve z2 + a1z+ a2 = 0, leading to compute ∆ = a21− 4a2
and consider the 3 possible cases :
(a) ∆ < 0 : two conjugated complex poles of modules =√a2. In that
case, it will be necessary to have |a2| < 1. Note that we really
have here a second order cell.
(b) ∆ = 0 : a dual pole z0 = −a12 . In that case, we need |a1| < 2.
(c) ∆ > 0 : two real poles (two �rst order cells in fact) : z1 = −a1−√
∆2
and z2 = −a1+√
∆2 . By pointing out that −1 ≤ z1 ≤ z2 ≤ 1, we
get the three following conditions : a2 ≥ a1 − 1, a2 ≥ −a1 − 1 et
−2 ≤ a1 ≤ 2.
By regrouping all the possible cases, we obtain, in the coe�cients
plan (a1, a2), the stability domain of the �lter (a triangle) : see �gure
2.10.
3. Filter frequency response as a function of a1 and a2 :
|H (ω̃)|2 =
[H(z)H
(1
z
)]z=ejω̃
leading to :
|H (ω̃)|2 =1
1 + a21 + a2
2 + 2a1(1 + a2) cos(ω̃) + 2a2 cos(2ω̃),
23
Figure 2.10 � Stability triangle for second order IIR �lters.
where ω̃ is the normalized pulsation : ω̃ = 2π fFe.
4. Search for the normalized resonance pulsation ω̃0 : excepted for ω̃ = 0
and ω̃ = 2π × 0.5, the derivative of |H (ω̃)|2 is null when cos(ω̃0) =
−a1(1+a2)4a2
. Thus, we obtain a resonance if∣∣∣a1(1+a2)
4a2
∣∣∣ ≤ 1.
5. cos(ω̃0) = −a1(1+a2)4a2
and cos(2ω̃0) = 2a21(1+a2)2
16a2−1 lead to, after some
calculations :
|H(ω̃0)| =2√a2
(1− a2)√
4a2 − a21
For z1 = rejθ and z2 = re−jθ (conjugated complex poles) : a2 = r2
and a1 = −2r cos(θ) and then :
|H(ω̃0)| = 1
(1− r)(1 + r) sin(θ)
Indeed, |H(ω0)| is inversely proportional to the distance of the poles
to the circle with radius 1. Closer is the pole to the circle (a2 close to 1)
stronger will be the resonance. It is so possible to link the pole position
in the circle with radius 1 of the complex plane to the produced
spectral e�ect.
24
6.
H(z) =1
(1− z1z−1)(1− z2z−1)=
z1
z1 − z2
1
1− z1z−1+
z2
z2 − z1
1
1− z2z−1
TZ−1
−−−→ h(n) =zn+1
1 − zn+12
z1 − z2u(n) = rn
sin ((n+ 1)θ)
sin (θ)u(n)
7. A way to implement this �lter is proposed in �gure 2.11.
Figure 2.11 � Purely recursive second order cell.
General second order �lter cell
1.
y(n) = x(n) + b1x(n− 1) + b2x(n− 2)− a1y(n− 1)− a2y(n− 2)
TZ−−→ Y (z) = X(z)+b1z−1X(z)+b2z
−2X(z)−a1z−1Y (z)−a2z
−2Y (z)
So :
H(z) =1 + b1z
−1 + b2z−2
1 + a1z−1 + a2z−2
2.
H(z) =(1 + b1z
−1 + b2z−2)× 1
1 + a1z−1 + a2z−2
3. By implementing the FIR �lter and the purely recursive second order
IIR cell in series (�gure 2.12), we can write :
Y1(z) = X(z)1
1 + a1z−1 + a2z−2
TZ−1
−−−→ y1(n) = x(n)−a1y(n−1)−a2y(n−2)
25
Y (z) = Y1(z)(1 + b1z
−1 + b2z−2) TZ−1
−−−→ y(n) = y1(n)+b1y1(n−1)+b2y1(n−2)
This leads to a possible implementation : see �gure 2.13. This imple-
mentation is called canonic structure : only one FIFO is needed by
implementing the IIR part of the �lter followed by the FIR part.
Figure 2.12 � Cascade d'un �ltre RIF et d'un �ltre RII.
Figure 2.13 � Struture canonique de réalisation de la cellule du secondordre.
4. For b2 = 1 we get : HFIR(z) = 1 + b1z−1 + z−2. And thus :
HFIR(ω̃) = e−jω̃(b1 + 2 cos(ω̃))⇒ Arg [HFIR(ω̃)] = −ω̃
The phase is linear and so the group propagation time (GPT) constant.
It was also possible to note that hFIR = [1 b1 1] is symmetrical, which
leads to a constant GPT for a FIR �lter.
2.3.5 Exercise 5 : guided IIR synthesis
1. The IIR synthesis is a digital �lter synthesis method based on an
analog synthesis. From the speci�cations on H(f̃), we �rst have to
deduct those on H(f) to conduct the analog synthesis and get H(p).
The speci�cations in terms of attenuation are the same, but the fre-
quency axis has to be pre-distorted : f = 1πTe
tan(πf̃)(in order to
26
anticipate the distortion introduced by the bilinear transformation
giving at the end H(z) from H(p)). This leads to the speci�cations
given in �gure 2.14.
Figure 2.14 � Analog speci�cations
2. Analog synthesis :
(a) First step : we have to choose an analog model and �x its para-
meters in order to obtain a transfer function H(f) satisfying the
speci�cations. We choose, in this exercise, to use a Butterworth
low pass model, whose transfer function is given by :
|H(ω)|2 =1
1 +(ωωc
)2N,
where ωc represents the cuto� pulsation (= 2πfc, fc denoting the
cuto� frequency). The attenuation for ω = ωc = 2πfc is �xed to
−3 dB. Parameter N has to be calculated in order to satisfy the
wanted attenuation in the attenuated bandwidth :
10 log10
1
1 +(ωaωc
)2N≤ −30dB = 10 log
1
103
where ωa = 2πf̃a. This leads to choose N = 3.
(b) Second step : go from |H(ω)|2 to H(p).
|H(ω)|2 =[|H(p)|2
]p=jω
27
so for N = 3 :
|H(p)|2 =1
1− p6= H(p)H(−p)
(we will forget for the moment 1ωc, knowing that p will be replaced
by pωc
at the end).
Among the 6 poles of |H(p)|2 (which are the sixth roots of 1), 3
belong to H(p), 3 belong to H(−p). We will choose as the 3 poles
for H(p) : p0 = −1, p1 = −12 − j
√3
2 , p2 = −12 + j
√3
2 because their
real parts are negative leading to a stable analog �lter.
It comes :
H(p) =1
(p+ 1)(p2 + p+ 1)
so, by replacing p by pωc
:
H(p) =ω3c
(p+ ωc)(p2 + pωc + ω2c )
(c) Third step : After applying the bilinear transform on H(p), we
obtain :
H(z) = H1(z)H2(z)
with
H1(z) =0.43(1 + z−1)
1− 0.29z−1, H2(z) =
0.135 + 0.27z−1 + 0.135z−2
1− 0.753z−1 + 0.4z−2
3. The obtained �lter is composed of a stable �rst order �lter (its pole
has a modulus 0, 29 < 1) and a second order �lter, also stable because
the point (a1, a2) = (−0.753, 0.4) is included in the stability triangle
(see previous exercise).
4. Obtained �lter is not a resonant �lter because∣∣∣a1(1+a2)
4a2
∣∣∣ = 6.588 > 1
(see previous exercise).
5. If we need to �lter a signal x using the synthesize IIR �lter, we can
write the following code on Matlab :
y1 = filter([0.43 0.43], [1 − 0.29], x);
y = filter([0.135 0.27 0.135], [1 − 0.753 0.4], y1);
28
Chapitre 3
References
� Digital Signal Processing : Course, by Nathalie Thomas, ENSEEIHT
documentation.
� Signal and Systems, by Simon Haykin and Barry Von Veen, Wiley
� Digital Signal Processing, by Alan V. Oppenheim, Ronald W. Schafer,
Prentice-Hall.
� Documents on complex variable, Laplace transform, z tranform :
http ://dobigeon.perso.enseeiht.fr/teaching/complexe.html
29