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

Download Digital Signal Processing - utcluj.ro PNS/DSP_Laboratory_Guide_4tst.pdf · Digital Signal Processing ... { Introduction to MATLAB 2 Laboratory 2 { Discrete-Time Signals ... { Finite

If you can't read please download the document

Upload: truongnhan

Post on 07-Feb-2018

219 views

Category:

Documents


1 download

TRANSCRIPT

  • Digital Signal Processing

    Laboratory Guide

    http://sp.utcluj.ro/Teaching_IVTST.html

    4th Year TTS

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 1 / 47

    http://sp.utcluj.ro/Teaching_IVTST.html

  • 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

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 2 / 47

  • 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 1

    2 3 2

    and thescalar 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 B1 and if K = A1 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 3 / 47

  • Laboratory 1 Introduction to MATLAB

    4 Generate a 9 point logarithmically spaced vector between decades103 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 1

    1 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 4 / 47

  • 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 5 / 47

  • 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.11.3.12 (you can find the MATLAB examples in Lab2 DSP Examples as:L2 1, impulse, L2 3L2 4, UnitStep, L2 6L2 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, inthe same figure, using subplot(mnp) command.

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 6 / 47

  • 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(

    20.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) = lnsin(

    10n) cos

    ( 10

    n), n = 20, 20;

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 7 / 47

  • 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(

    20.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 (4n) + 2 cos (0.72n), 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 8 / 47

  • Laboratory 2 Discrete-Time Signals

    8 Generate the complex-valued sequence, of length 50:

    x(n) = exp[0.1n + j

    (20.1n +

    4

    )]. Plot the sequence attenuated

    by sine and by cosine function, respectively:

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

    20.1n +

    4

    );

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

    20.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, 50.5, otherwise

    , n = 0, 10

    50, otherwise

    0 n 15;10 Generate 3 sinusoidal sequences of different amplitude, frequency and

    phase and plot them simultaneously on the screen (minimum 1period).

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 9 / 47

  • 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 toadd 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 10 / 47

  • 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 11 / 47

  • 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 thesinusoids 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 12 / 47

  • 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.131.3.15(you can find the MATLAB examples in Lab3 DSP Examples as: L3 1L3 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 13 / 47

  • 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 14 / 47

  • 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 (dont 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 15 / 47

  • 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.12.3.9 (you can find the MATLAB examples inLab4 DSP Examples as: L4 1L4 9). Study problems 2.3.102.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 (20.1n), x2(n) = sin (20.15n), a = 3 and b = 3.

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 16 / 47

  • 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.6z1 + 1.15z2 0.98z3 + 0.98z4

    1 + 1.27z1 + 2.02z2 + 1.54z3 + 0.98z4;

    H2(z) =2 2.54z1 + 5z2 4.3z3 + 3.27z4

    1 0.77z1 + 0.82z2 + 0.41z3 + 0.51z4.

    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 4z1 + 4z2; H2(z) = 1 + 4z1 + 4z2;

    H3(z) = 1 z1 + 0.25z2; H4(z) =(1 + z1

    )21 z1 + 0.25z2

    ;

    H5(z) =

    (1 z1

    )21 z1 + 0.25z2

    ; H6(z) =1

    1 z1 + 0.25z2.

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 17 / 47

  • 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 + z1 + z2 + z3

    1 0.5z1 4z2 + 2z3.

    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 (2013 - 2014) Digital Signal Processing 4th Year TTS 18 / 47

  • Laboratory 4 Discrete-Time Linear Time-Invariant Systems

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

    y(n) 1.5 cos 8

    y(n 1) + 0.95y(n 2) = x(n) + 0.4x(n 1).Determine the poles of the systems transfer function, which are the

    roots of the polynomial A(z) = 1 +N

    k=1

    ak zk 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 pnk u(n), n = 0, 30 (pk are thesystems poles);Accordingly to the difference equation, the impulse response sequenceis: h(n) = (a1p

    n1 + a2p

    n2) 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 j0n, n = 0, 60,

    0 =

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

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 19 / 47

  • 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 z1z1

    ) (1 z2z1

    )where:

    1) z1,2 = 1; 2) z1,2 = ej 6 ; 3) z1,2 = e

    j 3 ; 4) z1,2 = ej 2 ;

    5) z1,2 = ej 23 ; 6) z1,2 = e

    j 56 ; 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 p1z1) (

    1 p2z1) where:

    1) p1,2 = 0.3; 2) p1,2 = ej 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) =az1 sin0

    1 2az1 cos0 + a2z2, |z | > |a|.

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 20 / 47

  • 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.63.3.8, 3.3.11,respectively (you can find theMATLAB examples in Lab5 DSP Examples as: L5 1L5 5). Study problems2.3.152.3.16.

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

    and x2(n) = 1.5 cos(

    20.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 (2013 - 2014) Digital Signal Processing 4th Year TTS 21 / 47

  • Laboratory 5 Linear and Circular Convolution

    2 The impulse response of a LTIS is: h(n) =

    {e0.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) =

    {e0.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 (2013 - 2014) Digital Signal Processing 4th Year TTS 22 / 47

  • Laboratory 5 Linear and Circular Convolution

    The unit ramp response;

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

    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 (2013 - 2014) Digital Signal Processing 4th Year TTS 23 / 47

  • Laboratory 5 Linear and Circular Convolution

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

    20.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 (2013 - 2014) Digital Signal Processing 4th Year TTS 24 / 47

  • 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: TransformataFourier 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.13.3.5, 3.3.93.3.10, 3.3.12 (you can findthe MATLAB examples in Lab6 DSP Examples as: L6 1L6 8). Study problems3.3.133.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 (2013 - 2014) Digital Signal Processing 4th Year TTS 25 / 47

  • 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(20.1n + 8

    )and

    x2(n) = 2e0.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 (2013 - 2014) Digital Signal Processing 4th Year TTS 26 / 47

  • 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 27 / 47

  • 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: ej2k5 . Compute the IDFT of the product, that is to find

    the sequence x1(n): x1(n) = IDFT{X (k)ej2k5 }. 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 28 / 47

  • 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.12.3.4 (you can find the MATLAB examples inLab7 DSP Examples as: L7 1L7 4). Study problems 2.3.52.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 (2013 - 2014) Digital Signal Processing 4th Year TTS 29 / 47

  • 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 windows 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 30 / 47

  • 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 + p1 p

    p =10

    APB20 1

    10APB20 + 1

    ASB = 20 lg s s = 10ASB20 .

    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 (2013 - 2014) Digital Signal Processing 4th Year TTS 31 / 47

  • 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.450, 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 32 / 47

  • Laboratory 7 Finite Impulse Response Filters

    14 Repeat exercise 13 for a Hamming window. Why the Gibbsphenomenon doesnt 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 33 / 47

  • 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.430, 0.5 < < .

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 34 / 47

  • 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 filterscharacteristics 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.11.3.9 (you can find the MATLAB examples inLab8 DSP Examples as: L8 1L8 9).

    Exercises:1 Redo example L8 9, for the other values of the frequency f0.

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 35 / 47

  • 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 laimpuls, 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.13.3.4 (you can find the MATLAB examples inLab9 DSP Examples as: L9 1L9 4). Study problems 3.3.53.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 (2013 - 2014) Digital Signal Processing 4th Year TTS 36 / 47

  • 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 14 and design these filters using the graphicalinterface SPTool.

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 37 / 47

  • 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 38 / 47

  • 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.73.3.11 (you can findthe MATLAB examples in Lab10 DSP Examples as: L10 1L10 5). Studyproblems 3.3.123.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.19009z1 + 0.25374z2 0.19009z3 + 0.076945z4

    1 + 0.80034z1 + 0.73056z2 + 0.17774z3 + 0.035329z4.

    Using the Pade approximation method for Hd (z), and considering theimpulse response length equal by 50, compare the methodsperformances for: M = {2; 4; 6} and N = {2; 4; 6}.

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 39 / 47

  • 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 Pronysdesign method.

    4 Consider the filter given in exercise 1; approximate it using Shanksdesign 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 + z1)(1 1.01666z1 + z2)

    (1 0.68z1)(1 1.4461z1 + 0.7957z2). Sketch the

    pole-zero diagram, the frequency response characteristics and thegroup delay characteristic.

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 40 / 47

  • 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 (20.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 (2013 - 2014) Digital Signal Processing 4th Year TTS 41 / 47

  • 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 20.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 (20.1n), n = 0, 499.

    12 Two continuous-time signals are considered, xa(t) and ya(t), which

    are in an integral relationship: ya(t) =

    t0

    xa(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) + T2

    [x(n) + x(n 1)], where x(n) andy(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 (2013 - 2014) Digital Signal Processing 4th Year TTS 42 / 47

  • Laboratory 10 IIR Filters. Direct Design Methods

    Generate two vectors to describe the discrete integrator. ConsiderT = 0.1s;Consider the signal: xa(t) = 0.9

    t 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 zN.

    Create a variable to describe this system, and then generate 100samples of the systems 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 (2013 - 2014) Digital Signal Processing 4th Year TTS 43 / 47

  • 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 implementareasistemelor 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.14.3.4 (you can find theMATLAB scripts in Lab11 DSP Examples as: L11 1L11 4).

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 44 / 47

  • Laboratory 11 Structures for the Realization of FIR Systems

    Exercises:1 Next FIR systems are considered:

    H1(z) = 15

    6z1 +

    1

    6z2;

    H2(z) =(1 2z1

    ) (1 0.8e j

    6 z1

    )(1 0.8ej

    6 z1

    );

    H3(z) = 1 1.27z1 + 1.19z2 + 1.18z3 + 0.4z4;H4(z) = 0.5 + 0.2z

    1 0.3z2 + z3;

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

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 45 / 47

  • 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 MATLABexample in Lab12 DSP Examples as: L12 1). Study problems 4.3.54.3.7.

    Laboratory Guide (2013 - 2014) Digital Signal Processing 4th Year TTS 46 / 47

  • Laboratory 12 Structures for the Realization of IIR Systems

    Exercises:1 Next IIR systems are considered:

    H1(z) =3(1 z1

    ) (1 +

    2z1 + z2)

    (1 + 0.3z1) (1 0.7z1 + 0.49z2);

    H2(z) =

    (1 0.3e j

    4 z1

    )(1 0.3ej

    4 z1

    )(

    1 0.6e j6 z1

    )(1 0.6ej

    6 z1

    ) ;H3(z) =

    3

    1 1.27z1 + 1.19z2 + 1.18z3 + 0.4z4;

    H4(z) =0.5 + 0.2z1 0.3z2 + z3

    1 0.3z1 + 0.2z2 + 0.5z3;

    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 (2013 - 2014) Digital Signal Processing 4th Year TTS 47 / 47

    Laboratory 1 Introduction to MATLABLaboratory 2 Discrete-Time SignalsLaboratory 3 Sampling of Analog SignalsLaboratory 4 Discrete-Time Linear Time-Invariant SystemsLaboratory 5 Linear and Circular ConvolutionLaboratory 6 Discrete Fourier TransformLaboratory 7 Finite Impulse Response FiltersLaboratory 8 Discrete-Time Linear Time-Invariant Systems as Frequency Selective FiltersLaboratory 9 Infinite Impulse Response Filters. Indirect Design MethodsLaboratory 10 Infinite Impulse Response Filters. Direct Design MethodsLaboratory 11 Structures for the Realization of Finite Impulse Response SystemsLaboratory 12 Structures for the Realization of Infinite Impulse Response Systems