# Digital Signal Processing

Laboratory Guide
http://sp.utcluj.ro/Teaching

IIIEA.html
3rd Year AE
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 1 / 50
Outline
1
Laboratory 1 – Introduction to MATLAB
2
Laboratory 2 – Discrete-Time Signals
3
Laboratory 3 – Sampling of Analog Signals
4
Laboratory 4 – Discrete-Time Linear Time-Invariant Systems
5
Laboratory 5 – Linear and Circular Convolution
6
Laboratory 6 – Discrete Fourier Transform
7
Laboratory 7 – Finite Impulse Response Filters
8
Laboratory 8 – Discrete-Time Linear Time-Invariant Systems as
Frequency Selective Filters
9
Laboratory 9 – Inﬁnite Impulse Response Filters. Indirect Design
Methods
10
Laboratory 10 – Inﬁnite Impulse Response Filters. Direct Design
Methods
11
Laboratory 11 – Structures for the Realization of Finite Impulse
Response Systems
12
Laboratory 12 – Structures for the Realization of Inﬁnite Impulse
Response Systems
13
Laboratory 13 – Quantization of Digital Filter Coeﬃcients
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 2 / 50
Laboratory 1 – Introduction to MATLAB
L1. Introduction to MATLAB
Appendix A — L. Grama, C. Rusu, Prelucrarea numeric˘a a semnalelor - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: To be acquainted with MATLAB programming environment,
with the main commands and functions that will be used in the next
laboratories, read Appendix A: Not ¸iuni MATLAB (pp. 139-165) and enter
the described examples in the command line.
Exercises:
1
Consider the matrices: A =
_
_
3 2 1
8 4 5
0 2 0
_
_
, B =
_
_
2 3 4
1 1 1
2 3 2
_
_
and the
scalar m = 4. Evaluate using MATLAB: C = A + B; D = A −B;
E = C + m; F = A · B; G = B · m; H = A

; I = B

; J = A/B;
K = A \ B; L = C
m
. Verify if J = A · B
−1
and if K = A
−1
· B. Use
the long e format.
2
Generate a linearly spaced vector between 3 and 9 with the increment
2.
3
Generate a 13 element linearly spaced vector between 3 and 9.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 3 / 50
Laboratory 1 – Introduction to MATLAB
4
Generate a 9 point logarithmically spaced vector between decades
10
−3
and 10
3
.
5
Evaluate the scalar product of: a =
_
1 2
¸
and b =
_
−3 3
¸
.
6
y = 3:0.9:123 is the given vector. Find the length of the vector and
generate another vector of the same length, with only 1s elements.
7
Evaluate the element by element product of the matrices:
A =
_
_
9 8 7
6 5 4
3 2 1
_
_
and B =
_
_
1 0 1
1 0 1
1 0 1
_
_
.
8
Graph x(n) = sin 2π
1
5
n, n = 0, 10, using stem . The graph should be
represented by red stars; label the axes and write a title.
9
Build a MATLAB function named bplusa.m :
function sumab = bplusa(a, b) in order to evaluate the sum of two
variables a and b .
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 4 / 50
Laboratory 1 – Introduction to MATLAB
10
Build a MATLAB function named bproducta.m :
function prodab = bproducta(a, b) in order to evaluate the product
of two vectors a and b .
11
Build a MATLAB function:
function geometricmean = GeomMean(a, b) in order to evaluate the
geometric mean of two scalars a and b .
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 5 / 50
Laboratory 2 – Discrete-Time Signals
L2. Discrete-Time Signals
Chapter 1 — L. Grama, C. Rusu, Prelucrarea numeric˘a a semnalelor - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: In this laboratory the discrete time sequences (deﬁnition,
classiﬁcation and properties) are presented. It will be also illustrated the
way to represent discrete-time signals using MATLAB. To be acquainted
with signals and sequences, read Chapter 1: Semnale ¸si secvent ¸e, paragraphs
1.1.1-1.1.2 (pp. 1-4), respectively paragraphs 1.2.1-1.2.2 (pp. 8-10) to see
the MATLAB functions used in the sequences description. Run scripts
1.3.1÷1.3.12 (you can ﬁnd the MATLAB examples in Lab2 DSP Examples as:
L2 1, impulse, L2 3÷L2 4, UnitStep, L2 6÷L2 12).
Exercises:
1
Generate and graph (using stem function) the sequence:
x(n) = {0, 1, 2, 1, 0, −1, −2, −1, 0}, n = 0, 8.
2
Generate the complex sequence: x(n) = δ(n) + ju(n), n = 0, 10, and
graph the real and the imaginary part of the generated sequence, in
the same ﬁgure, using subplot(mnp) command.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 6 / 50
Laboratory 2 – Discrete-Time Signals
3
Generate and plot next sequences (abscissa n must include only the
indicated range):
x
1
(n) = 0.5δ(n), n = −5, 10;
x
2
(n) = 0.8δ(n −5), n = −5, 10;
x
3
(n) = 1.5δ(n + 100), n = −150, 0;
x
4
(n) = 2u(n), n = −20, 20;
x
5
(n) = 1.5u(n −10), n = −10, 20;
x
6
(n) = 2.5u(n + 10), n = −15, 15;
x
7
(n) = 1.2δ(n + 5) + 1.3 [u(n) −u(n −20)] , n = −15, 25;
x
8
(n) = 2.2 sin
_
2π0.1n +
π
4
_
, n = 0, 49;
x
9
(n) = 1.5 sin
_
π
4
n +
π
3
_
, n = 0, 20;
x
10
(n) = 2 cos
_
π

5
n +
π
6
_
, n = −20, 20;
x
11
(n) = ln
¸
¸
¸sin
_
π
10
n
_
−cos
_
π
10
n

¸
¸, n = −20, 20;
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 7 / 50
Laboratory 2 – Discrete-Time Signals
x
12
(n) = exp (3n), n = 0, 9;
x
13
(n) = (−3)
n
sin
_
π
8
n
_
, n = 0, 20;
x
14
(n) = 10 sin
_
2π0.1n +
π
6
_
, n = −5, 20.
4
Graph the attenuated sine sequence of length 100, given by:
x(n) =
_
_
_
sin (0.1n)
0.1n
, n = 0,
1, n = 0.
5
Generate the ramp sequence, with initial value 0 and ﬁnal value 100,
of length 20: x(n) =
100
19
n, n = 0, 19.
6
Graph the sequence: x(n) = 3 sin (4πn) + 2 cos (0.72πn), n = 0, 100.
Is this sequence periodic? If yes, which is the period?
7
Plot the discrete sequence, of length 20:
x(n) =
_
sin (0.2n), n > 10,
0, n ≤ 10.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 8 / 50
Laboratory 2 – Discrete-Time Signals
8
Generate the complex-valued sequence, of length 50:
x(n) = exp
_
−0.1n + j
_
2π0.1n +
π
4
__
. Plot the sequence attenuated
by sine and by cosine function, respectively:
x
1
(n) = exp (−0.1n) sin
_
2π0.1n +
π
4
_
;
x
2
(n) = exp (−0.1n) cos
_
2π0.1n +
π
4
_
.
9
Generate and plot next sequences:
x
1
(n) =
_
n(2 −n), n = −5, 10
10, otherwise
−10 ≤ n ≤ 20;
x
2
(n) =
_
¸
_
¸
_
8

i =0
a(n −2i ); a =
_
n + 3, n = 0, 5
0.5, otherwise
, n = 0, 10
50, otherwise
0 ≤ n ≤ 15;
10
Generate 3 sinusoidal sequences of diﬀerent amplitude, frequency and
phase and plot them simultaneously on the screen (minimum 1
period).
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 9 / 50
Laboratory 2 – Discrete-Time Signals
11
Generate 16 periods of a periodic sequence; every period consists in 5
samples of 1 and 10 samples of 0.
12
Generate an uniformly distributed random sequence, between 0 and
10. Plot this sequence for n = 0, 49.
Hint: To generate an uniform distributed random sequence on a speciﬁed interval
[a, b], you have to multiply the output of rand function by (b −a), and then to
add a. In the case of this example a = 0 and b = 10.
13
Generate a normally distributed random sequence (gaussian), between
0 and 10. Graph this sequence for n = 0, 49.
Hint: This sequence has a speciﬁc mean 5 and variance 5. To generate a gaussian
sequence with these parameters multiply the output of randn function by the
standard deviation

5 and then add the desired mean 5.
14
Plot using stem function, the sequence obtained by summing a sine
sequence by an uniform noise with the amplitude 10 times lower.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 10 / 50
Laboratory 2 – Discrete-Time Signals
15
Generate and plot the sequences of length 100:
x
1
(n) = δ(n) −δ(n −5);
x
2
(n) = u(n −5);
x
3
(n) = n [u(n) −u(n −10)] ;
x
4
(n) = e
(−0.2+j 0.3)n
;
x
5
(n) = n [u(n) −u(n −10)] + e
(−0.2+j 0.3)n
;
x
6
(n) = n [u(n) −u(n −10)] + e
0.3n
[u(n −10) −u(n −20)] .
16
Add an uniformly distributed random sequence of mean 0 and
maximum amplitude 0.2, to the 100 length sequences generated at
exercise 15.
17
Repeat exercise 16, for a gaussian sequence of mean 0 and variance
0.1.
18
Generate 101 samples of a ramp sequence with the initial value 0 and
the increment equal by 0.01. Plot this sequence between 20 and 30.
Hint: For plotting this sequence you can use the syntax: stem(20:30, x(21:31))
assuming that the generated sequence was denoted by x .
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 11 / 50
Laboratory 2 – Discrete-Time Signals
19
Generate and graph a rectangular sequence and a sawtooth one with
15 samples per period. You have to represent graphically 5 periods.
20
Create a MATLAB function to generate a ﬁnite length sinusoidal
sequence. The function must have 5 input arguments: 3 for the
sinusoid’s parameters and 2 to specify the ﬁrst and the last index of
the ﬁnite sequence. The function will return a colon vector that will
contain the sinusoid values.
Hint: function seq = gensin(ampl, freq, phase, ninitial, nﬁnal) .
Use the created function in a MATLAB script to evaluate the
minimum, the maximum, the mean and the standard deviation of a
sinusoidal sequence with parameters: ampl = 1.5 , freq = 1/15 ,
phase = pi/6 , n = 0, 50.
21
Modify the function generated at 20, in order to return 2 output
arguments: a vector that contains the values of the sequence and a
vector with the corresponding indices.
Hint: function [seq, n] = gensin1(ampl, freq, phase, ninitial, nﬁnal) .
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 12 / 50
Laboratory 3 – Sampling of Analog Signals
L3. Sampling of Analog Signals
Chapter 1 — L. Grama, C. Rusu, Prelucrarea numeric˘a a semnalelor - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: The aim of this laboratory is the introduction of analog
signals, the way to obtain a discrete-time sequence from an analog signal
(sampling of analog signals) and the way to reconstruct analog signals
from samples. To be acquainted with analog signals, their way of sampling
and their reconstruction from samples see Chapter 1: Semnale ¸si secvent ¸e,
paragraphs 1.1.1-1.1.5 (pp. 1-8). In paragraph 1.2.3 (p. 11) the MATLAB
functions used for interpolation are presented. Run scripts 1.3.13÷1.3.15
(you can ﬁnd the MATLAB examples in Lab3 DSP Examples as: L3 1÷L3 3).
Study problem 1.3.16.
Exercises
1
Plot an amplitude modulated signal, sampled by 1 MHz, whose
carrier is of 100kHz and modulation signal of 10 kHz, for a
modulation index m = 1.2. Graph on the same ﬁgure, but in a
diﬀerent pane the suppressed carrier amplitude modulated sequence.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 13 / 50
Laboratory 3 – Sampling of Analog Signals
2
From all sequences obtained after sampling analog sinusoidal signals
by 50kHz, which one has the major variation?
3
Generate 101 samples of a sequence obtained from an analog
sinusoidal signal sampled by 1 kHz; the analog sinusoid has unitary
amplitude, zero phase and a frequency of 100 Hz.
From the previous sequence generate a full-wave rectiﬁed one ( abs );
Perform the arithmetic mean of the previously obtained sequences.
What type of signal is the obtained one?
Graph the three sequences in the same ﬁgure, but in diﬀerent panes.
4
Consider an analog sinusoidal signal with frequency F = 200 Hz. This
signal is sampled by F
s
= 800 Hz. Plot the analog signal, the
discrete-time sequence obtained after sampling and the analog signal
that can be recovered from samples (F
sim
= 8 kHz).
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 14 / 50
Laboratory 3 – Sampling of Analog Signals
5
Consider the analog sinusoids with frequencies: 300 Hz, 400 Hz, 500
Hz, 700 Hz, 900 Hz. All of them are sampled by 900 Hz (don’t forget
the simulation frequency). Plot the analog sinusoidal signals, the
sequences obtained after sampling, the analog signals that can be
recovered from the corresponding samples and also the corresponding
spectra. Is there any alias error? Why?
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 15 / 50
Laboratory 4 – Discrete-Time Linear Time-Invariant Systems
L4. Discrete-Time Linear Time-Invariant Systems
Chapter 2 — L. Grama, C. Rusu, Prelucrarea numeric˘a a semnalelor - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: The aim of this laboratory is to present discrete-time LTIS.
The way to evaluate the system response to arbitrary input signals, with
zero initial conditions, is illustrated. In this laboratory, the usage of
z-transform to LTIS characterization is also presented. To be familiar with
LTIS read Chapter 2: Semnale discrete, paragraphs 2.1, 2.1.1-2.1.3 (pp.
43-46). The MATLAB functions used to evaluate the output, the impulse
response of a LTIS, respectively the functions used to characterize the
discrete-time systems are described in paragraphs 2.2.1-2.2.2 (pp. 48-50).
Run scripts 2.3.1÷2.3.9 (you can ﬁnd the MATLAB examples in
Lab4 DSP Examples as: L4 1÷L4 9). Study problems 2.3.10÷2.3.13.
Exercises:
1
Demonstrate through a MATLAB scrip (similar with L4 1.m) that the
system H{x(n)} = x
2
(n) is nonlinear. Consider:
x
1
(n) = sin (2π0.1n), x
2
(n) = sin (2π0.15n), a = 3 and b = −3.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 16 / 50
Laboratory 4 – Discrete-Time Linear Time-Invariant Systems
2
Two causal systems are considered. Determine which one is stable.
H
1
(z) =
1 −0.6z
−1
+ 1.15z
−2
−0.98z
−3
+ 0.98z
−4
1 + 1.27z
−1
+ 2.02z
−2
+ 1.54z
−3
+ 0.98z
−4
;
H
2
(z) =
2 −2.54z
−1
+ 5z
−2
−4.3z
−3
+ 3.27z
−4
1 −0.77z
−1
+ 0.82z
−2
+ 0.41z
−3
+ 0.51z
−4
.
3
A LTIS is characterized by the system function:
H(z) =
(z + 0.2)(z
2
+ 5)
(z −0.7)(z
2
−z + 0.49)
.
Represent the poles and the zeros in the z-plane;
Evaluate and plot the phase response characteristic. Is this system a
linear-phase one?
4
Next transfer functions of some discrete LTIS are considered:
H
1
(z) = 1 −4z
−1
+ 4z
−2
; H
2
(z) = 1 + 4z
−1
+ 4z
−2
;
H
3
(z) = 1 −z
−1
+ 0.25z
−2
; H
4
(z) =
_
1 + z
−1
_
2
1 −z
−1
+ 0.25z
−2
;
H
5
(z) =
_
1 −z
−1
_
2
1 −z
−1
+ 0.25z
−2
; H
6
(z) =
1
1 −z
−1
+ 0.25z
−2
.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 17 / 50
Laboratory 4 – Discrete-Time Linear Time-Invariant Systems
Using the zplane command represent the pole-zero diagrams for
H
i
(z), i = 1, 6;
Using the freqz command represent the frequency response
characteristics for each system. Specify what type of system is
described by each transfer function;
Evaluate and plot the unit impulse and the unit step response for
H
5
(z).
5
Find the impulse response of the system: H(z) =
0.5z
2
+ 0.5z
z
2
−z −0.5
.
6
Find the impulse response of the system described by the transfer
function: H(z) =
1 + z
−1
+ z
−2
+ z
−3
1 −0.5z
−1
−4z
−2
+ 2z
−3
.
7
Evaluate the ﬁrst 50 samples of the impulse response sequence of the
system: H(z) =
z
2
+ 1
z
3
−1.9z
2
+ 1.55z −0.425
.
8
Evaluate the ﬁrst 100 samples of the impulse response of the system:
H(z) =
z
z −1
.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 18 / 50
Laboratory 4 – Discrete-Time Linear Time-Invariant Systems
9
A discrete LTIS is characterized by the constant-coeﬃcient diﬀerence
equation:
y(n) −1.5 cos
π
8
y(n −1) + 0.95y(n −2) = x(n) + 0.4x(n −1).
Determine the poles of the system’s transfer function, which are the
roots of the polynomial A(z) = 1 +
N

k=1
a
k
z
−k
using the roots
command. If these roots are complex-conjugate, the response of the
system contains harmonic components. Represent the real and the
imaginary part of the complex sequences p
n
k
u(n), n = 0, 30 (p
k
are the
system’s poles);
Accordingly to the diﬀerence equation, the impulse response sequence
is: h(n) = (a
1
p
n
1
+ a
2
p
n
2
) u(n). Determine the constants a
1
and a
2
.
Evaluate the impulse response using the MATLAB command impz
(see L4 8.m);
Determine the steady-state response of the system to the complex
exponential input sequence (see L4 9.m): x(n) = e
j ω
0
n
, n = 0, 60,
ω
0
=
π
6
, using the relation: y(n) = |H(ω
0
)|e
j ω
0
n+∠H(ω
0
)
.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 19 / 50
Laboratory 4 – Discrete-Time Linear Time-Invariant Systems
10
Analyze the eﬀect of poles and zeros of a system function H(z) on
the magnitude of the frequency response |H(ω)|, for the systems:
H
1
(z) =
_
1 −z
1
z
−1
_ _
1 −z
2
z
−1
_
where:
1) z
1,2
= 1; 2) z
1,2
= e
±j
π
6
; 3) z
1,2
= e
±j
π
3
; 4) z
1,2
= e
±j
π
2
;
5) z
1,2
= e
±j

3
; 6) z
1,2
= e
±j

6
; 7) z
1,2
= −1.
Analyze how |H(ω)| is modifying accordingly to the zeros position, and
represent the zeros in z-plane. What do you observe? Comment on the
results.
H
2
(z) =
0.3
_
1 −p
1
z
−1
_ _
1 −p
2
z
−1
_ where:
1) p
1,2
= 0.3; 2) p
1,2
= e
±j
π
4
; 3) p
1,2
= e
±j
π
2
; 4) p
1,2
= −0.3.
Analyze how |H(ω)| is modifying accordingly to the poles position, and
represent the poles in z-plane. What do you observe? Comment on the
results.
11
For the sequence: x(n) = (0.9)
n
sin (0.2n), n = 0, 99, ﬁnd the impulse
response after you evaluate X(z).
Hint: The z-transform of the sequence x(n) = a
n
sin (ω
0
n)u(n) is
H(z) =
az
−1
sin ω
0
1 −2az
−1
cos ω
0
+ a
2
z
−2
, |z| > |a|.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 20 / 50
Laboratory 5 – Linear and Circular Convolution
L5. Linear and Circular Convolution
Chapters 2 and 3 — L. Grama, C. Rusu, Prelucrarea numeric˘a a semnalelor - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: The aim of this laboratory is to present the linear and the
circular convolution. You can ﬁnd the theoretical aspects regarding the
linear convolution in Chapter 2: Semnale discrete, paragraph 2.1.4 (pp.
47-48), respectively in 2.2.3 (p. 50) the MATLAB commands used for
linear convolution evaluation. In Chapter 3: Transformata Fourier discret˘a,
paragraph 3.1.3 (pp. 95-96) you can ﬁnd the aspects regarding the circular
convolution. The MATLAB functions used are presented in 3.2.2 (p. 99).
Run scripts 2.3.14, 3.3.6÷3.3.8, 3.3.11,respectively (you can ﬁnd the
MATLAB examples in Lab5 DSP Examples as: L5 1÷L5 5). Study problems
2.3.15÷2.3.16.
Exercises:
1
Determine the linear convolution of the sequences: x
1
(n) = |10 −n|
and x
2
(n) = 1.5 cos
_
2π0.1n +
π
4
_
, n = 0, 20. Plot the two sequences
and the sequence obtained after convolution. Which is the length of
the sequence obtained after performing the linear convolution?
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 21 / 50
Laboratory 5 – Linear and Circular Convolution
2
The impulse response of a LTIS is: h(n) =
_
e
−0.1n
, n = 0, 31,
0, otherwise.
At
the input of the system the sequence x(n) = u(n) −u(n −20) is
applied. Determine the system output using the linear convolution.
3
The impulse response of a LTIS is: h(n) =
_
e
−0.15n
, n = 0, 31,
0, otherwise.
Determine the output of the system to the input sequence
x(n) = u(n) −u(n −30), using conv function.
4
Consider the system described by the z-domain transfer function:
H(z) =
z −1
(z −0.25)(z −0.5)
.
Determine the ﬁrst 100 samples of the unit step response sequence;
Express the system function as: H(z) = H
1
(z) + H
2
(z) and determine
the unit step response of the individual blocks and then add the results.
Compare the obtained result with the one obtained in the ﬁrst part.
5
Consider the system: H(z) =
z
z −0.5
. Evaluate:
The unit step response;
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 22 / 50
Laboratory 5 – Linear and Circular Convolution
The unit ramp response;
The response to the sequence: x(n) = 10cos
πn
3
u(n);
The response to the sequence: x(n) = 10 · 0.5
n
· u(n).
6
Two linear systems are connected in cascade:
h
1
(n) = { 2

, 3, 2, 1, −0.5, 1, 2, 4}, h
2
(n) = { 3

, −1, 5, 0, 2, 6}.
Generate an arbitrary input sequence x(n) (i.e., a sinusoidal sequence);
Evaluate the output sequence of the ﬁrst system, using the linear
convolution, and then evaluate the overall output sequence;
If the cascade order is changed, repeat the operations involved in the
precedent part. What can you conclude?
Suppose that the second system is characterized by the input-output
relation: y(n) = 0.01 [x(n)]
2
, and the ﬁrst system remains unchanged.
Repeat the precedent parts and compare the output resultant
sequences.
7
Evaluate the circular convolution of the sequences: x
1
(n) = (−2)
n
and x
2
(n) = 1.1 cos
_
π0.25n +
π
6
_
, n = 0, 10. Plot the two sequences
and the sequence obtained after the evaluation of the circular
convolution. Which is the length of the circular convolution result?
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 23 / 50
Laboratory 5 – Linear and Circular Convolution
8
Consider the sequences: x
1
(n) = 1.1 sin
_
2π0.05n +
π
4
_
and
x
2
(n) = (−1)
n
, n = 0, 15. Write a MATLAB script to evaluate:
The linear convolution;
The 16-point circular convolution in two ways (using circonv and ﬀt ,
respectively);
The circular convolution in minimum number of points required in
order to obtain the same result as in the case of the linear convolution,
in two ways (using circonv and ﬀt , respectively ).
9
Evaluate the linear and the circular (using minimum length DFT
required) convolution of the sequences: x
1
(n) = u(n) −u(n −20),
n = 0, 30 and x
2
(n) = (−0.7)
n
, n = 0, 20. Which is the minimum
length for the period N such that the values of the two convolutions
to be the same? Graph the two sequences and also those obtained
after the evaluation of linear and circular convolution, respectively.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 24 / 50
Laboratory 6 – Discrete Fourier Transform
L6. Discrete Fourier Transform
Chapter 3 — L. Grama, C. Rusu, Prelucrarea numeric˘a a semnalelor - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: The aim of this laboratory is to present the Discrete Fourier
Transform (DFT): its deﬁnition, its properties and also its implementation
in MATLAB. To become familiar with DFT read Chapter 3: Transformata
Fourier discret˘a, paragraphs 3.1.1-3.1.2 (pp. 90-95), respectively paragraph
3.1.4 for the sampling in the frequency domain (pp. 96-97). The
MATLAB functions used to implement the DFT are presented in 3.2.1
(pp. 98-99). Run scripts 3.3.1÷3.3.5, 3.3.9÷3.3.10, 3.3.12 (you can ﬁnd
the MATLAB examples in Lab6 DSP Examples as: L6 1÷L6 8). Study problems
3.3.13÷3.3.16.
Exercises:
1
Plot the magnitude and the phase of the corresponding DFT for:
x(n) =
_
1, n = 0, 5,
0, n = 6, 10.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 25 / 50
Laboratory 6 – Discrete Fourier Transform
2
Consider the sequence given in exercise 1; pad it by 116 zeros. Plot
the magnitude and the phase of the DFT for the zero-padded
sequence.
3
Generate a MATLAB program to verify the Parseval relationship for:
x(n) =
_
n + 2j , n = 0, 63,
0, otherwise.
y(n) =
_
−n + 3j , n = 0, 63,
0, otherwise.
4
An amplitude modulated signal, sampled by 1MHz, whose carrier is of
100kHz and modulation signal of 10kHz is considered. For a
modulation index of m = 0.7 graph the magnitude and the phase
spectra.
5
Consider the sequences: x
1
(n) = 0.2 sin
_
2π0.1n +
π
8
_
and
x
2
(n) = 2e
−0.2n
, n = 0, 49. Plot the sequences and their product.
Evaluate the magnitude and the phase spectra of the DFTs for x
1
(n),
x
2
(n) and x
1
(n)x
2
(n). Plot the results.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 26 / 50
Laboratory 6 – Discrete Fourier Transform
6
Evaluate the N-point DFTs of: x
1
(n) = u(n) −u(n −20), n = 0, 30
and x
2
(n) =
_
n −1, n = 0, 5,
(−1)
n
, n = 6, 10.
Graph the sequences and their
DFTs (real and imaginary parts, magnitude and phase) for
ω ∈ [−π, π] and N = 32; 128; 256; 512; 1024.
7
Consider the sequences:
x
1
(n) = { 3

, 4.2, 11, 0, 7, −1, 0, 2}, x
2
(n) = { 1.2

, 3, 0, −0.5, 2}.
Evaluate the linear convolution (using conv ) between x
1
(n) and x
2
(n).
Which is the length of the result?
In some cases, it should be convenient to evaluate the linear
convolution using the Fourier transform. At the beginning, evaluate the
linear convolution in a some way inconsistent manner. Extend x
2
(n)
with three zeros, so that both sequences to have the same length.
Evaluate then the 8-point DFT for the two sequences. After
multiplying the two DFTs, evaluate the IDFT of the product
X
1
(k)X
1
(k). Take into account only the real part of the result,
imaginary part being the result of the roundoﬀ errors. In what measure
the result is identical with the one obtained through the linear
convolution? How many samples are accurate? Why?
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 27 / 50
Laboratory 6 – Discrete Fourier Transform
Which is the minimum length DTF that must be used, so that through
the preceding procedure to obtain the same result as in the case of
linear convolution? Pad both sequences by zeros, till both of them are
of length equal by the minimum required to evaluate accurate the
linear convolution using the DFT. Repeat the previous part.
Pad with ﬁve zeros the two sequences, so that their length is greater
than the minimum required. Repeat the previous part and specify to
what extent a greater number of samples aﬀect the result.
8
Consider the sequence: x(n) = { 3

, 2, 7, 1, 4}.
Evaluate the 5-point DFT of x(n). Multiply the DFT by a complex
exponential: e
−j
2πk
5
. Compute the IDFT of the product, that is to ﬁnd
the sequence x
1
(n): x
1
(n) = IDFT{X(k)e
−j
2πk
5
}. Take into account
only the real part of x
1
(n), the imaginary part being the result of the
roundoﬀ errors. Compare x
1
(n) by x(n). Are these sequences obtained
by circular shift?
Repeat the previous part to obtain a circular shift by 3 samples;
How can you modify this technique so that to be possible to evaluate
the linear convolution?
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 28 / 50
Laboratory 7 – Finite Impulse Response Filters
L7. Finite Impulse Response Filters
Chapter 2 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: The subject of this laboratory are FIR ﬁlters. In the ﬁrst
part some theoretical aspects regarding the digital ﬁlters are presented,
ﬁlters characteristics are illustrated and some design methods are
described: windowing method, sampling in the frequency domain method
and the optimal method. To be acquainted with the digital ﬁlters read
Chapter 2: Filtre cu r˘aspuns ﬁnit la impuls, paragraphs 2.1-2.1.1 (pp. 41-42),
respectively 2.1.2-2.1.3 (pp. 42-48) to become familiar with the FIR ﬁlters
(their characteristics and approximation methods). The MATLAB
functions used to implement FIR ﬁlters are presented in 2.2.1-2.2.4 (pp.
48-54). Run scripts 2.3.1÷2.3.4 (you can ﬁnd the MATLAB examples in
Lab7 DSP Examples as: L7 1÷L7 4). Study problems 2.3.5÷2.3.6.
Exercises
1
Design a 21 FIR LPF, with the cutoﬀ frequency of 0.2.
2
Redesign the previous ﬁlter for a larger transition band.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 29 / 50
Laboratory 7 – Finite Impulse Response Filters
3
Graph the rectangular, triangular, Blackman, Hamming, Hanning,
Kaiser (diﬀerent β) windows, and also their magnitude frequency
response characteristics. Note the principal lobes’ values and the
maximum amplitudes of the secondary lobes [dB]. Verify the results
by those given in Table 2.3. For N = 20 study demowindows.m .
What happens if you modify the window’s length (N = 50)? What
can you say about the windows eﬀect in the FIR ﬁlters design?
4
Design a FIR band-reject ﬁlter, of order 21, using the windowing
method (use the windows generated in exercise 3), with the stop band
limits F
s1
= 10kHz, F
s2
= 15kHz. The sampling frequency considered
is F
s
= 90kHz. Plot the frequency response characteristic, the zeros
distribution and the impulse response of the ﬁlter, for each window.
5
Design a FIR LPF, of order 36, using the sampling in the frequency
domain method, with the pass band limit F
p
= 15kHz and the
sampling frequency F
s
= 50kHz. Sketch the frequency response
characteristics of the ﬁlter, the zeros distribution and the impulse
response.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 30 / 50
Laboratory 7 – Finite Impulse Response Filters
6
Design a FIR BPF, of minimum order, with the frequencies
F
s1
= 10kHz, F
p1
= 12kHz, F
p2
= 60kHz, F
s2
= 62kHz and the
sampling frequency F
s
= 130kHz, the minimum attenuation in the
stop bands of 40dB and the maximum attenuation in the pass band
of 3dB. Sketch the frequency response characteristics of the ﬁlter.
Hint: In order to evaluate the pass and stop band deviations use:
A
PB
= 20 lg
1 + δ
p
1 −δ
p
⇔ δ
p
=
10
A
PB
20
−1
10
A
PB
20
+ 1
A
SB
= −20 lg δ
s
⇔ δ
s
= 10

A
SB
20
.
7
Redesign the FIR PBF from exercise 6, using the SPTool graphical
interface.
8
Consider the FIR ﬁlter described by the input-output relationship:
y(n) =
1
4
[x(n) + x(n −1) + x(n −2) + x(n −3)]. Evaluate and
sketch the impulse response and the frequency response
characteristics.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 31 / 50
Laboratory 7 – Finite Impulse Response Filters
9
Design a 33 order Hilbert transformer, with optimum response, such
that the normalized frequency to be within 0.05 and 0.45.
10
Design a 55 linear phase FIR LPF, with the transition frequencies 0.2
and 0.3.
11
Design a FIR ﬁlter that approximate the magnitude characteristic:
|H(ω)| =
_
_
_
0, 0 < ω < 0.2π,
1, 0.25π < ω < 0.45π
0, 0.5π < ω < π.
Evaluate and sketch the impulse response and the frequency response
characteristics.
12
Design a linear phase LPF, of order 51, to approximate the
characteristic of an ideal LPF. The cutoﬀ frequency is considered to
be 0.2π. Graph the frequency response characteristics for the designed
ﬁlter. You should observe the presence of the Gibbs phenomenon.
13
Design a linear phase BPF, of order 40, to approximate the
characteristic of an ideal BPF (rectangular window) with the cutoﬀ
frequencies: 0.2π and 0.6π.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 32 / 50
Laboratory 7 – Finite Impulse Response Filters
14
Repeat exercise 13 for a Hamming window. Why the Gibbs
phenomenon doesn’t appear anymore? What can you say about the
transition band?
15
Design a ﬁlter to approximate the characteristic of a diﬀerentiator,
H(ω) = ω/π, considering a Blackman window. The order of the ﬁlter
should be 40.
16
Consider the moving average ﬁlter described by the
constant-coeﬃcient diﬀerence equation:
y(n) =
1
3
[x(n) + x(n −1) + x(n −2)].
Evaluate and plot the magnitude and the log-magnitude frequency
response for this ﬁlter;
At the input of this ﬁlter a signal mixed up with noise is applied. What
do you obtain at the output? Comment on the result;
Repeat the previous parts for a ﬁve order moving average ﬁlter,
described by the diﬀerence equation:
y(n) =
1
5
[x(n) + x(n −1) + x(n −2) + x(n −3) + x(n −4)].
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 33 / 50
Laboratory 7 – Finite Impulse Response Filters
17
Using a rectangular window, design a FIR BPF, of order 55, with the
normalized cutoﬀ frequencies 0.18 and 0.33. Plot the impulse
response and the frequency response characteristics.
18
Design a 55 order FIR ﬁlter, of equal ripple, to approximate the
frequency response:
H(ω) =
_
_
_
0, 0 < ω < 0.2π,
1, 0.22π < ω < 0.43π
0, 0.5π < ω < π.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 34 / 50
Laboratory 8 – Discrete-Time LTIS
L8. Discrete-Time Linear Time-Invariant Systems as Frequency
Selective Filters
Chapter 1 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To de done: The aim of this laboratory is to present the LTIS as selective
ﬁlters in the frequency domain. In the ﬁrst part the ideal ﬁlters’
characteristics are illustrated, and then some particular classes of selective
ﬁlters are shown: digital resonators, comb ﬁlters, notch ﬁlters, all-pass
ﬁlters and digital sinusoidal oscillators. The theoretical aspects are
illustrated in Chapter 1: Filtr˘ari selective paragraph 1.1 (pp. 1-20),
respectively in paragraph 1.2 (p. 20) the MATLAB functions are
described. Run scripts 1.3.1÷1.3.9 (you can ﬁnd the MATLAB examples in
Lab8 DSP Examples as: L8 1÷L8 9).
Exercises:
1
Redo example L8 9, for the other values of the frequency f
0
.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 35 / 50
Laboratory 9 – IIR Filters. Indirect Design Methods
L9. Inﬁnite Impulse Response Filters. Indirect Design Methods
Chapter 3 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: This laboratory is focused on designing, analyzing and
implementing IIR ﬁlters. In some applications, the IIR ﬁlters are more
advantageously than the FIR ﬁlters because they can realize excellent
selectivity characteristics with a lower order of the transfer function. In
contrast with the FIR ﬁlters, the IIR ones cannot have linear phase. To
become familiar with the IIR ﬁlters read Chapter 3: Filtre cu r˘aspuns inﬁnit la
impuls, paragraphs 3.1, 3.1.1 (pp. 70-77), respectively paragraph 3.1.3
used to implement the IIR ﬁlters are presented in 3.2.1-3.2.3 (pp. 84-88).
Run scripts 3.3.1÷3.3.4 (you can ﬁnd the MATLAB examples in
Lab9 DSP Examples as: L9 1÷L9 4). Study problems 3.3.5÷3.3.6.
Exercises:
1
Using the impulse invariance method design a digital Butterworth
band-pass ﬁlter, for which:
The attenuation is lower than 1dB at 4kHz and 6kHz;
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 36 / 50
Laboratory 9 – IIR Filters. Indirect Design Methods
The attenuation is greater than 40dB at 3kHz and 8kHz;
The sampling frequency is 20kHz.
1 Evaluate and sketch the frequency response characteristics for the
analog BPF and for the corresponding digital one.
2 Evaluate and sketch the impulse response of the digital BPF and the
pole-zero diagram in the z-plane.
3 Is the obtained digital ﬁlter stable?
Repeat the problem using the bilinear transformation method.
2
Repeat exercise 1 for a Cebyshev I ﬁlter. Comment on the diﬀerences.
3
Repeat exercise 1 for a Cebyshev II ﬁlter. Comment on the diﬀerences.
4
Repeat exercise 1 for an Elliptic ﬁlter. Comment on the diﬀerences.
5
Repeat exercises 1÷4 and design these ﬁlters using the graphical
interface SPTool.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 37 / 50
Laboratory 9 – IIR Filters. Indirect Design Methods
6
Consider the analog ﬁlter described by the system function:
H(s) =
2
s + 2
s
2
+ 2
2s
2
+ 3s + 2
. Using the bilinear transformation
method, obtain the corresponding digital ﬁlter; the sampling period is
equal by T = 0.8. What kind of ﬁlter is the obtained one? Is this
ﬁlter stable?
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 38 / 50
Laboratory 10 – IIR Filters. Direct Design Methods
L10. Inﬁnite Impulse Response Filters. Direct Design Methods
Chapter 3 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: In this laboratory the direct design methods for IIR ﬁlters are
described. The theoretical aspects regarding the direct design methods for
IIR ﬁlters are presented in Chapter 3: Filtre cu r˘aspuns inﬁnit la impuls in
paragraph 3.1.2 (pp. 78-83), respectively in 3.2.4 (pp. 88-91) the
MATLAB functions are illustrated. Run scripts 3.3.7÷3.3.11 (you can ﬁnd
the MATLAB examples in Lab10 DSP Examples as: L10 1÷L10 5). Study
problems 3.3.12÷3.3.13.
Exercises:
1
Consider a Cebyshev II digital HPF, with 4 poles and 4 zeros, with
the system function: H
d
(z) =
0.076945 −0.19009z
−1
+ 0.25374z
−2
−0.19009z
−3
+ 0.076945z
−4
1 + 0.80034z
−1
+ 0.73056z
−2
+ 0.17774z
−3
+ 0.035329z
−4
.
Using the Pad´e approximation method for H
d
(z), and considering the
impulse response length equal by 50, compare the method’s
performances for: M = {2; 4; 6} and N = {2; 4; 6}.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 39 / 50
Laboratory 10 – IIR Filters. Direct Design Methods
2
Consider the ﬁlter given in exercise 1; approximate it using the least
squares design method.
3
Consider the ﬁlter given in exercise 1; approximate it using Prony’s
design method.
4
Consider the ﬁlter given in exercise 1; approximate it using Shank’s
design method.
5
Using Yule-Walker method, synthesize a BRF, with the stop band
between 0.3 and 0.6 and the cutoﬀ pass band frequencies 0.25 and
0.65.
6
Design a 5 order Butterworth LPF, which satisﬁes the condition:
0.9 < H(ω) < 1, for 0 < f < 0.2.
7
Consider a LTIS described by the transfer function:
H(z) =
0.05634(1 + z
−1
)(1 −1.01666z
−1
+ z
−2
)
(1 −0.68z
−1
)(1 −1.4461z
−1
+ 0.7957z
−2
)
. Sketch the
pole-zero diagram, the frequency response characteristics and the
group delay characteristic.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 40 / 50
Laboratory 10 – IIR Filters. Direct Design Methods
8
Design a minimum order Butterworth LPF, which satisﬁes the
conditions: 0.99 < |H(f )| < 1 for 0 < f < 0.22 and
0 < |H(f )| < 0.01 for 0.25 < f < 0.5.
Plot the frequency response characteristics and the group delay
characteristic;
Find the poles and the zeros of the system function and write the
system function expression in a compact manner.
9
Repeat exercise 8 for a Cebyshev ﬁlter.
10
Design a Cebyshev BRF which must reject the frequency f = 0.22.
The design must satisfy the next requirements:
The order of the ﬁlter is ten;
The stop band width is 0.04;
The widths of the transition bands are 0.03;
The stop band attenuation must be at least 20dB, and the ripple in the
pass band is 1dB.
Evaluate the output of this ﬁlter to the excitation
x(n) = sin (2π0.22n), n = 0, 299. Comment on the result.
11
A LTIS is described by the transfer function: H(z) =
z
z −0.9
.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 41 / 50
Laboratory 10 – IIR Filters. Direct Design Methods
Evaluate and sketch the impulse response;
Evaluate and sketch the frequency response characteristics (the
magnitude and the phase);
Evaluate the output of this ﬁlter to the excitation x(n) = sin 2π0.05n,
for n = 0, 499. Compare the excitation with the output sequence. How
are aﬀected the amplitude and the phase of the input sinusoid?
Repeat the previous part for x(n) = sin (2π0.1n), n = 0, 499.
12
Two continuous-time signals are considered, x
a
(t) and y
a
(t), which
are in an integral relationship: y
a
(t) =
_
t
0
x
a
(t)dt. The integral can
be approximated using the trapezoidal rule as follows:
y
a
(t) y
a
(t
0
) +
t −t
0
2
[x
a
(t) + x
a
(t
0
)].
A discrete integrator can be represented by the ﬁnite diﬀerence
equation: y(n) = y(n −1) +
T
2
[x(n) + x(n −1)], where x(n) and
y(n), respectively, represent the sampled signals derived from x
a
(t)
and y
a
(t).
Determine the transfer function H(z) of the discrete integrator;
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 42 / 50
Laboratory 10 – IIR Filters. Direct Design Methods
Generate two vectors to describe the discrete integrator. Consider
T = 0.1s;
Consider the signal: x
a
(t) = 0.9
t
sin (2t). Its integral can be
approximated by discrete integrator. For this purpose, this signal is
sampled by T = 0.1s and it is passed through the integrator. Evaluate
the ﬁrst 100 samples for the output sequence and compare them by the
theoretical result;
Repeat previous parts for T = 0.05s.
13
Consider the LTIS described by the system function:
H(z) =
1
1 −z
−N
.
Create a variable to describe this system, and then generate 100
samples of the system’s impulse response (N = 10);
Evaluate and sketch the frequency response characteristics (the
magnitude and the phase);
Generate 10 samples of the sequence: x(n) = 9 −n, for n = 0, 9. Pad
x(n) by 90 zeros. Pass this new sequence through the ﬁlter and
evaluate the ﬁrst 100 samples of the response sequence.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 43 / 50
Laboratory 11 – Structures for the Realization of FIR Systems
L11. Structures for the Realization of Finite Impulse Response
Systems
Chapter 4 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: This laboratory is dedicated to the realization of
discrete-time LTIS with ﬁnite impulse response. The direct form, the
cascade structure, and the lattice one will be presented. It is also
described the frequency sampling implementation for a FIR system – its
advantage consists in the computational eﬃciency toward other
implementations. The theoretical aspects regarding discrete-time LTIS
implementation are presented in Chapter 4: Structuri pentru implementarea
sistemelor discrete paragraph 4.1 (pp. 122-123), respectively in 4.1.1. (pp.
123-132) the structures for the realization of FIR systems are described.
Study problems described in the examples 4.3.1÷4.3.4 (you can ﬁnd the
MATLAB scripts in Lab11 DSP Examples as: L11 1÷L11 4).
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 44 / 50
Laboratory 11 – Structures for the Realization of FIR Systems
Exercises:
1
Next FIR systems are considered:
H
1
(z) = 1 −
5
6
z
−1
+
1
6
z
−2
;
H
2
(z) =
_
1 −2z
−1
_
_
1 −0.8e
j
π
6
z
−1
__
1 −0.8e
−j
π
6
z
−1
_
;
H
3
(z) = 1 −1.27z
−1
+ 1.19z
−2
+ 1.18z
−3
+ 0.4z
−4
;
H
4
(z) = 0.5 + 0.2z
−1
−0.3z
−2
+ z
−3
;
Synthesize and draw the structures corresponding to the direct form,
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 45 / 50
Laboratory 12 – Structures for the Realization of IIR Systems
L12. Structures for the Realization of Inﬁnite Impulse Response
Systems
Chapter 4 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: In this laboratory the direct, the cascade, the parallel and the
lattice structures for the IIR systems are presented. To be acquainted with
the theoretical aspects regarding discrete-time IIR systems implementation
structures read Chapter 4: Structuri pentru implementarea sistemelor discrete,
the paragraph 4.1.2 (pp. 132-141), respectively the paragraph 4.2 (pp.
141-143), where the used MATLAB functions for IIR systems
implementation are presented. Run script 4.3.8 (you can ﬁnd the MATLAB
example in Lab12 DSP Examples as: L12 1). Study problems 4.3.5÷4.3.7.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 46 / 50
Laboratory 12 – Structures for the Realization of IIR Systems
Exercises:
1
Next IIR systems are considered:
H
1
(z) =
3
_
1 −z
−1
_ _
1 +

2z
−1
+ z
−2
_
(1 + 0.3z
−1
) (1 −0.7z
−1
+ 0.49z
−2
)
;
H
2
(z) =
_
1 −0.3e
j
π
4
z
−1
__
1 −0.3e
−j
π
4
z
−1
_
_
1 −0.6e
j
π
6
z
−1
__
1 −0.6e
−j
π
6
z
−1
_
;
H
3
(z) =
3
1 −1.27z
−1
+ 1.19z
−2
+ 1.18z
−3
+ 0.4z
−4
;
H
4
(z) =
0.5 + 0.2z
−1
−0.3z
−2
+ z
−3
1 −0.3z
−1
+ 0.2z
−2
+ 0.5z
−3
;
Synthesize and draw the structures corresponding to the direct forms
I and II, cascade, parallel and lattice implementation, respectively.
Specify for each system if it is stable or not.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 47 / 50
Laboratory 13 – Quantization of Digital Filter Coeﬃcients
L13. Quantization of Digital Filter Coeﬃcients
Chapter 2 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicat ¸ii ¸si probleme, Ed. UTPRES, 2008
To be done: The aim of this laboratory is the analysis of the word-length
eﬀects in representing numerical values on systems performances, in
diﬀerent structures. Finite-word-length eﬀects report on quantization
consequences that are present in the digital implementations of systems,
either in hardware or in software. We want to analyze the round-oﬀ
quantization eﬀects to digital ﬁlters. Theoretical aspects regarding
quantization of digital ﬁlters coeﬃcients are illustrated in Chapter 5:
Cuantizarea coeﬁcient ¸ilor ﬁltrelor digitale, paragraphs 5.1, 5.1.1-5.1.3 (pp.
169-174). The round-oﬀ quantization eﬀects in digital ﬁlters are illustrated
in the paragraph 5.1.4 (pp. 174-184). The MATLAB functions used in this
laboratory are described in the paragraph 5.2 (pg. 185-187). Run scripts
5.3.1÷5.3.13 (you can ﬁnd the MATLAB examples in Lab13 DSP Examples as:
L13 1÷L13 13).
Exercises
1
Redo example L13 12, for L

and L
1
norms. What can you notice?
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 48 / 50
Laboratory 13 – Quantization of Digital Filter Coeﬃcients
2
Redo example L13 13, for L

and L
2
norms. What can you notice?
3
Next IIR systems are considered:
H
1
(z) =
1 −2 cos

6
z
−1
+ z
−2
1 −1.4 cos

6
z
−1
+ 0.49z
−2
1 −2 cos

4
z
−1
+ z
−2
1 −1.2 cos

4
z
−1
+ 0.36z
−2
;
H
2
(z) =
0.5 + 0.2z
−1
−0.3z
−2
+ 0.1z
−3
+ z
−4
1 + 0.1z
−1
−0.3z
−2
+ 0.2z
−3
+ 0.5z
−4
.
Determine the numerator’s and denominator’s coeﬃcients and sketch
the pole-zero diagram and the frequency response characteristics;
For the direct form quantize (using truncation) the transfer function
coeﬃcients on 15, 8 and 4 bits. Note the values obtained for each
case;
1 Sketch the pole-zero diagram and the frequency response
characteristics for the transfer functions with quantized coeﬃcients;
2 Compare the frequency response characteristics of the ﬁlters with
unquantized coeﬃcients with those with quantized coeﬃcients. How
many bits are necessarily for the coeﬃcients’ representation such that
this limitation do not aﬀect much the magnitude characteristic?
Determine the parallel form of the given transfer functions;
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 49 / 50
Laboratory 13 – Quantization of Digital Filter Coeﬃcients
1 Quantize the coeﬃcients of each function from the structure on 15, 8
and 4 bits. Note the values obtained for each case;
2 Evaluate the global transfer function summing all the transfer functions
with quantized coeﬃcients and plot the global frequency response and
compare the results with the one previously obtained;
Determine the cascade form of the given transfer functions;
1 Quantize the coeﬃcients of each function from the structure on 15, 8
and 4 bits. Note the values obtained for each case;
2 Evaluate the global transfer function multiplying all the transfer
functions with quantized coeﬃcients;
3 Sketch the pole-zero diagram and the global frequency response and
compare the results with the one obtained for the direct form;
Determine the lattice structure of the given transfer functions;
1 Quantize the coeﬃcients of each function from the structure on 15, 8
and 4 bits. Note the values obtained for each case;
2 Evaluate the global transfer function and plot the pole-zero diagram
and the global frequency response; compare the results with the one
previously obtained.
Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 50 / 50