digital signal processing - utcluj.ro pns/dsp_laboratory_guide_3ea.pdf · digital signal processing...

50
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

Upload: buitruc

Post on 06-Feb-2018

219 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

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

Page 2: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

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 Filters8 Laboratory 8 – Discrete-Time Linear Time-Invariant Systems as

Frequency Selective Filters9 Laboratory 9 – Infinite Impulse Response Filters. Indirect Design

Methods10 Laboratory 10 – Infinite Impulse Response Filters. Direct Design

Methods11 Laboratory 11 – Structures for the Realization of Finite Impulse

Response Systems12 Laboratory 12 – Structures for the Realization of Infinite Impulse

Response Systems

13 Laboratory 13 – Quantization of Digital Filter Coefficients

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 2 / 50

Page 3: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 1 – Introduction to MATLAB

L1. Introduction to MATLABAppendix A — L. Grama, C. Rusu, Prelucrarea numerica a semnalelor - aplicatii 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 nextlaboratories, read Appendix A: Notiuni MATLAB (pp. 139-165) and enterthe described examples in the command line.

Exercises:

1 Consider the matrices: A =

3 2 18 4 50 2 0

, B =

2 3 41 1 12 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. Usethe long e format.

2 Generate a linearly spaced vector between 3 and 9 with the increment2.

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

Page 4: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 1 – Introduction to MATLAB

4 Generate a 9 point logarithmically spaced vector between decades10−3 and 103.

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 andgenerate another vector of the same length, with only 1s elements.

7 Evaluate the element by element product of the matrices:

A =

9 8 76 5 43 2 1

and B =

1 0 11 0 11 0 1

.

8 Graph x(n) = sin 2π1

5n, 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

Page 5: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

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

Page 6: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 2 – Discrete-Time Signals

L2. Discrete-Time SignalsChapter 1 — L. Grama, C. Rusu, Prelucrarea numerica a semnalelor - aplicatii si probleme, Ed. UTPRES, 2008

To be done: In this laboratory the discrete time sequences (definition,classification and properties) are presented. It will be also illustrated theway to represent discrete-time signals using MATLAB. To be acquaintedwith signals and sequences, read Chapter 1: Semnale si secvente, paragraphs1.1.1-1.1.2 (pp. 1-4), respectively paragraphs 1.2.1-1.2.2 (pp. 8-10) to seethe MATLAB functions used in the sequences description. Run scripts1.3.1÷1.3.12 (you can find 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, andgraph the real and the imaginary part of the generated sequence, inthe same figure, using subplot(mnp) command.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 6 / 50

Page 7: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 2 – Discrete-Time Signals

3 Generate and plot next sequences (abscissa n must include only theindicated range):

x1(n) = 0.5δ(n), n = −5, 10;

x2(n) = 0.8δ(n − 5), n = −5, 10;

x3(n) = 1.5δ(n + 100), n = −150, 0;

x4(n) = 2u(n), n = −20, 20;

x5(n) = 1.5u(n − 10), n = −10, 20;

x6(n) = 2.5u(n + 10), n = −15, 15;

x7(n) = 1.2δ(n + 5) + 1.3 [u(n)− u(n − 20)] , n = −15, 25;

x8(n) = 2.2 sin(

2π0.1n +π

4

), n = 0, 49;

x9(n) = 1.5 sin(π

4n +

π

3

), n = 0, 20;

x10(n) = 2 cos

(π√5

n +π

6

), n = −20, 20;

x11(n) = ln∣∣∣sin

( π10

n)− cos

( π10

n)∣∣∣, n = −20, 20;

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 7 / 50

Page 8: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 2 – Discrete-Time Signals

x12(n) = exp (3n), n = 0, 9;

x13(n) = (−3)n sin(π

8n), n = 0, 20;

x14(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 6= 0,

1, n = 0.

5 Generate the ramp sequence, with initial value 0 and final value 100,

of length 20: x(n) =100

19n, 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

Page 9: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

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:

x1(n) = exp (−0.1n) sin(

2π0.1n +π

4

);

x2(n) = exp (−0.1n) cos(

2π0.1n +π

4

).

9 Generate and plot next sequences:

x1(n) =

{n(2− n), n = −5, 10

10, otherwise− 10 ≤ n ≤ 20;

x2(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 different amplitude, frequency andphase and plot them simultaneously on the screen (minimum 1period).

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 9 / 50

Page 10: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 2 – Discrete-Time Signals

11 Generate 16 periods of a periodic sequence; every period consists in 5samples of 1 and 10 samples of 0.

12 Generate an uniformly distributed random sequence, between 0 and10. Plot this sequence for n = 0, 49.Hint: To generate an uniform distributed random sequence on a specified 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), between0 and 10. Graph this sequence for n = 0, 49.Hint: This sequence has a specific 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 sinesequence by an uniform noise with the amplitude 10 times lower.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 10 / 50

Page 11: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 2 – Discrete-Time Signals

15 Generate and plot the sequences of length 100:x1(n) = δ(n)− δ(n − 5);

x2(n) = u(n − 5);

x3(n) = n [u(n)− u(n − 10)] ;

x4(n) = e(−0.2+j0.3)n;

x5(n) = n [u(n)− u(n − 10)] + e(−0.2+j0.3)n;

x6(n) = n [u(n)− u(n − 10)] + e0.3n [u(n − 10)− u(n − 20)] .

16 Add an uniformly distributed random sequence of mean 0 andmaximum amplitude 0.2, to the 100 length sequences generated atexercise 15.

17 Repeat exercise 16, for a gaussian sequence of mean 0 and variance0.1.

18 Generate 101 samples of a ramp sequence with the initial value 0 andthe 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

Page 12: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 2 – Discrete-Time Signals

19 Generate and graph a rectangular sequence and a sawtooth one with15 samples per period. You have to represent graphically 5 periods.

20 Create a MATLAB function to generate a finite length sinusoidalsequence. The function must have 5 input arguments: 3 for thesinusoid’s parameters and 2 to specify the first and the last index ofthe finite sequence. The function will return a colon vector that willcontain the sinusoid values.Hint: function seq = gensin(ampl, freq, phase, ninitial, nfinal) .

Use the created function in a MATLAB script to evaluate theminimum, the maximum, the mean and the standard deviation of asinusoidal 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 outputarguments: a vector that contains the values of the sequence and avector with the corresponding indices.Hint: function [seq, n] = gensin1(ampl, freq, phase, ninitial, nfinal) .

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 12 / 50

Page 13: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 3 – Sampling of Analog Signals

L3. Sampling of Analog SignalsChapter 1 — L. Grama, C. Rusu, Prelucrarea numerica a semnalelor - aplicatii si probleme, Ed. UTPRES, 2008

To be done: The aim of this laboratory is the introduction of analogsignals, the way to obtain a discrete-time sequence from an analog signal(sampling of analog signals) and the way to reconstruct analog signalsfrom samples. To be acquainted with analog signals, their way of samplingand their reconstruction from samples see Chapter 1: Semnale si secvente,paragraphs 1.1.1-1.1.5 (pp. 1-8). In paragraph 1.2.3 (p. 11) the MATLABfunctions used for interpolation are presented. Run scripts 1.3.13÷1.3.15(you can find the MATLAB examples in Lab3 DSP Examples as: L3 1÷L3 3).Study problem 1.3.16.

Exercises1 Plot an amplitude modulated signal, sampled by 1 MHz, whose

carrier is of 100kHz and modulation signal of 10 kHz, for amodulation index m = 1.2. Graph on the same figure, but in adifferent pane the suppressed carrier amplitude modulated sequence.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 13 / 50

Page 14: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 3 – Sampling of Analog Signals

2 From all sequences obtained after sampling analog sinusoidal signalsby 50kHz, which one has the major variation?

3 Generate 101 samples of a sequence obtained from an analogsinusoidal signal sampled by 1 kHz; the analog sinusoid has unitaryamplitude, zero phase and a frequency of 100 Hz.

From the previous sequence generate a full-wave rectified 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 figure, but in different panes.

4 Consider an analog sinusoidal signal with frequency F = 200 Hz. Thissignal is sampled by Fs = 800 Hz. Plot the analog signal, thediscrete-time sequence obtained after sampling and the analog signalthat can be recovered from samples (Fsim = 8 kHz).

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 14 / 50

Page 15: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 3 – Sampling of Analog Signals

5 Consider the analog sinusoids with frequencies: 300 Hz, 400 Hz, 500Hz, 700 Hz, 900 Hz. All of them are sampled by 900 Hz (don’t forgetthe simulation frequency). Plot the analog sinusoidal signals, thesequences obtained after sampling, the analog signals that can berecovered from the corresponding samples and also the correspondingspectra. Is there any alias error? Why?

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 15 / 50

Page 16: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 4 – Discrete-Time Linear Time-Invariant Systems

L4. Discrete-Time Linear Time-Invariant SystemsChapter 2 — L. Grama, C. Rusu, Prelucrarea numerica a semnalelor - aplicatii 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, withzero initial conditions, is illustrated. In this laboratory, the usage ofz-transform to LTIS characterization is also presented. To be familiar withLTIS 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 impulseresponse of a LTIS, respectively the functions used to characterize thediscrete-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 find 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)} = x2(n) is nonlinear. Consider:x1(n) = sin (2π0.1n), x2(n) = sin (2π0.15n), a = 3 and b = −3.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 16 / 50

Page 17: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 4 – Discrete-Time Linear Time-Invariant Systems

2 Two causal systems are considered. Determine which one is stable.Comment on your answer.

H1(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;

H2(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)(z2 + 5)

(z − 0.7)(z2 − z + 0.49).

Represent the poles and the zeros in the z-plane;Evaluate and plot the phase response characteristic. Is this system alinear-phase one?

4 Next transfer functions of some discrete LTIS are considered:H1(z) = 1− 4z−1 + 4z−2; H2(z) = 1 + 4z−1 + 4z−2;

H3(z) = 1− z−1 + 0.25z−2; H4(z) =

(1 + z−1

)2

1− z−1 + 0.25z−2;

H5(z) =

(1− z−1

)2

1− z−1 + 0.25z−2; H6(z) =

1

1− z−1 + 0.25z−2.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 17 / 50

Page 18: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 4 – Discrete-Time Linear Time-Invariant Systems

Using the zplane command represent the pole-zero diagrams for

Hi (z), i = 1, 6;

Using the freqz command represent the frequency responsecharacteristics for each system. Specify what type of system isdescribed by each transfer function;Evaluate and plot the unit impulse and the unit step response forH5(z).

5 Find the impulse response of the system: H(z) =0.5z2 + 0.5z

z2 − 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 first 50 samples of the impulse response sequence of the

system: H(z) =z2 + 1

z3 − 1.9z2 + 1.55z − 0.425.

8 Evaluate the first 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

Page 19: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 4 – Discrete-Time Linear Time-Invariant Systems

9 A discrete LTIS is characterized by the constant-coefficient differenceequation:

y(n)− 1.5 cosπ

8y(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

ak z−k using the roots

command. If these roots are complex-conjugate, the response of thesystem contains harmonic components. Represent the real and theimaginary part of the complex sequences pn

k u(n), n = 0, 30 (pk are thesystem’s poles);Accordingly to the difference equation, the impulse response sequenceis: h(n) = (a1pn

1 + a2pn2 ) u(n). Determine the constants a1 and a2.

Evaluate the impulse response using the MATLAB command impz

(see L4 8.m);Determine the steady-state response of the system to the complexexponential input sequence (see L4 9.m): x(n) = e jω0n, n = 0, 60,

ω0 =π

6, using the relation: y(n) = |H(ω0)|e jω0n+∠H(ω0).

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 19 / 50

Page 20: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 4 – Discrete-Time Linear Time-Invariant Systems

10 Analyze the effect of poles and zeros of a system function H(z) onthe magnitude of the frequency response |H(ω)|, for the systems:

H1(z) =(1− z1z−1

) (1− z2z−1

)where:

1) z1,2 = 1; 2) z1,2 = e±j π6 ; 3) z1,2 = e±j π

3 ; 4) z1,2 = e±j π2 ;

5) z1,2 = e±j 2π3 ; 6) z1,2 = e±j 5π

6 ; 7) z1,2 = −1.Analyze how |H(ω)| is modifying accordingly to the zeros position, andrepresent the zeros in z-plane. What do you observe? Comment on theresults.

H2(z) =0.3(

1− p1z−1) (

1− p2z−1) where:

1) p1,2 = 0.3; 2) p1,2 = e±j π4 ; 3) p1,2 = e±j π

2 ; 4) p1,2 = −0.3.Analyze how |H(ω)| is modifying accordingly to the poles position, andrepresent the poles in z-plane. What do you observe? Comment on theresults.

11 For the sequence: x(n) = (0.9)n sin (0.2n), n = 0, 99, find the impulseresponse after you evaluate X (z).Hint: The z-transform of the sequence x(n) = an sin (ω0n)u(n) is

H(z) =az−1 sinω0

1− 2az−1 cosω0 + a2z−2, |z | > |a|.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 20 / 50

Page 21: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 5 – Linear and Circular Convolution

L5. Linear and Circular ConvolutionChapters 2 and 3 — L. Grama, C. Rusu, Prelucrarea numerica a semnalelor - aplicatii si probleme, Ed. UTPRES, 2008

To be done: The aim of this laboratory is to present the linear and thecircular convolution. You can find the theoretical aspects regarding thelinear convolution in Chapter 2: Semnale discrete, paragraph 2.1.4 (pp.47-48), respectively in 2.2.3 (p. 50) the MATLAB commands used forlinear convolution evaluation. In Chapter 3: Transformata Fourier discreta,paragraph 3.1.3 (pp. 95-96) you can find the aspects regarding the circularconvolution. 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 find the

MATLAB examples in Lab5 DSP Examples as: L5 1÷L5 5). Study problems2.3.15÷2.3.16.

Exercises:1 Determine the linear convolution of the sequences: x1(n) = |10− n|

and x2(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 ofthe sequence obtained after performing the linear convolution?

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 21 / 50

Page 22: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

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) isapplied. 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 sequencex(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 first 100 samples of the unit step response sequence;Express the system function as: H(z) = H1(z) + H2(z) and determinethe unit step response of the individual blocks and then add the results.Compare the obtained result with the one obtained in the first 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

Page 23: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 5 – Linear and Circular Convolution

The unit ramp response;

The response to the sequence: x(n) = 10cosπn

3u(n);

The response to the sequence: x(n) = 10 · 0.5n · u(n).

6 Two linear systems are connected in cascade:

h1(n) = { 2�, 3, 2, 1,−0.5, 1, 2, 4}, h2(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 first system, using the linearconvolution, and then evaluate the overall output sequence;If the cascade order is changed, repeat the operations involved in theprecedent part. What can you conclude?Suppose that the second system is characterized by the input-outputrelation: y(n) = 0.01 [x(n)]2, and the first system remains unchanged.Repeat the precedent parts and compare the output resultantsequences.

7 Evaluate the circular convolution of the sequences: x1(n) = (−2)n

and x2(n) = 1.1 cos(π0.25n +

π

6

), n = 0, 10. Plot the two sequences

and the sequence obtained after the evaluation of the circularconvolution. Which is the length of the circular convolution result?

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 23 / 50

Page 24: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 5 – Linear and Circular Convolution

8 Consider the sequences: x1(n) = 1.1 sin(

2π0.05n +π

4

)and

x2(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 fft ,respectively);The circular convolution in minimum number of points required inorder to obtain the same result as in the case of the linear convolution,in two ways (using circonv and fft , respectively ).

9 Evaluate the linear and the circular (using minimum length DFTrequired) convolution of the sequences: x1(n) = u(n)− u(n − 20),n = 0, 30 and x2(n) = (−0.7)n, n = 0, 20. Which is the minimumlength for the period N such that the values of the two convolutionsto be the same? Graph the two sequences and also those obtainedafter the evaluation of linear and circular convolution, respectively.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 24 / 50

Page 25: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 6 – Discrete Fourier Transform

L6. Discrete Fourier TransformChapter 3 — L. Grama, C. Rusu, Prelucrarea numerica a semnalelor - aplicatii si probleme, Ed. UTPRES, 2008

To be done: The aim of this laboratory is to present the Discrete FourierTransform (DFT): its definition, its properties and also its implementationin MATLAB. To become familiar with DFT read Chapter 3: Transformata

Fourier discreta, paragraphs 3.1.1-3.1.2 (pp. 90-95), respectively paragraph3.1.4 for the sampling in the frequency domain (pp. 96-97). TheMATLAB 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 find

the MATLAB examples in Lab6 DSP Examples as: L6 1÷L6 8). Study problems3.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

Page 26: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 6 – Discrete Fourier Transform

2 Consider the sequence given in exercise 1; pad it by 116 zeros. Plotthe magnitude and the phase of the DFT for the zero-paddedsequence.

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 of100kHz and modulation signal of 10kHz is considered. For amodulation index of m = 0.7 graph the magnitude and the phasespectra.

5 Consider the sequences: x1(n) = 0.2 sin(2π0.1n + π

8

)and

x2(n) = 2e−0.2n, n = 0, 49. Plot the sequences and their product.Evaluate the magnitude and the phase spectra of the DFTs for x1(n),x2(n) and x1(n)x2(n). Plot the results.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 26 / 50

Page 27: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 6 – Discrete Fourier Transform

6 Evaluate the N-point DFTs of: x1(n) = u(n)− u(n − 20), n = 0, 30

and x2(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:

x1(n) = { 3�, 4.2, 11, 0, 7,−1, 0, 2}, x2(n) = { 1.2

�, 3, 0,−0.5, 2}.

Evaluate the linear convolution (using conv ) between x1(n) and x2(n).Which is the length of the result?In some cases, it should be convenient to evaluate the linearconvolution using the Fourier transform. At the beginning, evaluate thelinear convolution in a some way inconsistent manner. Extend x2(n)with three zeros, so that both sequences to have the same length.Evaluate then the 8-point DFT for the two sequences. Aftermultiplying the two DFTs, evaluate the IDFT of the productX1(k)X1(k). Take into account only the real part of the result,imaginary part being the result of the roundoff errors. In what measurethe result is identical with the one obtained through the linearconvolution? How many samples are accurate? Why?

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 27 / 50

Page 28: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 6 – Discrete Fourier Transform

Which is the minimum length DTF that must be used, so that throughthe preceding procedure to obtain the same result as in the case oflinear convolution? Pad both sequences by zeros, till both of them areof length equal by the minimum required to evaluate accurate thelinear convolution using the DFT. Repeat the previous part.Pad with five zeros the two sequences, so that their length is greaterthan the minimum required. Repeat the previous part and specify towhat extent a greater number of samples affect 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πk5 . Compute the IDFT of the product, that is to find

the sequence x1(n): x1(n) = IDFT{X (k)e−j 2πk5 }. Take into account

only the real part of x1(n), the imaginary part being the result of theroundoff errors. Compare x1(n) by x(n). Are these sequences obtainedby 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 evaluatethe linear convolution?

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 28 / 50

Page 29: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 7 – Finite Impulse Response Filters

L7. Finite Impulse Response FiltersChapter 2 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicatii si probleme, Ed. UTPRES, 2008

To be done: The subject of this laboratory are FIR filters. In the firstpart some theoretical aspects regarding the digital filters are presented,their advantages and disadvantages toward the analog ones. The FIRfilters characteristics are illustrated and some design methods aredescribed: windowing method, sampling in the frequency domain methodand the optimal method. To be acquainted with the digital filters readChapter 2: Filtre cu raspuns finit 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 filters(their characteristics and approximation methods). The MATLABfunctions used to implement FIR filters are presented in 2.2.1-2.2.4 (pp.48-54). Run scripts 2.3.1÷2.3.4 (you can find the MATLAB examples in

Lab7 DSP Examples as: L7 1÷L7 4). Study problems 2.3.5÷2.3.6.

Exercises1 Design a 21 FIR LPF, with the cutoff frequency of 0.2.

2 Redesign the previous filter for a larger transition band.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 29 / 50

Page 30: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 7 – Finite Impulse Response Filters

3 Graph the rectangular, triangular, Blackman, Hamming, Hanning,Kaiser (different β) windows, and also their magnitude frequencyresponse characteristics. Note the principal lobes’ values and themaximum amplitudes of the secondary lobes [dB]. Verify the resultsby those given in Table 2.3. For N = 20 study demowindows.m .What happens if you modify the window’s length (N = 50)? Whatcan you say about the windows effect in the FIR filters design?

4 Design a FIR band-reject filter, of order 21, using the windowingmethod (use the windows generated in exercise 3), with the stop bandlimits Fs1 = 10kHz, Fs2 = 15kHz. The sampling frequency consideredis Fs = 90kHz. Plot the frequency response characteristic, the zerosdistribution and the impulse response of the filter, for each window.

5 Design a FIR LPF, of order 36, using the sampling in the frequencydomain method, with the pass band limit Fp = 15kHz and thesampling frequency Fs = 50kHz. Sketch the frequency responsecharacteristics of the filter, the zeros distribution and the impulseresponse.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 30 / 50

Page 31: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 7 – Finite Impulse Response Filters

6 Design a FIR BPF, of minimum order, with the frequenciesFs1 = 10kHz, Fp1 = 12kHz, Fp2 = 60kHz, Fs2 = 62kHz and thesampling frequency Fs = 130kHz, the minimum attenuation in thestop bands of 40dB and the maximum attenuation in the pass bandof 3dB. Sketch the frequency response characteristics of the filter.Hint: In order to evaluate the pass and stop band deviations use:

APB = 20 lg1 + δp

1− δp⇔ δp =

10APB

20 − 1

10APB

20 + 1

ASB = −20 lg δs ⇔ δs = 10− ASB20 .

7 Redesign the FIR PBF from exercise 6, using the SPTool graphicalinterface.

8 Consider the FIR filter 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 responsecharacteristics.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 31 / 50

Page 32: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 7 – Finite Impulse Response Filters

9 Design a 33 order Hilbert transformer, with optimum response, suchthat the normalized frequency to be within 0.05 and 0.45.

10 Design a 55 linear phase FIR LPF, with the transition frequencies 0.2and 0.3.

11 Design a FIR filter 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 responsecharacteristics.

12 Design a linear phase LPF, of order 51, to approximate thecharacteristic of an ideal LPF. The cutoff frequency is considered tobe 0.2π. Graph the frequency response characteristics for the designedfilter. You should observe the presence of the Gibbs phenomenon.

13 Design a linear phase BPF, of order 40, to approximate thecharacteristic of an ideal BPF (rectangular window) with the cutofffrequencies: 0.2π and 0.6π.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 32 / 50

Page 33: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 7 – Finite Impulse Response Filters

14 Repeat exercise 13 for a Hamming window. Why the Gibbsphenomenon doesn’t appear anymore? What can you say about thetransition band?

15 Design a filter to approximate the characteristic of a differentiator,H(ω) = ω/π, considering a Blackman window. The order of the filtershould be 40.

16 Consider the moving average filter described by theconstant-coefficient difference equation:

y(n) =1

3[x(n) + x(n − 1) + x(n − 2)].

Evaluate and plot the magnitude and the log-magnitude frequencyresponse for this filter;At the input of this filter a signal mixed up with noise is applied. Whatdo you obtain at the output? Comment on the result;Repeat the previous parts for a five order moving average filter,described by the difference 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

Page 34: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 7 – Finite Impulse Response Filters

17 Using a rectangular window, design a FIR BPF, of order 55, with thenormalized cutoff frequencies 0.18 and 0.33. Plot the impulseresponse and the frequency response characteristics.

18 Design a 55 order FIR filter, of equal ripple, to approximate thefrequency 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

Page 35: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 8 – Discrete-Time LTIS

L8. Discrete-Time Linear Time-Invariant Systems as FrequencySelective FiltersChapter 1 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicatii si probleme, Ed. UTPRES, 2008

To de done: The aim of this laboratory is to present the LTIS as selectivefilters in the frequency domain. In the first part the ideal filters’characteristics are illustrated, and then some particular classes of selectivefilters are shown: digital resonators, comb filters, notch filters, all-passfilters and digital sinusoidal oscillators. The theoretical aspects areillustrated in Chapter 1: Filtrari selective paragraph 1.1 (pp. 1-20),respectively in paragraph 1.2 (p. 20) the MATLAB functions aredescribed. Run scripts 1.3.1÷1.3.9 (you can find 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 f0.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 35 / 50

Page 36: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 9 – IIR Filters. Indirect Design Methods

L9. Infinite Impulse Response Filters. Indirect Design MethodsChapter 3 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicatii si probleme, Ed. UTPRES, 2008

To be done: This laboratory is focused on designing, analyzing andimplementing IIR filters. In some applications, the IIR filters are moreadvantageously than the FIR filters because they can realize excellentselectivity characteristics with a lower order of the transfer function. Incontrast with the FIR filters, the IIR ones cannot have linear phase. Tobecome familiar with the IIR filters read Chapter 3: Filtre cu raspuns infinit la

impuls, paragraphs 3.1, 3.1.1 (pp. 70-77), respectively paragraph 3.1.3(pp. 83-84) about the IIR filters advantages. The MATLAB functionsused to implement the IIR filters are presented in 3.2.1-3.2.3 (pp. 84-88).Run scripts 3.3.1÷3.3.4 (you can find 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 filter, 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

Page 37: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

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 theanalog BPF and for the corresponding digital one.

2 Evaluate and sketch the impulse response of the digital BPF and thepole-zero diagram in the z-plane.

3 Is the obtained digital filter stable?

Repeat the problem using the bilinear transformation method.

2 Repeat exercise 1 for a Cebyshev I filter. Comment on the differences.

3 Repeat exercise 1 for a Cebyshev II filter. Comment on the differences.

4 Repeat exercise 1 for an Elliptic filter. Comment on the differences.

5 Repeat exercises 1÷4 and design these filters using the graphicalinterface SPTool.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 37 / 50

Page 38: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 9 – IIR Filters. Indirect Design Methods

6 Consider the analog filter described by the system function:

H(s) =2

s + 2

s2 + 2

2s2 + 3s + 2. Using the bilinear transformation

method, obtain the corresponding digital filter; the sampling period isequal by T = 0.8. What kind of filter is the obtained one? Is thisfilter stable?

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 38 / 50

Page 39: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 10 – IIR Filters. Direct Design Methods

L10. Infinite Impulse Response Filters. Direct Design MethodsChapter 3 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicatii si probleme, Ed. UTPRES, 2008

To be done: In this laboratory the direct design methods for IIR filters aredescribed. The theoretical aspects regarding the direct design methods forIIR filters are presented in Chapter 3: Filtre cu raspuns infinit la impuls inparagraph 3.1.2 (pp. 78-83), respectively in 3.2.4 (pp. 88-91) theMATLAB functions are illustrated. Run scripts 3.3.7÷3.3.11 (you can find

the MATLAB examples in Lab10 DSP Examples as: L10 1÷L10 5). Studyproblems 3.3.12÷3.3.13.

Exercises:1 Consider a Cebyshev II digital HPF, with 4 poles and 4 zeros, with

the system function: Hd (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 Pade approximation method for Hd (z), and considering theimpulse response length equal by 50, compare the method’sperformances for: M = {2; 4; 6} and N = {2; 4; 6}.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 39 / 50

Page 40: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 10 – IIR Filters. Direct Design Methods

2 Consider the filter given in exercise 1; approximate it using the leastsquares design method.

3 Consider the filter given in exercise 1; approximate it using Prony’sdesign method.

4 Consider the filter given in exercise 1; approximate it using Shank’sdesign method.

5 Using Yule-Walker method, synthesize a BRF, with the stop bandbetween 0.3 and 0.6 and the cutoff pass band frequencies 0.25 and0.65.

6 Design a 5 order Butterworth LPF, which satisfies 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 thegroup delay characteristic.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 40 / 50

Page 41: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 10 – IIR Filters. Direct Design Methods

8 Design a minimum order Butterworth LPF, which satisfies theconditions: 0.99 < |H(f )| < 1 for 0 < f < 0.22 and0 < |H(f )| < 0.01 for 0.25 < f < 0.5.

Plot the frequency response characteristics and the group delaycharacteristic;Find the poles and the zeros of the system function and write thesystem function expression in a compact manner.

9 Repeat exercise 8 for a Cebyshev filter.10 Design a Cebyshev BRF which must reject the frequency f = 0.22.

The design must satisfy the next requirements:

The order of the filter 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 thepass band is 1dB.

Evaluate the output of this filter to the excitationx(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

Page 42: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 10 – IIR Filters. Direct Design Methods

Evaluate and sketch the impulse response;Evaluate and sketch the frequency response characteristics (themagnitude and the phase);Evaluate the output of this filter to the excitation x(n) = sin 2π0.05n,for n = 0, 499. Compare the excitation with the output sequence. Howare affected 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, xa(t) and ya(t), which

are in an integral relationship: ya(t) =

∫ t

0xa(t)dt. The integral can

be approximated using the trapezoidal rule as follows:

ya(t) ' ya(t0) +t − t0

2[xa(t) + xa(t0)].

A discrete integrator can be represented by the finite difference

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 xa(t)and ya(t).

Determine the transfer function H(z) of the discrete integrator;

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 42 / 50

Page 43: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 10 – IIR Filters. Direct Design Methods

Generate two vectors to describe the discrete integrator. ConsiderT = 0.1s;Consider the signal: xa(t) = 0.9t sin (2t). Its integral can beapproximated by discrete integrator. For this purpose, this signal issampled by T = 0.1s and it is passed through the integrator. Evaluatethe first 100 samples for the output sequence and compare them by thetheoretical 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 100samples of the system’s impulse response (N = 10);Evaluate and sketch the frequency response characteristics (themagnitude and the phase);Generate 10 samples of the sequence: x(n) = 9− n, for n = 0, 9. Padx(n) by 90 zeros. Pass this new sequence through the filter andevaluate the first 100 samples of the response sequence.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 43 / 50

Page 44: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 11 – Structures for the Realization of FIR Systems

L11. Structures for the Realization of Finite Impulse ResponseSystemsChapter 4 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicatii si probleme, Ed. UTPRES, 2008

To be done: This laboratory is dedicated to the realization ofdiscrete-time LTIS with finite impulse response. The direct form, thecascade structure, and the lattice one will be presented. It is alsodescribed the frequency sampling implementation for a FIR system – itsadvantage consists in the computational efficiency toward otherimplementations. The theoretical aspects regarding discrete-time LTISimplementation 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 find 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

Page 45: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 11 – Structures for the Realization of FIR Systems

Exercises:1 Next FIR systems are considered:

H1(z) = 1− 5

6z−1 +

1

6z−2;

H2(z) =(1− 2z−1

) (1− 0.8e j π

6 z−1)(

1− 0.8e−j π6 z−1

);

H3(z) = 1− 1.27z−1 + 1.19z−2 + 1.18z−3 + 0.4z−4;

H4(z) = 0.5 + 0.2z−1 − 0.3z−2 + z−3;

Synthesize and draw the structures corresponding to the direct form,cascade and lattice implementation, respectively.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 45 / 50

Page 46: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 12 – Structures for the Realization of IIR Systems

L12. Structures for the Realization of Infinite Impulse ResponseSystemsChapter 4 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicatii si probleme, Ed. UTPRES, 2008

To be done: In this laboratory the direct, the cascade, the parallel and thelattice structures for the IIR systems are presented. To be acquainted withthe theoretical aspects regarding discrete-time IIR systems implementationstructures 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 systemsimplementation are presented. Run script 4.3.8 (you can find 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

Page 47: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 12 – Structures for the Realization of IIR Systems

Exercises:1 Next IIR systems are considered:

H1(z) =3(1− z−1

) (1 +√

2z−1 + z−2)

(1 + 0.3z−1) (1− 0.7z−1 + 0.49z−2);

H2(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) ;

H3(z) =3

1− 1.27z−1 + 1.19z−2 + 1.18z−3 + 0.4z−4;

H4(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 formsI 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

Page 48: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 13 – Quantization of Digital Filter Coefficients

L13. Quantization of Digital Filter CoefficientsChapter 2 — L. Grama, A. Grama, C. Rusu, Filtre numerice - aplicatii si probleme, Ed. UTPRES, 2008

To be done: The aim of this laboratory is the analysis of the word-lengtheffects in representing numerical values on systems performances, indifferent structures. Finite-word-length effects report on quantizationconsequences that are present in the digital implementations of systems,either in hardware or in software. We want to analyze the round-offquantization effects to digital filters. Theoretical aspects regardingquantization of digital filters coefficients are illustrated in Chapter 5:

Cuantizarea coeficientilor filtrelor digitale, paragraphs 5.1, 5.1.1-5.1.3 (pp.169-174). The round-off quantization effects in digital filters are illustratedin the paragraph 5.1.4 (pp. 174-184). The MATLAB functions used in thislaboratory are described in the paragraph 5.2 (pg. 185-187). Run scripts5.3.1÷5.3.13 (you can find the MATLAB examples in Lab13 DSP Examples as:

L13 1÷L13 13).

Exercises1 Redo example L13 12, for L∞ and L1 norms. What can you notice?

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 48 / 50

Page 49: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 13 – Quantization of Digital Filter Coefficients

2 Redo example L13 13, for L∞ and L2 norms. What can you notice?3 Next IIR systems are considered:

H1(z) =1− 2 cos

6z−1 + z−2

1− 1.4 cos2π

6z−1 + 0.49z−2

1− 2 cos2π

4z−1 + z−2

1− 1.2 cos2π

4z−1 + 0.36z−2

;

H2(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 coefficients and sketchthe pole-zero diagram and the frequency response characteristics;For the direct form quantize (using truncation) the transfer functioncoefficients on 15, 8 and 4 bits. Note the values obtained for eachcase;

1 Sketch the pole-zero diagram and the frequency responsecharacteristics for the transfer functions with quantized coefficients;

2 Compare the frequency response characteristics of the filters withunquantized coefficients with those with quantized coefficients. Howmany bits are necessarily for the coefficients’ representation such thatthis limitation do not affect 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

Page 50: Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_3ea.pdf · Digital Signal Processing Laboratory Guide ... { Quantization of Digital Filter Coe cients Laboratory Guide

Laboratory 13 – Quantization of Digital Filter Coefficients

1 Quantize the coefficients of each function from the structure on 15, 8and 4 bits. Note the values obtained for each case;

2 Evaluate the global transfer function summing all the transfer functionswith quantized coefficients and plot the global frequency response andcompare the results with the one previously obtained;

Determine the cascade form of the given transfer functions;

1 Quantize the coefficients of each function from the structure on 15, 8and 4 bits. Note the values obtained for each case;

2 Evaluate the global transfer function multiplying all the transferfunctions with quantized coefficients;

3 Sketch the pole-zero diagram and the global frequency response andcompare the results with the one obtained for the direct form;

Determine the lattice structure of the given transfer functions;

1 Quantize the coefficients of each function from the structure on 15, 8and 4 bits. Note the values obtained for each case;

2 Evaluate the global transfer function and plot the pole-zero diagramand the global frequency response; compare the results with the onepreviously obtained.

Laboratory Guide (sp.utcluj.ro) Digital Signal Processing 3rd Year AE 50 / 50