You are on page 1of 4

ECSE304 Signals and Systems 2 Semester 20 McGill University Department of Electrical and Computer Engineering

Matlab Assignment 2 22, 20 at 11:59 pm

Distributed: Due:

1, 20

Assignments can be worked in Groups of 2. A cover sheet, which is found at the bottom of the Assignments page in the ECSE304 webCT site, should be handed in with each assignment.

MATLAB Exercises
In all MATLAB Exercises, you are to show all your work and hand in both your MATLAB code and the plots that you generate.

Computation of Frequency Response Curves:


The MATLAB command freqz can be used to compute the frequency response function H (e j ) for any desired set of values of the frequency variable . Once H (e j ) is determined, the magnitude and phase plots can be computed and plotted using matalb functions abs and angle. Poles and zeros can be computed by using several MATLAB functions including zplane, tf2zpk, and roots. Suppose you are given a transfer function in the form. H ( z) = B( z ) bM z M + bM 1 z M 1 + + b1 z + b0 = A( z ) aN z N + aN 1 z N 1 + + a1 z + a0

To use the command freqz, the transfer function H(z) must have M N and be defined in terms of the polynomials in z-1. can be put into the proper form by multiplying by z-N / z-N, yielding d + d N 1 z 1 + + d1 z N +1 + d 0 z N H ( z) = N aN + aN 1 z 1 + + a1 z N +1 + a0 z N Note that if M = N, the coefficients di in the numerator of H(z) are equal to bi in the above equation. Otherwise, if M < N, then di = bi for i = 0,1,2, ,M and di = 0 for i < M . The MATLAB commands that will generate the frequency response curves are num = [dN dN-1 d0]; a0]; den = [aN aN-1 omega = -pi:pi/150:pi;

H = freqz(num,den,omega); Mag = abs(H); Phase = 180/pi*unwrap(angle(H)); Note that the use of the command unwrap is to smooth out the phase plot since the angle command may result in jumps of 2.

Problem 1: Consider the discrete-time system with transfer function: H ( z) = 5 z 2 15 z z3 4z2 2z + 1

a) Rewrite H(z) into the proper form and plot the magnitude and phase of the frequency response over the range using freqz. b) Define the variable z = ej in MATLAB and compute H(ej) by evaluating the expression for H(z) directly. Plot the magnitude and phase over the range . c) What type of system is this: lowpass, highpass, bandpass, or bandstop? Explain your answer.

Problem 2: Consider an LTI system described by the difference equation

y ( n) = x ( n) +

1 1 x(n 1) x(n 2) y ( n 1) 2 y ( n 2) 6 6

a) Use at least 2 MATLAB functions to obtain the poles and zeros for this system. Draw the plot of the poles and zeros. b) Is the system stable? Explain your answer. c) You are given an input signal, x(n) = cos ( n ) , to the system defined by the above

difference equation. Obtain the output signal, y(n), by first finding the z-Transform of the output, Y ( z ) , and then obtaining the inverse z-Transform. Use the MATLAB residue function to perform the inverse z-Transform.

1 ECSE304 Signals and Systems 2 Fall Semester 2011 McGill University Department of Electrical and Computer Engineering

Problem Set 2

Distributed: Thursday, September 22, 2011 Due: Friday, October 1, 2011

Regular Problems
Problem 1: Discrete Time Fourier Transform: The input to a discrete time system is given by 3 x[n] = cos n + sin n 8 4 a) Find the DTFT of x[n] . Sketch the magnitude and phase spectrum. b) Find the output of the system, y[n] , if the impulse response is given by h[n] = (1) n

sin ( n / 2 )

Problem 2: z-transforms: Determine the z-transform and the associated region of convergence (ROC) for the following signals. Sketch the ROC, poles, and zeros in the zplane. a) x[n] = [n k ], k > 0

2 b) x[n] = 3

Problem 3: Properties of z-transforms: Given the z-transform pair x[n]

z2 , with z 2 16 ROC z < 4 , use the z-transform properties to determine the z-transform of the following
Z

signals: 1 a) y[n] = x[ n] 2
n

Problem Set 2

2
b) y[n] = x[ n] x[n] (* indicates the convolution operator) Problem 4: Determine the transfer function and the difference equation representations of the systems with following impulse response

1 1 h[n] = u[n] + 3 2
n

n2

u[n 1]

Problem 5: Inverse z-transforms: Find the inverse z-transforms of the following signals: a) Find the inverse z-transform, x[n] , of the following function using the method of partial fraction expansion: 7 1 + z 1 1 6 X ( z) = , z< 3 1 1 1 1 1 z 1 + z 2 3 b) Find the inverse z-transform, x[n] , of the following function using the method of long division assuming that x[n] is right sided: 1 1 z 1 2 X ( z) = 1 1 1+ z 2

Problem Set 2

You might also like