Digital Signal Processing Lab 4: Transfer Functions in the Z-domain

Similar documents
Digital Signal Processing: Signal Transforms

z-transform Chapter 6

ECE503: Digital Signal Processing Lecture 4

ELEG 305: Digital Signal Processing

Discrete-Time Signals and Systems. The z-transform and Its Application. The Direct z-transform. Region of Convergence. Reference: Sections

Very useful for designing and analyzing signal processing systems

Lab 3 & 4. LTI Systems, the Z-Transform, and an Introduction

Discrete Time Systems

Z Transform (Part - II)

Z - Transform. It offers the techniques for digital filter design and frequency analysis of digital signals.

Lecture 19 IIR Filters

EECE 301 Signals & Systems Prof. Mark Fowler

DSP Laboratory (EELE 4110) Lab#5 DTFS & DTFT

EEL3135: Homework #4

Universiti Malaysia Perlis EKT430: DIGITAL SIGNAL PROCESSING LAB ASSIGNMENT 5: DIGITAL FILTER STRUCTURES

PROBLEM SET 3. Note: This problem set is a little shorter than usual because we have not covered inverse z-transforms yet.

The Impulse Signal. A signal I(k), which is defined as zero everywhere except at a single point, where its value is equal to 1

Chapter Intended Learning Outcomes: (i) Understanding the relationship between transform and the Fourier transform for discrete-time signals

Like bilateral Laplace transforms, ROC must be used to determine a unique inverse z-transform.

(i) Represent discrete-time signals using transform. (ii) Understand the relationship between transform and discrete-time Fourier transform

INFINITE-IMPULSE RESPONSE DIGITAL FILTERS Classical analog filters and their conversion to digital filters 4. THE BUTTERWORTH ANALOG FILTER

(i) Understanding the characteristics and properties of DTFT

Z-Transform. 清大電機系林嘉文 Original PowerPoint slides prepared by S. K. Mitra 4-1-1

EE123 Digital Signal Processing. M. Lustig, EECS UC Berkeley

Use: Analysis of systems, simple convolution, shorthand for e jw, stability. Motivation easier to write. Or X(z) = Z {x(n)}

Lecture 2 OKAN UNIVERSITY FACULTY OF ENGINEERING AND ARCHITECTURE

# FIR. [ ] = b k. # [ ]x[ n " k] [ ] = h k. x[ n] = Ae j" e j# ˆ n Complex exponential input. [ ]Ae j" e j ˆ. ˆ )Ae j# e j ˆ. y n. y n.

UNIVERSITI MALAYSIA PERLIS

Signals and Systems. Spring Room 324, Geology Palace, ,

Numeric Matlab for Laplace Transforms

ECE503: Digital Signal Processing Lecture 5

EECE 301 Signals & Systems Prof. Mark Fowler

Digital Signal Processing

EE482: Digital Signal Processing Applications

Discrete-time signals and systems

Let H(z) = P(z)/Q(z) be the system function of a rational form. Let us represent both P(z) and Q(z) as polynomials of z (not z -1 )

UNIT-II Z-TRANSFORM. This expression is also called a one sided z-transform. This non causal sequence produces positive powers of z in X (z).

The Z-Transform. Fall 2012, EE123 Digital Signal Processing. Eigen Functions of LTI System. Eigen Functions of LTI System

Solutions: Homework Set # 5

EE 521: Instrumentation and Measurements

EE102B Signal Processing and Linear Systems II. Solutions to Problem Set Nine Spring Quarter

Lecture 7 Discrete Systems

Question Paper Code : AEC11T02

Recursive, Infinite Impulse Response (IIR) Digital Filters:

Digital Signal Processing Lab 3: Discrete Fourier Transform

E : Lecture 1 Introduction

VI. Z Transform and DT System Analysis

Discrete-Time Fourier Transform

Review of Discrete-Time System

DSP-I DSP-I DSP-I DSP-I

Digital Signal Processing:

Signals and Systems Lecture 8: Z Transform

Signals and Systems. Problem Set: The z-transform and DT Fourier Transform

ENT 315 Medical Signal Processing CHAPTER 2 DISCRETE FOURIER TRANSFORM. Dr. Lim Chee Chin

ESE 531: Digital Signal Processing

2. Typical Discrete-Time Systems All-Pass Systems (5.5) 2.2. Minimum-Phase Systems (5.6) 2.3. Generalized Linear-Phase Systems (5.

Module 4 : Laplace and Z Transform Problem Set 4

7.17. Determine the z-transform and ROC for the following time signals: Sketch the ROC, poles, and zeros in the z-plane. X(z) = x[n]z n.

Stability Condition in Terms of the Pole Locations

Need for transformation?

Detailed Solutions to Exercises

Review of Fundamentals of Digital Signal Processing

GATE EE Topic wise Questions SIGNALS & SYSTEMS

Lecture 04: Discrete Frequency Domain Analysis (z-transform)

LECTURE NOTES DIGITAL SIGNAL PROCESSING III B.TECH II SEMESTER (JNTUK R 13)

X (z) = n= 1. Ã! X (z) x [n] X (z) = Z fx [n]g x [n] = Z 1 fx (z)g. r n x [n] ª e jnω

SIGNALS AND SYSTEMS. Unit IV. Analysis of DT signals

Chapter 13 Z Transform

Discrete-Time David Johns and Ken Martin University of Toronto

Responses of Digital Filters Chapter Intended Learning Outcomes:

ESE 531: Digital Signal Processing

y[n] = = h[k]x[n k] h[k]z n k k= 0 h[k]z k ) = H(z)z n h[k]z h (7.1)

Review of Fundamentals of Digital Signal Processing

UNIVERSITY OF OSLO. Please make sure that your copy of the problem set is complete before you attempt to answer anything.

HW13 Solutions. Pr (a) The DTFT of c[n] is. C(e jω ) = 0.5 m e jωm e jω + 1

Signal Processing First Lab 11: PeZ - The z, n, and ˆω Domains

Problem Set 9 Solutions

Z-Transform. The Z-transform is the Discrete-Time counterpart of the Laplace Transform. Laplace : G(s) = g(t)e st dt. Z : G(z) =

ELEN E4810: Digital Signal Processing Topic 4: The Z Transform. 1. The Z Transform. 2. Inverse Z Transform

8. z-domain Analysis of Discrete-Time Signals and Systems

The Discrete-time Fourier Transform

z-transforms Definition of the z-transform Chapter

Z-TRANSFORMS. Solution: Using the definition (5.1.2), we find: for case (b). y(n)= h(n) x(n) Y(z)= H(z)X(z) (convolution) (5.1.

EE 225D LECTURE ON DIGITAL FILTERS. University of California Berkeley

ECE 421 Introduction to Signal Processing

EE-210. Signals and Systems Homework 7 Solutions

Signals and Systems Laboratory with MATLAB

Transform analysis of LTI systems Oppenheim and Schafer, Second edition pp For LTI systems we can write

DSP First Lab 11: PeZ - The z, n, and ωdomains

Transform Analysis of Linear Time-Invariant Systems

How to manipulate Frequencies in Discrete-time Domain? Two Main Approaches

Ch. 7: Z-transform Reading

The Z transform (2) 1

ECE503: Digital Signal Processing Lecture 6

LAB MANUAL. Department of Electrical & Electronics Engineering. University Institute of Engineering and Technology, Panjab University, Chandigarh

Chapter 7: The z-transform

Discrete Time Fourier Transform (DTFT) Digital Signal Processing, 2011 Robi Polikar, Rowan University

QUESTION BANK SIGNALS AND SYSTEMS (4 th SEM ECE)

Nonparametric and Parametric Defined This text distinguishes between systems and the sequences (processes) that result when a WN input is applied

! z-transform. " Tie up loose ends. " Regions of convergence properties. ! Inverse z-transform. " Inspection. " Partial fraction

Transcription:

Digital Signal Processing Lab 4: Transfer Functions in the Z-domain A very important category of LTI systems is described by difference equations of the following type N a y[ nk] b x[ nk] M k k0 k0 k From which, through Z-transform we obtain M k 0 H z N k 0 bz k az k k k 1 M b bz b z 1 N a0 a1z an z 0 1 M and Yz X z where H(z) is the transfer function of the system. In Matlab notation, as indexes must start from 1, if we consider the vectors a and b of the coefficients of the polynomials at numerator and denominator, after posing nb=length(b), na=length(a), we will have a representation of H(z) according to The transfer function H(z) is represented by means of the vectors a and b in several Matlab functions, as described in the following. zplane The function zplane creates a plot of the positions of zeros and poles in the plane of the complex variable z, with the unit circle for reference, starting from the coefficients a and b. Each zero is represented with a 'o' and each pole with a 'x' on the plot. Multiple zeros and poles are indicated by the multiplicity number shown to the upper right of the zero or pole. The function is called as: zplane(b,a) where b and a are row vectors. It uses the function roots to calculate the roots of numerator and denominator of the transfer function. Example-1: Hz b=[2 2 1]; a=[1-0.8]; zplane(b,a);. 1

impz The function impz computes the impulse response of a system starting from the coefficients b and a. [h,t]=impz(b,a) produces the impulse response in vector h and the time axis in vector t. If the output arguments h and t are omitted, a plot of the impulse response is directly displayed. If the impulse response is of infinite length, only its initial part is computed. Example 2: Hz b=1; a=[1-0.9]; [h,t]=impz(b,a); stem(t,h);. (system with a pole in z=0.9) freqz The function freqz is used to compute the frequency response of systems expressed by difference equations or rational transfer functions. [H,w]=freqz(b,a,N); where N is a positive integer, returns the frequency response H and the vector w with the N angular frequencies at which H has been calculated (i.e. N equispaced points on the unit circle, between 0 and π). If N is omitted, a default value of 512 is assumed. If no output argument is specified, the amplitude plot and the phase plot of the frequency response are directly displayed. [H,w]=freqz(b,a,w); where w is a vector of frequencies (in radians, e.g. w=-pi:1/100:pi;) computes the frequency response at the frequencies specified by w. This function can be used to evaluate the DTFT of a sequence x on any desired set of frequencies w, e.g. with the command [X,w]=freqz(x,1,w); See help freqz for a complete reference. Example 3: Hz h[n]= (0.9) n u[n]., i.e. a system with exponentially decaying impulse response b=1; a=[1-0.9]; [H,w]=freqz(b,a); subplot(211) plot(w/pi, 20*log10(abs(H))); % amplitude plot in decibel 2

xlabel('frequency in \pi units'); ylabel('magnitude in db'); title('magnitude Response') subplot(212) plot(w/pi, angle(h)/pi); % phase plot xlabel('frequency in \pi units'); ylabel('phase in radians/\pi'); title('phase Response') Example 4: h[n]=u[n]-u[n-l] L=11; b=ones(1,l); w=-pi:1/100:pi; [H,w]=freqz(b,1,w); subplot(211) plot(w/pi,abs(h)); subplot(212) plot(w/pi, angle(h)/pi); % amplitude plot % phase plot Note that, if L is odd, h[n+(l-1)/2] is a real and symmetric sequence, therefore... subplot(311) plot(w/pi,real(h.*exp(j*w*(l-1)/2))) % it is actually real subplot(312) plot(w/pi,imag(h.*exp(j*w*(l-1)/2))) % should be zero but... subplot(313) plot(w/pi, angle(h.*exp(j*w*(l-1)/2))/pi); % phase plot Example 5: Hz., i.e. a system with truncated exponentially decaying impulse. response h[n]=0.9 n (u[n]-u[n-8]) b=[1 0 0 0 0 0 0 0 -(0.9)^8]; a=[1-0.9]; [H,w]=freqz(b,a); subplot(211) plot(w/pi, 20*log10(abs(H))); % amplitude plot in decibel subplot(212) plot(w/pi, angle(h)/pi); % phase plot Check also: impz(b,a); zplane(b,a); 3

filter The function filter implements the filtering of an input sequence x, starting from a transfer function H(z) expressed as ratio between polynomials in z -1 with coefficients given by vectors b (numerator) and a (denominator). The filter is applied to an input sequence x with the Matlab command y=filter(b,a,x); Example 6:., (corresponding to h[n]= (0.9)n u[n] ) x=[1 zeros(1,100)]; % represents a delta pulse b=1; a=[1-0.9]; y=filter(b,a,x); stem(y); % we get the impulse response tf2zp The command [z,p,k]=tf2zp(b,a) finds zeros, poles and gain of the transfer function associated to coefficients b and a zp2tf The command [b,a]=zp2tf(z,p,k) finds the coefficients b and a of the associated transfer function, given a set of zero locations in vector z, a set of pole locations in vector p, and a gain in scalar k. Example 7: Design a low pass filter using pole-zero placement and then: Convert the pole-zero representation to a rational transfer function representation Make a plot of the desired magnitude and phase response p=[0.5;0.45+0.5i;0.45-0.5i]; % poles z=[-1;i;-i]; % zeros zplane(z,p) % check positions in the plane of z pause k=1; [num, den]=zp2tf(z,p,k); [H,w]=freqz(num,den); subplot(2,1,1) 4

plot(w/pi,abs(h)); title('\midh(e^j^\omega)\mid'); subplot(2,1,2); plot(w/pi,angle(h)); title('arg(h(e^j^\omega))') Example 8: Design of a simple all-pass filter. % Define a simple pair of conjugate poles: z0 = 0.9*exp(j*0.1*pi); z1 = z0'; % poly() gives the polynomial coefficients for these roots a = poly([z0 z1]) %a = 1.0000-1.7119 0.8100 % For an allpass filter, numerator coefficients are simply the reverse b = fliplr(a); zplane(b,a); pause % Look at the response: [H,w]=freqz(b,a); subplot(211) plot(w/pi,abs(h)); title('\midh(e^j^\omega)\mid'); subplot(212); plot(w/pi,angle(h)); title('arg(h(e^j^\omega))') From the properties of the Z-transform we know that the time-domain convolution operation corresponds to a multiplication between the transforms in the Z domain. Example 9: If we have two polynomials X1(z) = 2 + 3z 1 + 4z 2 and X2(z) = 3 + 4z 1 + 5z 2 + 6z 3, their product X3(z) = X1(z)X2(z) can be obtained by means of the convolution of the sequences corresponding to the inverse Z-transforms, i.e. x1={2, 3, 4} and x2={3, 4, 5, 6}: 5

x1 = [2,3,4]; x2 = [3,4,5,6]; x3 = conv(x1,x2) >> x3 = 6 17 34 43 38 24 Hence X3(z) = 6 + 17z 1 + 34z 2 + 43z 3 + 38z 4 + 24z 5 Partial fraction expansion Given a rational transfer function X(z) can be expressed, by means of partial fraction expansion, as X z A MN N k k Ck z 1 k0 k1 1 pz k if M N if all the poles are distinct We can derive such a partial fraction expansion by means of the Matlab function residuez. [A,p,C]=residuez(b,a) computes the constants on the numerator (Ak, known as also residues), poles (pk), and direct terms (Ck) of X(z). The returned column vector A contains the residues, column vector p contains the pole locations, and row vector C contains the polynomials terms when M N. Example 10: Derive analytically and plot the impulse response of the system with transfer function b = [0,1]; a = [3,-4,1]; [A,p,C] = residuez(b,a) A = 0.5000-0.5000 p = 1.0000 0.3333 C = [] 6

which leads to the following partial fraction expansion: The corresponding impulse response is hn 0.5un0.51 3 un n=0:30; h=a(1)*p(1).^n + A(2)*p(2).^n; stem(n,h); % compare with impz(b,a) Example 11: The z-transform of a signal x[n] is given as the partial fraction expansion. X z 2 1 0.64z. Determine 1 2 1 0.2z 0.08z b = [1, 0, -0.64]; a = [1, -0.2, -0.08]; [A,p,C] = residuez(b,a) A = -2-5 p = 0.4-0.2 C = 8 8 2 5 1 0.4 z 1 0.2 z which leads to the following partial fraction expansion: X z 1 1 analytically x[n] considering the possible ROCs. Additional Exercises. Derive Exercise 12. Given a causal system specified by the difference equation yn xn1 1.2xn2 xn3 1.3yn1 1.04yn2 0.222yn 3 plot the frequency response (amplitude and phase) using freqz check zero and pole positions using zplane determine zeros and poles using roots, or using [z,p,k]=tf2zp(b,a) plot the impulse response using impz Exercise 13. Given the difference equation 7

yn 0.4yn10.12yn2xn2xn1 compute: o the corresponding transfer function H(z) o the partial-fraction expansion of H(z), using [r,p,k]=residuez(b,a) o the consequent analytic expression of the impulse response h[n] compare the plot of the computed h[n] with the one produced by means of impz compare also with the sequence y produced by x=[1 zeros(1,n)]; y=filter(b,a,x); Exercise 14. Compute and plot the frequency response of 0.151 z Hz 1 0.5z 0.7z for 0 ω π. What type of filter does it represent? Check what changes if instead we use H z 0.151 z 0.7 0.5z z Make use of freqz, zplane, impz --------------------------------------------------------------------------------------------------------------------- The following script shows an animation based on the geometrical representation of the effect of poles and zeros of a given transfer function into magnitude and phase responses, as a function of the frequency. The number and positions of zeros and poles can be easily changed to investigate different configuration. The parameter of the function pause can be modified to adjust the speed of the animation % Zeros/poles and Transfer Function animation % script adapted from code by prof. Dan Ellis, Columbia University, USA % Define the poles/zeros % Two-pole, two-zero example zz = [0.8*exp(j*pi*0.3) 0.8*exp(j*pi*-0.3)].'; pp = [0.9*exp(j*pi*0.3) 0.9*exp(j*pi*-0.3)].'; ymax = 2; bb = poly(zz); aa = poly(pp); % Steps around the top half of the unit circle ww = [0:200]/200*pi; 8

% Lay out the display subplot(121); zplane(pp,zz); % fixed axes for magnitude plot subplot(222) fax = [0 1 0 ymax]; axis(fax) grid % fixed axes for phase plot (pi-normalized) subplot(224) pax = [0 1-1 1]; axis(pax); grid GG = polyval(bb,exp(j*ww))./polyval(aa,exp(j*ww)); HH = abs(gg); PP = angle(gg); % plot the frames for i = 1:length(ww); w = ww(i); z = exp(j*w); % Evaluate the z transform at this point Gz = polyval(bb,z)./polyval(aa,z); HH(i) = abs(gz); PP(i) = angle(gz); % Make the plots subplot(121) zplane([0],[]); hold on plot(real(z),imag(z),'sg'); 9

% Add omega parameters for www = -0.8:0.2:0.8 ejw = exp(j*www*pi); ll = sprintf('%.1f\\pi',www); text(real(ejw), imag(ejw), ll); end % Plot and connect to all the poles and zeros for r = pp.' plot(real(r),imag(r), 'xr'); plot([real(r), real(z)], [imag(r), imag(z)], '-r'); end for r = zz.' plot(real(r),imag(r), 'ob'); plot([real(r), real(z)], [imag(r), imag(z)], '-g'); end hold off subplot(222) plot(ww/pi, HH, w/pi, HH(i), 'sg',[w/pi w/pi], [0 HH(i)], '-g'); axis(fax) grid title('magnitude'); subplot(224) plot(ww/pi, PP/pi, w/pi, PP(i)/pi, 'sg'); axis(pax) grid title('phase'); xlabel('\omega / \pi'); set(gca, 'YTick', [-1-0.5 0 0.5 1]) set(gca, 'YTickLabel', [' -pi ';'-pi/2';' 0 ';' pi/2'; ' pi ']) pause(0.1); % adjust the speed end 10