You are on page 1of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

EE 3054: Signals, Systems, and Transforms


Spring 2007

Meeting time Monday 4:00 - 5:50 Wednesday 3:00 - 4:50 Friday 12:00 - 2:00 (lab) Outline 1. Discrete-time signals and systems 2. Linear time-invariant systems 3. Discrete-time convolution 4. The Z transform 5. The Discrete-Time Fourier transform 6. Continuous-time signals and systems 7. Continuous-time convolution 8. The Laplace transform 9. Fourier analysis for continuous-time signals 10. The Sampling theorem

Texts 1. Signal Processing First, by J. H. McClellan, R. W. Schafer, and M. A. Yoder. Publisher: Pearson - Prentice Hall 2. A course packet is available on web contains exercises, the labs, additional notes and examples. 3. Secondary suggested text: Signals and Systems by Oppenheim and Willsky. Publisher: Prentice Hall 4. Optional supplement: The Schaums outline of Signals and Systems by Hwei Hsu, McGraw-Hill, 1995. ISBN: 0-07-030641-9. Prerequisites EE 2024: Fundamentals of Electric Circuits II MA 2012: Elements of Linear Algebra I MA 2132: Ordinary Dierential Equations Homework HWs must be turned in at the beginning of class on the due date. Solutions will be provided therefore late HWs can not be accepted.

Page 1 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab Lab will meet every week. The lab will consist of computer-based exercises using MATLAB. You must bring your laptop to the lab, with MATLAB installed on your computer. Lab reports must be turned in the following week at the beginning of the lab hour. Students may work together on the labs, however, each student must write up their lab report on their own. Part of the grade for the lab component will be based on your progress during the lab session. In addition, two lab quizzes will be given. The rst lab quiz will cover elementary MATLAB commands. The second lab quiz will cover concepts from lectures and labs together with MATLAB usage. The labs and additional informat is on the web at: http://taco.poly.edu/selesi/EE3054/lab/ Software MATLAB is a required software package for this course. Students registered for this course can have MATLAB installed on their laptop computer by the laptop oce sta. Otherwise, the student version of MATLAB is available online at www.mathworks.com or at the bookstore (about 110$). You will also need the Signal Processing Toolbox (an extra 30$). MATLAB manuals are available in PDF format at www.mathworks.com. For example, the guide Getting started with MATLAB is available at the following URL. http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/getstart.pdf Other documentation for MATLAB is available at the following URL. http://www.mathworks.com/access/helpdesk/help/helpdesk.html Grading The following grading scheme (subject to 1-2% changes) will be used to weight the course work for computint the total course weighted average. Homework 5% Quizzes 10% Test 1 20% Test 2 20% Final 25% 2 Lab quizzes 5% each Lab reports 5% Lab activity 5% In the event academic dishonesty occurs during a quiz or exam, a score of zero may be given. Web http://taco.poly.edu/selesi/EE3054/ http://taco.poly.edu/selesi/EE3054/lab/ Etc Please refrain from using your laptop during lecture. It is distracting for the other students in the class. Instructor Prof. Ivan Selesnick selesi@poly.edu (718) 260-3416 LC 207 http://taco.poly.edu/selesi/ Oce Hours: Wednesday 12:30-2:30 PM

Page 2 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

EE 3054: Signals, Systems, and Transforms Lab Manual

1. The lab will meet every week. 2. Be sure to review the lab ahead of the lab session. Please ask questions of the TAs if you need some help, but also, please prepare in advance for the labs by reading the lab closely. 3. Your activity, participation, and progress during the lab session will be part of your lab grade. (Dont browse the web during lab!) 4. The lab consists of computer-based exercises. You are required to bring your laptop computer to lab with MATLAB installed. In case you do not have MATLAB installed on your laptop computer you can go to the laptop help desk to have it installed. You will need the Signal Processing Toolbox. 5. Labs and the data les required for some labs will be available on the web at: http://taco.poly.edu/selesi/EE3054/lab/ 6. A lab report for each lab (except for Lab 1) will be due the following week in lab. Your lab report should include relevant code fragments, gures, answers to discussion questions in the lab, and explanations. No report is required for Lab 1. 7. There will be at least two paper/pencil quizzes related to the lab during the semester. The rst lab quiz will be early in the semester and will focus on MATLAB usage only. The second lab quiz will be later in the semester and will cover concepts from the labs and lecture and MATLAB programming. At the end of this lab manual, there is an example quiz 1. You should be able to answer all the questions on this example quiz before taking the rst MATLAB quiz. 8. The earlier in the semester you become comfortable with MATLAB the better. The rst lab introduces you to MATLAB. You must go through the tutorial Getting Started with MATLAB. Be sure to download this tutorial to your computer as soon as possible. This tutorial can be downloaded for free from the Mathworks website: http://www.mathworks.com/access/helpdesk/help/pdf doc/matlab/getstart.pdf Other documentation can be obtained at: 1

Page 3 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

http://www.mathworks.com/access/helpdesk/help/helpdesk.shtml For convenience, the MATLAB tutorial is also available at: http://taco.poly.edu/selesi/EE3054/lab/ 9. There is a MATLAB book in the book store which will help you learn MATLAB. 10. In preparation for some of the labs you should read the additional lab notes. These additional notes for the lab are contained in the pdf le: AddLabNotes.pdf available on the lab web site.

Prepared by Ivan Selesnick, 2004. 2

Page 4 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

EE 3054: Signals, Systems, and Transforms Course Outline 1. Discrete-time signals and systems

Polytechnic University

(a) discrete-time step function and impulse function. (b) signal translation and time reversal. (c) classication of systems: linear/nonlinear, etc. (d) Matlab stem command. 2. Linear time-invariant systems (a) impulse response. (b) examples. (c) derivation of discrete-time convolution. 3. Discrete-time convolution (a) convolution as polynomial multiplication and the Z-transform of nite length signals. (b) convolution theorem for the Z-transform. (c) properties of convolution: commut, assoc, distrib. (d) system interconnections: parallel, cascade. (e) convolution with impulses (conv identity, shifting property). (f) applications: ltering noise from a signal; equalization (system inverses). (g) stability condition. (h) Matlab conv command. 4. More on the Z-transform (a) convolution of (causal) exponential signals. (b) Z-transforms of exponentials. (c) region of convergence. (d) transfer functions. (e) partial fraction expansion. (f) deriving the impulse response from the transfer function. (g) Matlab residue command. 5. Dierence equations (a) examples. (b) deriving the transfer function from the dierence equation. (c) deriving the impulse response from the dierence equation. (d) Matlab filter command. 1

Page 5 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

6. Inverse systems (a) example: inverse is unstable. (b) Z-transform of noncausal exponentials. (c) stable (noncausal) inverse systems. 7. Frequency response of discrete-time systems. (a) derivation of frequency response from impulse response using convolutional sum. (b) examples. (c) deriving the frequency response from the transfer function. (d) lter types: lowpass, highpass, etc. (e) block diagrams for FIR (MA), All-pole (AR), IIR (ARMA) systems. (f) Matlab freqz command. 8. Emphasize the conversion between system representations: impulse response, transfer function, dierence equation, frequency response. 9. Discrete-time Fourier transform (a) inverse formula. (b) impulse response of ideal lowpass (sinc). Midterm 1 10. Continuous-time signals and systems (a) continuous-time step function and impulse function. (b) properties of the impulse function. (c) classication of systems, briey (same as for discrete-time). 11. Continuous-time convolution (a) derivation of continuous-time convolution from discrete-time convolution using approximations and limits. (b) examples. 12. The Laplace transform (a) convolution theorem for Laplace transform (compare with Z-transform). (b) transfer functions. (c) examples. (d) deriving the impulse response from the transfer function. (e) poles and zeros (f) stability conditions. 13. Dierential equations (a) solving dierential equations using Laplace transforms. 2

Page 6 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(b) deriving the transfer function from the dierential equation 14. Frequency response of continuous-time signal (a) deriving the frequency response from the impulse response. (b) deriving the frequency response from the transfer function. (c) magnitude and phase plots. (d) examples. 15. Fourier analysis for continuous-time signals (a) Fourier transform (b) examples. (c) eect of an LTI system on the spectrum of the input signal. (d) Fourier transform properties. (e) inverse Fourier transform. (f) impulse response of an ideal lowpass (sinc). 16. Qualitative behavior of LTI systems (a) pole positions and transients. Midterm 2 17. Fourier series (a) examples. (b) the line spectrum. (c) eect of an LTI system on a periodic input signal. (d) deriving the Fourier transform from the Fourier series. (e) Fourier transform of an impulse train. 18. The sampling theorem (a) modeling sampling as multiplication by impulse train. (b) derivation of sampling theorem using Fourier transform of an impulse train. Final

Ivan Selesnick selesi@poly.edu

Page 7 of 169

formulas for discrete-time LTI signals and systems name area under impulse multiplication by impulse . . . by shifted impulse convolution . . . with an impulse . . . with a shifted impulse transfer function formula X
n

useful formulas name Eulers formula . . . for cosine . . . for sine Sinc function formula ej = cos() + j sin() cos() = sin() = ej + ej 2 ej ej 2j sin( )

(n) = 1

f (n) (n) = f (0) (n) f (n) (n no ) = f (no ) (n no ) f (n) g(n) = X


k

f (k) g(n k) sinc() :=

f (n) (n) = f (n) f (n) (n no ) = f (n no ) H(z) =


f

X
n

h(n) z n
jn

Z-transform transform pairs x(n) X(z) X


n

ROC (def.) all z |z| > 1 |z| > |a| |z| < |a| |z| > 1 |z| > 1

frequency response . . . their connection

H () =
f

h(n) e
j

x(n) H () = H(e ) provided unit circle ROC (n) u(n) formulas for continuous-time LTI signals and systems name area under impulse multiplication by impulse . . . by shifted impulse convolution . . . with an impulse . . . with a shifted impulse transfer function frequency response . . . their connection formula Z (t) dt = 1 cos(o n) u(n) f (t) (t) = f (0) (t) f (t) (t to ) = f (to ) (t to ) Z f (t) g(t) = f ( ) g(t ) d f (t) (t) = f (t) f (t) (t to ) = f (t to ) Z H(s) = h(t) est dt sin(o n) u(n) an cos(o n) u(n) an sin(o n) u(n) an u(n) an u(n 1)

x(n) z n

1 z z1 z za z za z2 z 2 cos(o ) z 2 cos(o ) z + 1

sin(o ) z z 2 2 cos(o ) z + 1 z 2 a cos(o ) z z 2 2 a cos(o ) z + a2 a sin(o ) z z 2 2 a cos(o ) z + a2

|z| > |a| |z| > |a|

Z-transform transform properties H () =


f f

h(t) e

jt

dt

x(n) a x(n) + b g(n) x(n no ) x(n) f (n)

X(z) a X(z) + b G(z) z no X(z) X(z) F (z)

H () = H(j) provided j-axis ROC

Page 8 of 169

selected laplace transform pairs x(t) x(t) (t) u(t) ea t u(t) cos(o t) u(t) sin(o t) u(t) ea t cos(o t) u(t) ea t sin(o t) u(t) 1 1 s 1 s+a s 2 s2 + o o 2 s2 + o s+a 2 (s + a)2 + o o 2 (s + a)2 + o X(s) Z x(t) est dt (def.) all s Re(s) > 0 Re(s) > a Re(s) > 0 Re(s) > 0 Re(s) > a ROC

selected Fourier transform pairs x(t) x(t) 1 2 (t) 1 u(t) ejo t cos(o t) sin(o t) Re(s) > a o o sinc t Z X f () ejt d X f () Z x(t) ejt dt (def.)

X f () 1 2 () () + 1 j

2 ( o ) ( + o ) + ( o ) j ( + o ) j ( o ) ideal LPF cut-o frequency o 2 sin T 2

Note: a is assumed real. symmetric pulse width T , height 1 Laplace transform properties x(t) a x(t) + b g(t) x(t) g(t) dx(t) dt x(t to ) X(s) a X(s) + b G(s) X(s) G(s) s X(s) es to X(s) impulse train period T , height 1

impulse train period, height o = 2 T

Fourier transform properties x(t) a x(t) + b g(t) x(a t) x(t) g(t) x(t) g(t) x(t to ) x(t) ejo t x(t) cos(o t) X f () a X f () + b Gf () 1 X |a| a X f () Gf () 1 X f () Gf () 2 ejto X() X( o ) 0.5 X( + o ) + 0.5 X( o ) j 0.5 X( + o ) j 0.5 X( o ) j X f ()

Fourier series If x(t) is periodic with period T then X x(t) = c(k) ej k o t where 2 o = T and c(k) = 1 T Z
T

x(t) ejko t dt

x(t) sin(o t) dx(t) dt

Page 9 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

EE 3054: Signals, Systems, and Transforms Selected Review Topics Signals Time transformations, e.g.: x(t3), x(3t). Know how to sketch them! The complex exponential function eat how does it behave for dierent (complex) values of a? What does the real and imaginary parts of a indicate? Step function u(t). Impulse (delta) function (t). Expressions for periodic functions
n=

x(t nT )
n=

Be able to draw functions with u(t), (t), eat , periodic functions, and combinations. Note that eat = eat u(t). Be able to dierentiate and integrate basic signals. u (t) = (t)
t

() d = u(t)

Know the basic properties of the delta function and step functions. f (t) (t) = f (0) (t) f (t) (t ) = f ( ) (t )

f (t) (t) dt = f (0)


f (t) (t t0 ) dt = f (t0 )

Understand why these properties are true, and how to use them. Understand the same concepts in the discrete-time domain. u[n], [n], etc. Systems Know the meaning of stable, time-invariant, causal, stable, memoryless. Be able to determine if a given system has these properties. LTI Systems The impulse response h(t) is dened as the response of a system to an impulse input (t). (t) LTI system h(t)

The impulse response completely characterizes an LTI system. 4

Page 10 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Description of Linear Time-invariant (LTI) systems by convolution.

y(t) =

x( ) h(t ) d h( ) x(t ) d

= x(t) h(t) Understand how the convolution integral is derived, and that the derivation depends on both linearity and time-invariance. Know how to calculate the convolution of two functions, for simple functions. Convolution by (t) is especially simple: g(t) (t ) = g(t ) Why? Some properties of the convolution integral f (t) g(t) = g(t) f (t) f (t) [g(t) + h(t)] = h(t) g(t) + f (t) h(t) f (t) [g(t) h(t)] = [h(t) g(t)] h(t) Understand why a system described by a linear dierential equation with constant coecients is a linear time-invariant system. LTI Systems and Transfer Functions Understand what the transfer function H(s) means, and how to nd it from h(t). est LTI system H(s) est

H(s) =

h(t)est dt

Why? Know the transfer function H(s) corresponding to simple h(t). h(t) = c ea t u(t) h(t) = c ea t u(t) c sa c H(s) = sa H(s) = ROC: Real(s) > Real(a) ROC: Real(s) < Real(a)

ea t u(t) is causal, while ea t u(t) is noncausal. They give the same form of H(s), but they have dierent Regions of Convergence (ROC). H(s) together with its ROC determines h(t). If c eat u(t) is the impulse response of an LTI system, the system is stable i Real(a) < 0. Why? If c eat u(t) is the impulse response of an LTI system, the system is stable i Real(a) > 0. Why? 5

Page 11 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Understand the three basic representations of an LTI system: impulse response h(t), transfer function H(s), and dierential equation (DE) (if applicable). Be able to convert from one representation to another: Given h(t), what is H(s), what is the DE? Given H(s), what is h(t), what is the DE? Given the DE, what is H(s), what is h(t)? Know that h(t) is not uniquely determined by the DE unless additional information is given, for example the ROC of H(s), or unless it is known that h(t) is causal, or stable. Know how to use partial fraction expansion. For distinct real roots it is particularly simple, but it also works for complex roots and repeated roots, (and for repeated complex roots). Given H(s) for a causal LTI system, be able to determine if the system is stable/unstable. Given the DE for two LTI systems, T1 and T2 , let T be the cascade of T1 and T2 . T := T1 T2 How do you nd the DE for the cascade of T1 and T2 ? Suppose T is the sum of T1 and T2 . That is, T [x] = T1 [x] + T2 [x]. Given the DE for T1 and T2 , how do you nd the DE for T ? If you are given h1 (t) and h2 (t), how would you nd h(t) for (a) the cascade of h1 and h2 ? How do you nd the step response from the impulse response; and viceversa? Discrete-time LTI Systems Understand the discrete-time versions of the same concepts. Finite discrete-time convolution is polynomial multiplication! Transforms: Laplace Transform: Using the Laplace transform to describe LTI systems. Using the convolution property of the Laplace transform. Interpretation of poles and zeros of transfer functions. Fourier Series: Complex and real forms. Dependence on the rate of convergence on the dierentiability of x(t). Fourier Transform: Relationship between the Fourier transform and the Laplace transform. Special Fourier transform pairs - Sinc function and Rectangular pulse; Fourier transform and Fourier series of an impulse train. Properties of the Fourier transform. Signals for which the Laplace Transform doesnt exist but for which the Fourier transform does.

Page 12 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Frequency Response: The relation between the frequency responses, signal spectrums, and Fourier transforms. The Sampling Theorem: How the sampling theorem is derived using the Fourier Transform. Aliasing. Lowpass lters for sampling. The Modulation Concept: How the Fourier Transform explains modulation. Selected transforms: 1. Z-transform 2. Discrete-time Fourier Transform 3. Laplace Transform 4. Fourier Transform 5. Fourier series

Page 13 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

EE 3054: Signals, Systems, and Transforms

Polytechnic University

Objectives 1. To learn the basic theory of signals and systems (discrete-time and continuoustime). See Core technical skills. 2. To learn how to use computer tools to simplify computational procedures (convolution, partial fraction expansion), to perform discrete-time ltering (noise removal, inverse lters), and to verify the correctness of pencil/paper solutions. 3. To understand how the techniques are used in some applications (eg: sampling, modulation, noise removal).

Core Technical Skills 1. Know how to compute the convolution of two signals (discrete-time and continuous-time). 2. Know how to convert from one LTI system representation to other representations [impulse response, frequency response, transfer function, differential (dierence) equation]. 3. Know how to use the denition of transforms, properties of transforms, and basic transform pairs, to solve basic LTI system problems (eg: nd the system output, design an inverse system). 4. Know how to use the sampling theorem and modulation properties to analyze systems involving sampling and modulation. 5. Know how to use Matlab to plot signals, to perform basic analysis of systems, and to perform discrete-time ltering.

Page 14 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

EE 3054: Signals, Systems and Transforms Exercises


Ivan W. Selesnick September 5, 2006

Contents
1 Discrete-Time Signals and Systems 1.1 Basic Problems . . . . . . . . . . . 1.2 More Convolution . . . . . . . . . 1.3 Z Transforms . . . . . . . . . . . . 1.4 Dierence Equations . . . . . . . . 1.5 Frequency Responses . . . . . . . . 1.6 Inverse Systems . . . . . . . . . . . 1.7 Summary Problems . . . . . . . . . 1.8 Matching . . . . . . . . . . . . . . 1.9 More Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 7 8 11 13 14 15 17 55 58 58 62 64 65 68 70 74 88 89 90 96

2 Continuous-Time Signals and Systems 2.1 Basic Problems . . . . . . . . . . . . . 2.2 Convolution . . . . . . . . . . . . . . . 2.3 Laplace Transform . . . . . . . . . . . 2.4 Dierential Equations . . . . . . . . . 2.5 Frequency Response . . . . . . . . . . 2.6 Fourier Transform . . . . . . . . . . . 2.7 Matching . . . . . . . . . . . . . . . . 2.8 Fourier Series . . . . . . . . . . . . . . 2.9 Modulation . . . . . . . . . . . . . . . 2.10 Summary . . . . . . . . . . . . . . . . 3 The Sampling Theorem

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

Page 15 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1
1.1

Discrete-Time Signals and Systems


Basic Problems
(a) x(n) = u(n + 3) + 0.5 u(n 1) (b) x(n) = (n + 3) + 0.5 (n 1) (c) x(n) = 2n (n 4) (d) x(n) = 2n u(n 2) (e) x(n) = (1)n u(n 4). (f) x(n) = 2 (n + 4) (n 2) + u(n 3) (g)

1.1.1 Make an accurate sketch of each of the discrete-time signals

x(n) =
k=0

4 (n 3 k 1)

(h)

x(n) =

(1)k (n 3 k)
k=

1.1.2 Sketch x(n), x1 (n), x2 (n), and x3 (n) where x(n) = u(n + 4) u(n), x2 (n) = x(5 n), x1 (n) = x(n 3),
n

x3 (n) =
k=

x(k)

1.1.3 Sketch x(n) and x1 (n) where


n

x(n) = (0.5)n u(n),

x1 (n) =
k=

x(k)

Page 16 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.1.4 Sketch x(n) and x1 (n) where


n

x(n) = n [(n 5) + (n 3)],

x1 (n) =
k=

x(k)

1.1.5 A discrete-time system may be classied as follows: memoryless/with memory causal/noncausal linear/nonlinear time-invariant/time-varying BIBO stable/unstable Classify each of the following discrete-times systems. (a) y(n) = cos(x(n)). (b) y(n) = 2 n2 x(n) + n x(n + 1). (c) y(n) = max {x(n), x(n + 1)} (d) y(n) = (e) y(n) = x(n) + 2 x(n 1) 3 x(n 2). (f)

x(n) when n is even x(n 1) when n is odd

y(n) =
k=0

(1/2)k x(n k).

That is, y(n) = x(n) + (1/2) x(n 1) + (1/4) x(n 2) + (g) y(n) = x(2 n) 1.1.6 The impulse response of a discrete-time LTI system is given by h(n) = 1 if n is a positive prime number 0 otherwise 3

Page 17 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(a) Is the system causal? (b) Is the system BIBO stable? 1.1.7 You observe an unknown system (not necessarily LTI) and notice that

u(n) u(n 5)

E (0.4)n u(n)

and that

u(n) u(n 10)

E (0.2)n u(n)

Which conclusion can you make? (a) The system is LTI. (b) The system is not LTI. (c) There is not enough information to decide. 1.1.8 You observe an unknown system (not necessarily LTI) and notice that

n2 u(n)

E (0.5)n u(n)

To each of the following questions, answer yes, no, or it can not be determined. (a) Is the system stable? (b) Is the system causal? (c) Is the system time-invariant? 1.1.9 You observe an unknown LTI system and notice that

u(n) u(n 2)

(n 1)

1 4

(n 4)

Sketch the step response s(n). The step response is the system output when the input is the step function u(n). 1.1.10 The impulse response of a discrete-time LTI system is h(n) = 2 (n) + 3 (n 1) + (n 2). Find and sketch the output of this system when the input is the signal x(n) = (n) + 3 (n 1) + 2 (n 2). 4

Page 18 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.1.11 Consider a discrete-time LTI system described by the rule y(n) = x(n 5) + 1 x(n 7). 2

What is the impulse response h(n) of this system? 1.1.12 The impulse response of a discrete-time LTI system is h(n) = (n) + 2 (n 1) + (n 2). Sketch the output of this system when the input is

x(n) =
k=0

(n 4 k).

1.1.13 The impulse response of a discrete-time LTI system is h(n) = 2 (n) (n 4). Find and sketch the output of this system when the input is the step function x(n) = u(n). 1.1.14 Consider the discrete-time LTI system with impulse response h(n) = n u(n). (a) Find and sketch the output y(n) when the input x(n) is x(n) = (n) 2 (n 5) + (n 10). (b) Classify the system as BIBO stable/unstable. 1.1.15 The impulse response h(n) of an LTI system is given by h(n) = 2 3
n

u(n).

Find and sketch the output y(n) when the input is given by (a) x(n) = (n) (b) x(n) = (n 2) 1.1.16 Consider the LTI system with impulse response h(n) = (n) 1 (n 2). 4

(a) Find and sketch the output y(n) when the input x(n) is x(n) = 2n u(n). (b) Classify the system as BIBO stable/unstable.

Page 19 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.1.17 For an LTI system it is known that input signal x(n) = (n) + 3 (n 1) produces the following output signal: y(n) = 1 2
n

u(n).

What is the output signal when the following input signal is applied to the system? x2 (n) = 2 (n 2) + 6 (n 3) 1.1.18 Consider the LTI system with impulse response h(n) = (n 1). (a) Find and sketch the output y(n) when the input x(n) is the impulse train with period 6,

x(n) =
k=

(n 6k).

(b) Classify the system as BIBO stable/unstable. 1.1.19 An LTI system is described by the following equation

y(n) =
k=0

1 3

x(n k).

Sketch the impulse response h(n) of this system. 1.1.20 Consider the parallel combination of two LTI systems.

E x(n) E

h1 (n) c l + E T y(n)

h2 (n)

You are told that h1 (n) = u(n) 2 u(n 1) + u(n 2). You observe that the step response of the total system is s(n) = 2 r(n) 3 r(n 1) + r(n 2) where r(n) = n u(n). Find and sketch h2 (n).

Page 20 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.2

More Convolution
(a) f (n) = 2 (n + 10) + 2 (n 10) g(n) = 3 (n + 5) + 3 (n 5) (b) f (n) = (n 4) (n 1) g(n) = 2 (n 4) (n 1) (c) f (n) = (n + 2) (n + 1) (n) g(n) = (n) + (n + 1) + (n + 2) (d) f (n) = 4 g(n) = (n) + 2 (n 1) + (n 2). (e) f (n) = (n) + (n 1) + 2 (n 2) g(n) = (n 2) (n 3). (f) f (n) = (1)n g(n) = (n) + (n 1).

1.2.1 Derive and sketch the convolution x(n) = f (n) g(n) where

1.2.2 The impulse response of a discrete-time LTI system is h(n) = u(n) u(n 5). Sketch the output of this system when the input is

x(n) =
k=0

(n 5 k).

1.2.3 The N -point moving average lter has the impulse response h(n) = 1/N 0 0nN 1 otherwise

Use the Matlab conv command to compute y(n) = h(n) h(n) for N = 5, 10, 20, and in each case make a stem plot of h(n) and y(n). What is the general expression for y(n)? 7

Page 21 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.2.4 The convolution of two nite length signals can be written as a matrix vector product. Look at the documentation for the Matlab convmtx command and the following Matlab code that shows the convolution of two signals by (1) a matrix vector product and (2) the conv command. Describe the form of the convolution matrix and why it works. >> x = [1 4 2 5]; h = [1 3 -1 2]; >> convmtx(h,4)*x ans = 1 7 13 9 21 -1 10 >> conv(h,x) ans = 1 7 13 9 21 -1 10

1.3

Z Transforms
X(z) = 3 z 2 + 2 z 3 Accurately sketch the signal x(n).

1.3.1 The Z-transform of the discrete-time signal x(n) is

1.3.2 Dene three discrete-time signals: a(n) = u(n) u(n 4) b(n) = (n) + 2 (n 3) c(n) = (n) (n 1) Dene three new Z-transforms: D(z) = A(z), E(z) = A(1/z), F (z) = A(1/z)

(a) Sketch a(n), b(n), c(n) (b) Write the Z-transforms A(z), B(z), C(z) (c) Write the Z-transforms D(z), E(z), F (z) 8

Page 22 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(d) Sketch d(n), e(n), f (n) 1.3.3 Dene the discrete-time signal x(n) as x(n) = 0.3 (n + 2) + 2.0 (n) + 1.5 (n 3) (n 5) (a) Sketch x(n). (b) Write the Z-transform X(z). (c) Dene G(z) = z 2 X(z). Sketch g(n). 1.3.4 Let x(n) be the length-5 signal x(n) = {1, 2, 3, 2, 1} where x(0) is underlined. Sketch the signal corresponding to each of the following Z-transforms. (a) X(2z) (b) X(z 2 ) (c) X(z) + X(z) (d) X(1/z) 1.3.5 Sketch the discrete-time signal x(n) with the Z-transform X(z) = (1 + 2 z) (1 + 3 z 1 ) (1 z 1 ). 1.3.6 Consider the LTI system with impulse response h(n) = 3 2 3
n

u(n)

Find the output y(n) when the input x(n) is x(n) = 1 2


n

u(n).

1.3.7 The transfer function of a discrete-time LTI system is H(z) = 2 + 4 z 1 z 3 . (a) Sketch the impulse response h(n). (b) Find the dierence equation to describe this system. (c) Classify the system as BIBO stable/unstable. 1.3.8 Sketch the step response of the system in the previous problem. (In other words, sketch the output signal when the input signal is the step function u(n).) What is the steady state value of the step response (as n )? 1.3.9 Consider the transfer functions of two discrete-time LTI systems, H1 (z) = 1 + 2z 1 + z 2 , H2 (z) = 1 + z 1 + z 2 . (a) If these two systems are cascaded in series, what is the impulse response of the total system? 9

Page 23 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

x(n)

- H1 (z)

- H2 (z)

y(n)

(b) If these two systems are combined in parallel, what is the impulse response of the total system?

- H1 (z) x(n) - H2 (z) ? j + - y(n) 6

1.3.10 Consider the parallel combination of two LTI systems.

E x(n) E

h1 (n) c l + E T y(n)

h2 (n)

You are told that the impulse responses of the two systems are h1 (n) = 3 and h2 (n) = 2 1 3
n

1 2

u(n)

u(n)

(a) Find the impulse response h(n) of the total system. (b) You want to implement the total system as a cascade of two rst order systems g1 (n) and g2 (n). Find g1 (n) and g2 (n), each with a single pole, such that when they are connected in cascade, they give the same system as h1 (n) and h2 (n) connected in parallel.

x(n)

g1 (n)

g2 (n)

y(n)

1.3.11 Consider the cascade combination of two LTI systems.

x(n)

SYS 1

SYS 2

y(n)

10

Page 24 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

The impulse response of SYS 1 is h1 (n) = (n) + 0.5 (n 1) 0.5 (n 2) and the transfer function of SYS 2 is H2 (z) = z 1 + 2 z 2 + 2 z 3 . (a) Sketch the impulse response of the total system. (b) What is the transfer function of the total system?

1.4

Dierence Equations

1.4.1 A causal discrete-time system is described by the dierence equation, y(n) = x(n) + 3 x(n 1) + 2 x(n 4) (a) What is the transfer function of the system? (b) Sketch the impulse response of the system. 1.4.2 Given the impulse response h(n) of a causal discrete-time LTI system, h(n) = (n) 1 (n 2) 2

(a) For the input x(n) = 3n , what is the output y(n)? (b) For the input x(n) = an , what is the output y(n)? (c) What is the transfer function H(z)? (d) What is the dierence equation describing this system? 1.4.3 Given two discrete-time LTI systems described by the dierence equations 1 y(n 1) = x(n) + 2x(n 1) 3 1 T2 : y(n) + y(n 1) = x(n) 2x(n 1) 3 T1 : y(n) + let T be the cascade of T1 and T2 in series. What is the dierence equation describing T ? Suppose T1 and T2 are causal systems. Is T causal? Is T stable? 1.4.4 Consider the parallel combination of two causal discrete-time LTI systems.

E x(n) E

SYS 2 c l + E T SYS 1 r(n)

11

Page 25 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

You are told that System 1 is described by the dierence equation y(n) 0.1 y(n 1) = x(n) + x(n 2) and that System 2 is described by the dierence equation y(n) 0.1 y(n 1) = x(n) + x(n 1). Find the dierence equation of the total system. 1.4.5 Consider a causal discrete-time LTI system described by the dierence equation y(n) 5 1 2 y(n 1) + y(n 2) = 2 x(n) + x(n 1). 6 6 3

(a) Find the transfer function H(z). (b) Find the impulse response h(n). You may use Matlab to do the partial fraction expansion. See the command residue. Make a stem plot of h(n) with Matlab. (c) Plot the magnitude of the frequency response |H(ej )| of the system. Use the Matlab command freqz. 1.4.6 Consider a causal discrete-time LTI system with the impulse response h(n) = 3 2 3 4
n

u(n) + 2 (n 4)

(a) Make a stem plot of h(n) with Matlab. (b) Find the transfer function H(z). (c) Find the dierence equation that describes this system. (d) Plot the magnitude of the frequency response |H(ej )| of the system. Use the Matlab command freqz. 1.4.7 Consider a stable discrete-time LTI system described by the dierence equation y(n) = x(n) x(n 1) 2 y(n 1). (a) Find the transfer function H(z) and its ROC. (b) Find the impulse response h(n). 1.4.8 A room where echos are present can be modeled as an LTI system that has the following rule:

y(n) =
k=0

2k x(n 10 k)

The output y(n) is made up of delayed versions of the input x(n) of decaying amplitude. (a) Sketch the impulse response h(n). (b) What is transfer function H(z)? (c) Write the corresponding nite-order dierence equation. 1.4.9 Two LTI systems are connected in series:

12

Page 26 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

SYS 1

SYS 2

The system SYS 1 is described by the dierence equation y(n) = x(n) + 2 x(n 1) + x(n 2) where x(n) represents the input into SYS 1 and y(n) represents the output of SYS 1. The system SYS 2 is described by the dierence equation y(n) = x(n) + x(n 1) + x(n 2) where x(n) represents the input into SYS 2 and y(n) represents the output of SYS 2. (a) What dierence equation describes the total system? (b) Sketch the impulse response of the total system.

1.5

Frequency Responses
ej 0 0.4 < < 0.4 0.4 < || < .

1.5.1 The frequency response H f () of a discrete-time LTI system is H f () =

Find the output y(n) when the input x(n) is x(n) = 1.2 cos(0.3 n) + 1.5 cos(0.5 n). Put y(n) in simplest real form (your answer should not contain j). Hint: Use Eulers formula and the relation ejo n LTI SYSTEM H f (o ) ejo n 1.5.2 The frequency response H f () of a discrete-time LTI system is as shown. (H f () is real-valued the phase is 0).

H f ()

1 r r r r r
0

Find the output y(n) when the input x(n) is x(n) = 1 + cos(0.3 n). Put y(n) in simplest real form (your answer should not contain j). 1.5.3 A stable linear time invariant system has the transfer function H(z) = z+2 (z 1/2)(z + 4)

Find the frequency response of this system. Find the output of this system for the input x(n) = cos(0.2 n). 13

Page 27 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.5.4 A causal LTI system is implemented with the dierence equation y(n) = 3 x(n) 2 x(n 1) 0.5 y(n 1) + 0.1 y(n 2). (a) Find the frequency response of this system. Using Matlab, make a plot of |H f ()|. (b) Find the output of this system for the input x(n) = cos(0.2 n). 1.5.5 The mangitude and phase of the frequency response of a discrete-time LTI system are: |H f ()| = H f () = 2 for || < 0.5 1 for 0.5 < || < . 0.3 0.3 for < < 0 for < < 0.

Find the output signal y(n) when the input signal is x(n) = 2 sin(0.2 n) + 3 cos(0.6 n + 0.2 ).

1.6

Inverse Systems

1.6.1 A causal discrete-time LTI system

x(n)

H(z)

E y(n)

is described by the dierence equation y(n) 1 y(n 1) = x(n) 2 x(n 1). 3

What is the impulse response of the stable inverse of this system? 1.6.2 Consider a discrete-time LTI system with the impulse response h(n) = (n + 1) 10 (n) + (n 1). 3

(a) Find the impulse response g(n) of the stable inverse of this system. (b) Use MATLAB to numerically verify the correctness of your answer by computing the convolution of h(n) and the impulse response of the inverse system. You should get (n). Include your program and plots with your solution. 1.6.3 The impulse response of a discrete-time LTI system is h(n) = (n) + 2 1 2
n

u(n).

(a) Find the impulse response of the stable inverse of this system. (b) Use MATLAB to numerically verify the correctness of your answer by computing the convolution of h(n) and the impulse response of the inverse system. You should get (n). Include your program and plots with your solution. 1.6.4 A causal discrete-time LTI system 14

Page 28 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

x(n) has the impulse response

h(n)

y(n)

h(n) = (n) + 3.5 (n 1) + 1.5 (n 2). (a) Give the dierence equation that describes this system. (b) Find the impulse response of the stable inverse of this system. (c) Use MATLAB to numerically verify the correctness of your answer by computing the convolution of h(n) and the impulse response of the inverse system. You should get (n). Include your program and plots with your solution.

1.7

Summary Problems
n

1.7.1 The impulse response h(n) of an LTI system is given by h(n) = 1 2 u(n).

Find and sketch the output y(n) when the input is given by x(n) = u(n) u(n 2). Simplify your mathematical formula for y(n) as far as you can. Show your work. 1.7.2 The impulse response h(n) of an LTI system is given by h(n) = (n) + (n 2). Find and sketch the output y(n) when the input is given by

x(n) =
k=

(1)k (n 2 k).

Simplify your mathematical formula for y(n) as far as you can. Show your work. 1.7.3 The impulse response h(n) of an LTI system is given by h(n) = u(n) u(n 5). (a) What is the transfer function H(z) of this system? (b) What dierence equation implements this system? 1.7.4 A causal LTI system is implemented using the dierence equation y(n) = x(n) + 9 1 y(n 1) y(n 2) 14 14

(a) What is the transfer function H(z) of this system? (b) What is the impulse response h(n) of this system? (c) Use the MATLAB command filter to numerically verify the correctness of your formula for h(n). (Use this command to numerically compute the rst few values of h(n) from the dierence equation, and compare with the formula.) 15

Page 29 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.7.5 The signal g(n) is given by g(n) = 1 2


n

u(n 1)

(a) Sketch g(n). (b) Find the Z-transform G(z) of the signal g(n) and its region of convergence. 1.7.6 The impulse response of a discrete-time LTI system is given by h(n) = 0.25 0 for 0 n 3 for other values of n.

Make an accurate sketch of the output of the system when the input signal is x(n) = 1 for 0 n 30 0 for other values of n.

You should do this problem with out using MATLAB, etc. 1.7.7 Two discrete-time LTI systems have the following impulse responses h1 (n) = 1 2
n

u(n),

h2 (n) =

1 2

u(n)

If the two systems are connected in parallel,

- H1 (z) x(n) - H2 (z) ? j + - y(n) 6

Find and make an accurate sketch of the impulse response of the total system. 1.7.8 If a discrete-time LTI system has the transfer function H(z) = 5, then what dierence equation implements this system? Classify this system as memoryless/with memory. 1.7.9 First order dierence system A discrete-time LTI system is implemented using the dierence equation y(n) = 0.5 x(n) 0.5 x(n 1). (a) What is the transfer function H(z) of the system? (b) What is the impulse response h(n) of the system? (c) What is the frequency response H f () of the system? (d) Accurately sketch the frequency response magnitude |H f ()|. (e) Find the output y(n) when the input signal is the step signal u(n). (f) Sketch the pole-zero diagram of the system. (g) Is the system a low-pass lter, high-pass lter, or neither? 16

Page 30 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.7.10 A causal discrete-time LTI system is implemented with the dierence equation y(n) = 3 x(n) + 3 y(n 1). 2

(a) Find the output signal when the input signal is x(n) = 3 (2)n u(n). Show your work. (b) Is the system stable or unstable? (c) Sketch the pole-zero diagram of this system.

1.8

Matching

1.8.1 The diagrams on the following pages show the impulse responses, frequency responses, and pole-zero diagrams of 4 causal discrete-time LTI systems. But the diagrams are out of order. Match each diagram by lling out the following table. You should do this problem without using MATLAB or any other computational tools. In the pole-zero diagrams, the zeros are shown with o and the poles are shown by x.

IMPULSE RESPONSE

FREQUENCY RESPONSE

POLE-ZERO DIAGRAM

1 2 3 4
IMPULSE RESPONSE 1 2 1 1.5 1 0.5 0 0.5 1 0 10 20 30 40 0 10 20 30 40 0.5 0.5 IMPULSE RESPONSE 2

MatchA

IMPULSE RESPONSE 3 1.2 1 1 0.8 0.6 0.4 0.2 0 0.5 0.5

IMPULSE RESPONSE 4

10

20

30

40

10

20

30

40

17

Page 31 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

FREQUENCY RESPONSE 1 6 5 4 3 2 1 0 1 12 10 8 6 4 2 0 1

FREQUENCY RESPONSE 2

0.5

0 /

0.5

0.5

0 /

0.5

FREQUENCY RESPONSE 3 7 6 5 4 3 2 1 0 1 0.5 0 / 0.5 1 7 6 5 4 3 2 1 0 1

FREQUENCY RESPONSE 4

0.5

0 /

0.5

ZEROPOLE DIAGRAM 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5

ZEROPOLE DIAGRAM 2

0 0.5 1 1 0.5 0 0.5 1

ZEROPOLE DIAGRAM 3 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5

ZEROPOLE DIAGRAM 4

0 0.5 1 1 0.5 0 0.5 1

18

Page 32 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.2 The diagrams on the following pages show the impulse responses, frequency responses, and pole-zero diagrams of 4 causal discrete-time LTI systems. But the diagrams are out of order. Match each diagram by lling out the following table. You should do this problem without using MATLAB or any other computational tools. In the pole-zero diagrams, the zeros are shown with o and the poles are shown by x.

IMPULSE RESPONSE

FREQUENCY RESPONSE

POLE-ZERO DIAGRAM

1 2 3 4

MatchB

IMPULSE RESPONSE 1 1.5 1 0.5 0.5 0 0.5 1 0 10 20 30 40 0 0 1

IMPULSE RESPONSE 2

10

20

30

40

IMPULSE RESPONSE 3 1.2 1 0.8 0.6 0.4 0.2 0 1.2 1 0.8 0.6 0.4 0.2 0

IMPULSE RESPONSE 4

10

20

30

40

10

20

30

40

19

Page 33 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

FREQUENCY RESPONSE 1 4 3 2 1 0 1

FREQUENCY RESPONSE 2

4 3 2 1 0 1

0.5

0 /

0.5

0.5

0 /

0.5

FREQUENCY RESPONSE 3 15 12 10 10 8 6 5 4 2 0 1 0.5 0 / 0.5 1 0 1

FREQUENCY RESPONSE 4

0.5

0 /

0.5

ZEROPOLE DIAGRAM 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5

ZEROPOLE DIAGRAM 2

0 0.5 1 1 0.5

0.5

ZEROPOLE DIAGRAM 3 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 4

0.5

0.5

20

Page 34 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.3 The diagrams on the following pages show the impulse responses and pole-zero diagrams of 8 causal discrete-time LTI systems. But the diagrams are out of order. Match each diagram by lling out the following table. You should do this problem without using MATLAB or any other computational tools. In the pole-zero diagrams, the zeros are shown with o and the poles are shown by x.

IMPULSE RESPONSE

POLE-ZERO DIAGRAM

1 2 3 4 5 6 7 8

SecondOrderMatching/Match1

21

Page 35 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

IMPULSE RESPONSE 1 1.5 15 1 0.5 0 0.5 1 0 10 20 30 40 0 0 5 10

IMPULSE RESPONSE 2

10

20

30

40

IMPULSE RESPONSE 3 1.2 1 0.8 0.6 0.4 0.2 0 1.2 1 0.8 0.6 0.4 0.2 0

IMPULSE RESPONSE 4

10

20

30

40

10

20

30

40

IMPULSE RESPONSE 5 1 1.5 1 0.5 0 0.5 0.5 1 0 10 20 30 40 0

IMPULSE RESPONSE 6

0.5

10

20

30

40

IMPULSE RESPONSE 7 3 2 2 1 0 1 1.5 1 0.5 0

IMPULSE RESPONSE 8

10

20

30

40

10

20

30

40

22

Page 36 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

ZEROPOLE DIAGRAM 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 2

0.5

0.5

ZEROPOLE DIAGRAM 3 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5

ZEROPOLE DIAGRAM 4

0 0.5 1 1 0.5 0 0.5 1

ZEROPOLE DIAGRAM 5 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5

ZEROPOLE DIAGRAM 6

0 0.5 1 1 0.5 0 0.5 1

ZEROPOLE DIAGRAM 7 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 8

0.5

0.5

23

Page 37 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.4 The diagrams on the following pages show the frequency responses magnitudes |H f ()| and pole-zero diagrams of 8 causal discrete-time LTI systems. But the diagrams are out of order. Match each diagram by lling out the following table. You should do this problem without using MATLAB or any other computational tools. In the pole-zero diagrams, the zeros are shown with o and the poles are shown by x.

FREQUENCY RESPONSE

POLE-ZERO DIAGRAM

1 2 3 4 5 6 7 8

SecondOrderMatching/Match2

24

Page 38 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

FREQUENCY RESPONSE 1 2 4

FREQUENCY RESPONSE 2

1.5

0.5

0 1

0.5

0 /

0.5

0 1

0.5

0 /

0.5

FREQUENCY RESPONSE 3 3 2.5 2 6 1.5 4 1 0.5 1 2 0 1 12 10 8

FREQUENCY RESPONSE 4

0.5

0 /

0.5

0.5

0 /

0.5

FREQUENCY RESPONSE 5 4 6 5 3 4 2 3 2 1 1 0 1 0 1

FREQUENCY RESPONSE 6

0.5

0 /

0.5

0.5

0 /

0.5

FREQUENCY RESPONSE 7 1.4 1.2 1 0.8 0.6 0.4 0.2 0 1 0.5 0 / 0.5 1 7 6 5 4 3 2 1 0 1

FREQUENCY RESPONSE 8

0.5

0 /

0.5

25

Page 39 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

ZEROPOLE DIAGRAM 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 2

0.5

0.5

ZEROPOLE DIAGRAM 3 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5

ZEROPOLE DIAGRAM 4

0 0.5 1 1 0.5 0 0.5 1

ZEROPOLE DIAGRAM 5 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5

ZEROPOLE DIAGRAM 6

0 0.5 1 1 0.5 0 0.5 1

ZEROPOLE DIAGRAM 7 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 8

0.5

0.5

26

Page 40 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.5 The following gure shows the frequency response magnitudes |H f ()| of four discrete-time LTI systems (Systems A, B, C, and D). The signal x(n) = 2 cos(0.15 n) u(n 5) + 2 cos(0.24 n) u(n 5) shown below is applied as the input to each of the four systems. The input signal x(n) and each of the four output signals are also shown below. But the output signals are out of order. For each of the four systems, identify which signal is the output signal. Explain your answer. You should do this problem without using MATLAB or any other computational tools.
SYSTEM OUTPUT SIGNAL

A B C D

nputOutput
4

INPUT SIGNAL

10

20

30

40

50 n

60

70

80

90

100

FREQUENCY RESPONSES

1 SYSTEM A SYSTEM B 0.25 0.5 0.75 0.8 0.6 0.4 0.2 0 0

1 0.8 0.6 0.4 0.2 0 0 0.25 0.5 0.75

1.2 1 SYSTEM C SYSTEM D 0.25 0.5 0.75 0.8 0.6 0.4 0.2 0 0

1.2 1 0.8 0.6 0.4 0.2 0 0 0.25 0.5 0.75

27

Page 41 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

OUTPUT SIGNALS 3 2 OUTPUT SIGNAL 1 1 0 1 2 3

10

20

30

40

50 n

60

70

80

90

100

OUTPUT SIGNAL 2

0.5

0.5

10

20

30

40

50 n

60

70

80

90

100

6 4 2 0 2 4

OUTPUT SIGNAL 3

10

20

30

40

50 n

60

70

80

90

100

OUTPUT SIGNAL 4

10

20

30

40

50 n

60

70

80

90

100

28

Page 42 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.6 The diagrams on the following pages show the frequency responses, impulse responses and pole-zero diagrams of 4 causal discrete-time LTI systems. But the diagrams are out of order. Match each diagram by lling out the following table. You should do this problem without using MATLAB or any other computational tools. In the pole-zero diagrams, the zeros are shown with o and the poles are shown by x.

FREQUENCY RESPONSE

POLE-ZERO DIAGRAM

IMPULSE RESPONSE

1 2 3 4

MatchC
FREQUENCY RESPONSE 1 FREQUENCY RESPONSE 2

1 0.8 0.6 0.4 0.2 0 1

1 0.8 0.6 0.4 0.2 0 1

0.5

0 /

0.5

0.5

0 /

0.5

FREQUENCY RESPONSE 3 1.2 1 0.8 0.6 0.4 0.2 0 1 1.2 1 0.8 0.6 0.4 0.2 0 1

FREQUENCY RESPONSE 4

0.5

0 /

0.5

0.5

0 /

0.5

29

Page 43 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

ZEROPOLE DIAGRAM 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 2

0.5

0.5

ZEROPOLE DIAGRAM 3 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 4

0.5

0.5

IMPULSE RESPONSE 1 0.1 0.05 0 0.05 0 0.1 0.1 0.15 0 10 20 30 40 0 0.3 0.2 0.1

IMPULSE RESPONSE 2

10

20

30

40

IMPULSE RESPONSE 3 0.6 0.4 0.1 0.2 0 0.2 0.2 0 10 20 30 40 0.3 0 0 0.1 0.3 0.2

IMPULSE RESPONSE 4

10

20

30

40

30

Page 44 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.7 The diagrams on the following pages show the frequency responses and pole-zero diagrams of 6 causal discrete-time LTI systems. But the diagrams are out of order. Match each diagram by lling out the following table. You should do this problem without using MATLAB or any other computational tools. In the pole-zero diagrams, the zeros are shown with o and the poles are shown by x.

FREQUENCY RESPONSE

POLE-ZERO DIAGRAM

1 2 3 4 5 6

MatchD

31

Page 45 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

FREQUENCY RESPONSE 1

FREQUENCY RESPONSE 2

1 0.8 0.6 0.4 0.2 0 1

1 0.8 0.6 0.4 0.2 0 1

0.5

0 /

0.5

0.5

0 /

0.5

FREQUENCY RESPONSE 3 1.2 1 0.8 0.6 0.4 0.2 0 1 1.2 1 0.8 0.6 0.4 0.2 0 1

FREQUENCY RESPONSE 4

0.5

0 /

0.5

0.5

0 /

0.5

FREQUENCY RESPONSE 5 1.2 1 0.8 0.6 0.4 0.2 0 1 1.2 1 0.8 0.6 0.4 0.2 0 1

FREQUENCY RESPONSE 6

0.5

0 /

0.5

0.5

0 /

0.5

32

Page 46 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

ZEROPOLE DIAGRAM 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 2

0.5

0.5

ZEROPOLE DIAGRAM 3 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 4

0.5

0.5

ZEROPOLE DIAGRAM 5 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 6

0.5

0.5

33

Page 47 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.8 The diagrams on the following pages show the pole-zero diagrams and impulse responses of 8 causal discrete-time LTI systems. But the diagrams are out of order. Match each diagram by lling out the following table. You should do this problem without using MATLAB or any other computational tools. In the pole-zero diagrams, the zeros are shown with o and the poles are shown by x.

POLE-ZERO DIAGRAM

IMPULSE RESPONSE

1 2 3 4 5 6 7 8

PoleZero

34

Page 48 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

POLEZERO DIAGRAM 1 1 1

POLEZERO DIAGRAM 2

0.5

0.5

0.5

0.5

1 1.5 1 0.5 0 0.5 1 1.5

1 1.5 1 0.5 0 0.5 1 1.5

POLEZERO DIAGRAM 3 1 1

POLEZERO DIAGRAM 4

0.5

0.5

0.5

0.5

1 1.5 1 0.5 0 0.5 1 1.5

1 1.5 1 0.5 0 0.5 1 1.5

POLEZERO DIAGRAM 5 1 1

POLEZERO DIAGRAM 6

0.5

0.5

0.5

0.5

1 1.5 1 0.5 0 0.5 1 1.5

1 1.5 1 0.5 0 0.5 1 1.5

POLEZERO DIAGRAM 7 1 1

POLEZERO DIAGRAM 8

0.5

0.5

0.5

0.5

1 1.5 1 0.5 0 0.5 1 1.5

1 1.5 1 0.5 0 0.5 1 1.5

35

Page 49 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

IMPULSE RESPONSE 1 1 1 0.8 0.6 0.4 0.5 0.2 0 1 0.5

IMPULSE RESPONSE 2

10

20

30

40

50

10

20

30

40

50

IMPULSE RESPONSE 3 20 1 10 0.5 0

IMPULSE RESPONSE 4

0.5

10

10

20

30

40

50

20

10

20

30

40

50

IMPULSE RESPONSE 5 2 1 1 0.5 0

IMPULSE RESPONSE 6

0.5

10

20

30

40

50

10

20

30

40

50

IMPULSE RESPONSE 7 5 2

IMPULSE RESPONSE 8

10

20

30

40

50

10

20

30

40

50

36

Page 50 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.9 The impulse responses, pole-zero diagrams, and frequency responses of eight discrete-time LTI systems are illustrated below. But they are out of order. Match them to each other by lling out the table. Impulse Response 1 2 3 4 5 6 7 8 Pole-Zero Diagram Frequency Response

37

Page 51 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

IMPULSE RESPONSE 1 1 1 0.5 0.5 0 0 0.5 0.5 0 10 20 30 40 1 0

IMPULSE RESPONSE 2

10

20

30

40

IMPULSE RESPONSE 3 1.2 1 0.8 0.6 0.4 0.2 0 0 10 20 30 40 1.2 1 0.8 0.6 0.4 0.2 0 0

IMPULSE RESPONSE 4

10

20

30

40

IMPULSE RESPONSE 5 1.5 1 1 0.5 0.5 0 0 0.5 0.5 1 0 10 20 30 40 1 0

IMPULSE RESPONSE 6

10

20

30

40

IMPULSE RESPONSE 7 1.2 1 1 0.5 0.8 0.6 0.4 0.5 0.2 0 10 20 30 40 0 0

IMPULSE RESPONSE 8

10

20

30

40

38

Page 52 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

ZEROPOLE DIAGRAM 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 2

0.5

0.5

ZEROPOLE DIAGRAM 3 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5

ZEROPOLE DIAGRAM 4

0 0.5 1 1 0.5

0.5

ZEROPOLE DIAGRAM 5 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 6

0.5

0.5

ZEROPOLE DIAGRAM 7 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 8

0.5

0.5

39

Page 53 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Frequency Response 1 10 8 6 10 4 2 0 5 0 20 15

Frequency Response 2

0.5

0.5

0.5

0.5

Frequency Response 3 20 15 10 4 5 0 2 0 10 8 6

Frequency Response 4

0.5

0.5

0.5

0.5

Frequency Response 5 10 8 6 4 2 0 10 8 6 4 2 0

Frequency Response 6

0.5

0.5

0.5

0.5

Frequency Response 7 2 1.5 1 4 0.5 0 2 0 10 8 6

Frequency Response 8

0.5

0.5

0.5

0.5

40

Page 54 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.10 The frequency responses and pole-zero diagrams of eight discrete-time LTI systems are illustrated below. But they are out of order. Match them to each other by lling out the table. Frequency Response 1 2 3 4 5 6 7 8 Pole-Zero Diagram

41

Page 55 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Frequency Response 1 1.5 2.5 2 1 1.5 1 0.5 0 0.5 0 0.5 0

Frequency Response 2

0.5

0.5

0.5

Frequency Response 3 3 3

Frequency Response 4

0.5

0.5

0.5

0.5

Frequency Response 5 1.5 4 3 2 0.5 1 0

Frequency Response 6

0.5

0.5

0.5

0.5

Frequency Response 7 1.5 1.5

Frequency Response 8

0.5

0.5

0.5

0.5

0.5

0.5

42

Page 56 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

ZEROPOLE DIAGRAM 1 1 0.5 0 0.5 1 1 0 1 1 0.5 0 0.5 1

ZEROPOLE DIAGRAM 2

ZEROPOLE DIAGRAM 3 1 0.5 0 0.5 1 1 0 1 1 0.5 0 0.5 1

ZEROPOLE DIAGRAM 4

ZEROPOLE DIAGRAM 5 1 0.5 0 0.5 1 1 0 1 1 0.5 0 0.5 1

ZEROPOLE DIAGRAM 6

ZEROPOLE DIAGRAM 7 1 0.5 0 0.5 1 1 0 1 1 0.5 0 0.5 1

ZEROPOLE DIAGRAM 8

43

Page 57 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.11 The three discrete-time signals below are each applied to two discrete-time systems to produce a total of six output signals. The frequency response of each system is shown below. Indicate how each of the six output signals are produced by completing the table below.
INPUT SIGNAL 1 1.5 1 0.5 0 0.5 5 4 2 0 2 4 5 INPUT SIGNAL 2

10

15

20

25

10

15

20

25

INPUT SIGNAL 3 2 1 0 1 2 5 0 5 10 15 20 25

SYSTEM 1 FREQUENCY RESPONSE 4 3 |Hf ()| 1 2 1 0 |Hf ()| 2 0.8 0.6 0.4 0.2 0

SYSTEM 2 FREQUENCY RESPONSE

0.25

0.5

0.75

0.25

0.5

0.75

INPUT SIGNAL 1 2 3 1 2 3

SYSTEM 1 1 1 2 2 2

OUTPUT SIGNAL

44

Page 58 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

OUTPUT SIGNAL 1 1 0.5 2 0 1 0.5 1 5 0 5 3

OUTPUT SIGNAL 2

10

15

20

25

10

15

20

25

OUTPUT SIGNAL 3 4 2 0 0 2 4 5 2 0 5 10 15 20 25 4 5 0 6 4 2

OUTPUT SIGNAL 4

10

15

20

25

OUTPUT SIGNAL 5 2 1 0 1 2 5 0.4 0.3 0.2 0.1 0 5

OUTPUT SIGNAL 6

10

15

20

25

10

15

20

25

45

Page 59 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.12 The pole-zero diagrams of eight discrete-time systems are illustrated below. The frequency response H f () of each system is also shown, but in a dierent order. Match each frequency response to its pole-zero diagram by lling out the table.
POLEZERO DIAGRAM 1 1 1 POLEZERO DIAGRAM 2

Imaginary Part

0.5 0 0.5 1 1.5 1 0.5 0 0.5 1 1.5

Imaginary Part

0.5 0 0.5 1 1.5 1 0.5 0 0.5 1 1.5

Real Part
POLEZERO DIAGRAM 3 1 1

Real Part
POLEZERO DIAGRAM 4

Imaginary Part

0.5 0 0.5 1 1.5 1 0.5 0 0.5 1 1.5

Imaginary Part

0.5 0 0.5 1 1.5 1 0.5 0 0.5 1 1.5

Real Part
POLEZERO DIAGRAM 5 1 1

Real Part
POLEZERO DIAGRAM 6

Imaginary Part

0.5 0 0.5 1 1.5 1 0.5 0 0.5 1 1.5

Imaginary Part

0.5 0 0.5 1 1.5 1 0.5 0 0.5 1 1.5

Real Part
POLEZERO DIAGRAM 7 1 1

Real Part
POLEZERO DIAGRAM 8

Imaginary Part

0.5 0 0.5 1 1.5 1 0.5 0 0.5 1 1.5

Imaginary Part

0.5 0 0.5 1 1.5 1 0.5 0 0.5 1 1.5

Real Part

Real Part

46

Page 60 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

FREQUENCY RESPONSE 1

FREQUENCY RESPONSE 2

1 0.8 0.6 0.4 0.2 0 0.5 0 0.5

1 0.8 0.6 0.4 0.2 0 0.5 0 0.5

FREQUENCY RESPONSE 3 1.2 1 0.8 0.6 0.4 0.2 0 0.5 0 0.5 1.2 1 0.8 0.6 0.4 0.2 0

FREQUENCY RESPONSE 4

0.5

0.5

FREQUENCY RESPONSE 5 1.2 1 0.8 0.6 0.4 0.2 0 0.5 0 0.5 1.2 1 0.8 0.6 0.4 0.2 0

FREQUENCY RESPONSE 6

0.5

0.5

FREQUENCY RESPONSE 7 1.2 1 0.8 0.6 0.4 0.2 0 0.5 0 0.5 1.2 1 0.8 0.6 0.4 0.2 0

FREQUENCY RESPONSE 8

0.5

0.5

Pole-Zero Diagram 1 2 3 4 5 6 7 8

Frequency Response

47

Page 61 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.13 The three discrete-time signals below are each applied to two discrete-time LTI systems to produce a total of six output signals. The frequency response H f () of each system is shown below. Indicate how each of the six output signals are produced by completing the table below. INPUT SIGNAL 1 1 2 2 3 3
SYSTEM 1 FREQUENCY RESPONSE 1 0.8 0.6 0.4 0.2 0 1 0.8 0.6 0.4 0.2 0

SYSTEM 1 2 1 2 1 2

OUTPUT SIGNAL

SYSTEM 2 FREQUENCY RESPONSE

0.5

0.5

0.5

0.5

48

Page 62 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

INPUT SIGNAL 1 1 0.5 0 0.5 1 0 10 20 30 40 50 60 70 80

INPUT SIGNAL 2 1 0.5 0 0.5 1 0 10 20 30 40 50 60 70 80

INPUT SIGNAL 3 1 0.5 0 0.5 1 0 10 20 30 40 50 60 70 80

49

Page 63 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

OUTPUT SIGNAL 1 1 0.5 0 0.5 1 0 10 20 30 40 50 60 70 80

OUTPUT SIGNAL 2 1 0.5 0 0.5 1 0 10 20 30 40 50 60 70 80

OUTPUT SIGNAL 3 1 0.5 0 0.5 1 0 10 20 30 40 50 60 70 80

OUTPUT SIGNAL 4 1 0.5 0 0.5 1 0 10 20 30 40 50 60 70 80

50

Page 64 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

OUTPUT SIGNAL 5 1 0.5 0 0.5 1 0 10 20 30 40 50 60 70 80

OUTPUT SIGNAL 6 1 0.5 0 0.5 1 0 10 20 30 40 50 60 70 80

51

Page 65 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.8.14 The pole-zero diagrams of eight discrete-time systems are illustrated below. The impulse response h(n) of each system is also shown, but in a dierent order. Match each frequency response to its pole-zero diagram by lling out the table. Pole-Zero Diagram 1 2 3 4 5 6 7 8 Impulse Response

52

Page 66 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

ZEROPOLE DIAGRAM 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 2

0.5

0.5

ZEROPOLE DIAGRAM 3 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5

ZEROPOLE DIAGRAM 4

0 0.5 1 1 0.5 0 0.5 1

ZEROPOLE DIAGRAM 5 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1

ZEROPOLE DIAGRAM 6

0.5

0.5

ZEROPOLE DIAGRAM 7 1 0.5 0 0.5 1 1 0.5 0 0.5 1 1 0.5

ZEROPOLE DIAGRAM 8

0 0.5 1 1 0.5 0

0.5

53

Page 67 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

IMPULSE RESPONSE 1 8 20 10 0 10 20 0 10 20 30 40 6 4 2 0 2 4 6 0

IMPULSE RESPONSE 2

10

20

30

40

IMPULSE RESPONSE 3 1.2 1 0.8 0.6 0.4 0.2 0 10 0 10 20 30 40 0 0 5

IMPULSE RESPONSE 4

10

20

30

40

IMPULSE RESPONSE 5 1 0.5 15 0 10 0.5 1 0 10 20 30 40 5 0 25 20

IMPULSE RESPONSE 6

10

20

30

40

IMPULSE RESPONSE 7 1.5 1 0.5 0.5 0 0.5 1 1 0 10 20 30 40 0 0 0.5 1

IMPULSE RESPONSE 8

10

20

30

40

54

Page 68 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.9

More Problems
h(n) = 0.5 (n) + 0.5 (n 1). (a) (b) (c) (d) Sketch the impulse response h(n). What dierence equation implements this system? Sketch the pole-zero diagram of this system. Find the frequency resposnse H f (). Find simple expressions for |H f ()| and H f () and sketch them. (e) Is this a lowpass, highpass, or bandpass lter? (f) Find the output signal y(n) when the input signal is x(n) = u(n). Also, x(n) = cos(o n) u(n) for what value of o ? (g) Find the output signal y(n) when the input signal is x(n) = (1)n u(n). Also, x(n) = cos(o n) u(n) for what value of o ?

1.9.1 Two-Point Moving Average A discrete-time LTI system has impulse response

1.9.2 Four-Point Moving Average A discrete-time LTI system has impulse response h(n) = 0.25 (n) + 0.25 (n 1) + 0.25 (n 2) + 0.25 (n 3) (a) (b) (c) (d) Sketch h(n). What dierence equation implements this system? Sketch the pole-zero diagram of this system. Find the frequency resposnse H f (). Find simple expressions for |H f ()| and H f () and sketch them. (e) Is this a lowpass, highpass, or bandpass lter?

1.9.3 The impulse response of a discrete-time LTI system is given by h(n) = A (0.7)n u(n). Suppose the signal x(n) = B (0.9)n u(n) is input to the system. A and B are unknown constants. Which of the following could be the output signal y(n)? Choose all that apply and provide an explanation for your answer. (a) (b) (c) (d) (e) (f) y(n) = K1 (1.6)n u(n) + K2 (0.2)n u(n) y(n) = K1 (0.7)n u(n) + K2 (0.2)n u(n) y(n) = K1 (0.7)n u(n) + K2 (0.9)n u(n) y(n) = K1 (0.7)n u(n) + K2 (0.2)n u(n) y(n) = K1 (0.7)n u(n) + K2 (0.2)n u(n) + K3 (0.9)n u(n) y(n) = K1 (0.7)n u(n) + K2 (0.2)n u(n) + K3 u(n)

1.9.4 The impulse response of a discrete-time LTI system is given by h(n) = A (0.7)n u(n). Suppose the signal x(n) = B cos(0.2 n) u(n) is input to the system. A and B are unknown constants. Which of the following could be the output signal y(n)? Choose all that apply and provide an explanation for your answer. 55

Page 69 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(a) y(n) = K1 (0.7)n cos(0.2 n + ) u(n) (b) y(n) = K1 (0.14)n cos(0.5 n + ) u(n) (c) y(n) = K1 (0.14)n u(n) + K2 cos(0.14 n + ) u(n) (d) y(n) = K1 (0.14)n u(n) + K2 cos(0.14 n + ) u(n) (e) y(n) = K1 (0.7)n u(n) + K2 cos(0.2 n + ) u(n) (f) y(n) = K1 (0.7)n u(n) + K2 cos(0.2 n + ) u(n) 1.9.5 A causal LTI discrete-time system is implemented using the dierence equation y(n) = b0 x(n) a1 y(n 1) a2 y(n 2) where ak , bk are unknown real constants. Which of the following could be the impulse response? Choose all that apply and provide an explanation for your answer. (a) h(n) = K1 an u(n) + K2 bn u(n) (b) h(n) = K1 an u(n) + K2 rn cos(1 n + ) u(n) (c) h(n) = K1 rn cos(1 n + ) u(n)
n n (d) h(n) = K1 r1 cos(1 n + 1 ) u(n) + K2 r2 cos(2 n + 2 ) u(n) (with 1 = 2 ).

1.9.6 Feedback Loop Consider the following connection of two discrete-time LTI systems.

E+ E i T

h1 (n)

h2 (n)

'

You are told that h1 (n) = (n) + (n 1), h2 (n) = 1 (n 1). 2

(a) Find the impulse response h(n) of the total system. (b) Sketch h1 (n), h2 (n), and h(n). 1.9.7 Feedback Loop Consider the following interconnection of two causal discrete-time LTI systems

E+ E i T

SYS 2

SYS 1

'

56

Page 70 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

where SYS 1 is implemented using the dierence equation y(n) = 2 x(n) 0.5 y(n 1) and SYS 2 is implemented using the dierence equation y(n) = 2 x(n) 0.2 y(n 1) Find the impulse response of the total system, htot (n).

57

Page 71 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2
2.1

Continuous-Time Signals and Systems


Basic Problems
(a) x(t) = u(t + 1) u(t), (b) x(t) = et u(t), d x(t), dt
d dt x(t). t

2.1.1 Make an accurate sketch of each continuous-time signal.

d x(t), dt

x( ) d

x( ) d

Hint: use the product rule for (c) x(t) = (d)

1 [(t 1) + (t + 2)], t

x( ) d

x(t) = r(t) 2 r(t 1) + 2 r(t 3) r(t 4) where r(t) := t u(t) is the ramp function. (e) g(t) = x(3 2 t), where x(t) is dened as x(t) = 2t u(t 1).

2.1.2 Sketch the continuous-time signals f (t) and g(t) and the product signal f (t) g(t). (a) f (t) = u(t + 4) u(t 4)

g(t) =
k=

(t 3 k)

(b) f (t) = cos

t 2 (t 2k)

g(t) =
k=

Also write f (t) g(t) in simple form. (c) f (t) = sin

t 2 (t 2k 1)

g(t) =
k=

Also write f (t) g(t) in simple form. 58

Page 72 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(d) f (t) = 1 2
|t|

g(t) =
k=

(t 2 k).

(e)

f (t) =
k=

(1)k (t 0.5 k)

g(t) = 2|t| 2.1.3 A continuous-time system is described by the following rule y(t) = x(t) . x(t 1)

Classify the system as: (a) memoryless/with memory (b) causal/noncausal (c) linear/nonlinear (d) time-invariant/time-varying (e) BIBO stable/unstable 2.1.4 You observe an unknown system and notice that

u(t) u(t 1)

E et u(t)

and that

u(t) u(t 2)

E e2t u(t)

Which conclusion can you make? (a) The system is LTI. (b) The system is not LTI. (c) There is not enough information to decide. 2.1.5 You observe an unknown LTI system and notice that

59

Page 73 of 169

EE 3054 - Polytechnic University


2 E 2 3 4 h(t) E e e e 1 0 1 2 3

Prof. Ivan Selesnick

1 e e 1 0 1

What is the output of the same LTI system when the input is as shown? 1 e e e e 1 0 1 2 ? E 3 4 h(t) E 1 0 1 2 3 4

2.1.6 You observe an unknown continuous-time LTI system and notice that
2 1

E e e
1 0 1 2 3 4

h(t)

e e e
1 0 1 2 3 4

What is the output of the same LTI system when the input is as shown?
1 ?

E e e
1 0

h(t)

E
1 0 1 2 3 4

e 1

e 2

Use the LTI properties and be careful! 2.1.7 You observe an unknown LTI system and notice that 1 E 1 0 1 2 3 4 S E 1 r rr 1 0 1 2 3

What is the output of the same LTI system when the input is as shown? 2 1 1 0 1 2 1 E 3 4 S E 1 0 1 2 3 4 ?

2.1.8 You observe an unknown continuous-time LTI system and notice that

u(t) u(t 1)

E r(t) 2 r(t 1) + r(t 2)

(a) Find and sketch the step response s(t). (b) Find and sketch the impulse response h(t). (c) Classify the system as BIBO stable/unstable. 60

Page 74 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.1.9 The impulse response h(t) of an LTI system is the triangular pulse shown.
1

h(t) 3

1 0

d d
1 2

Suppose the input x(t) is the periodic impulse train

x(t) =
k=

(t k T ).

Sketch the output of the system y(t) when (a) T = 3 (b) T = 2 (c) T = 1.5 2.1.10 Consider an LTI system described by the rule y(t) = x(t 5) + 1 x(t 7). 2

What is the impulse response h(t) of this system? 2.1.11 Consider the LTI system with impulse response h(t) = t u(t). (a) Find and sketch the output y(t) when the input x(t) is x(t) = (t) 2 (t 2) + (t 3). (b) Classify the system as BIBO stable/unstable. 2.1.12 Consider the LTI system with impulse response h(t) = (t) 1 (t 2). 4

(a) Find and sketch the output y(t) when the input x(t) is x(t) = 2t u(t). (b) Classify the system as BIBO stable/unstable. 2.1.13 Consider the continuous-time LTI system with impulse response h(t) = (t 1). (a) Find and sketch the output y(t) when the input x(t) is the impulse train with period 2,

x(t) =
k=

(t 2k).

(b) Classify the system as BIBO stable/unstable. 61

Page 75 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.2

Convolution

2.2.1 Derive and sketch the convolution v(t) = f (t) g(t) where f (t) and g(t) are as shown.
1

f (t) -

g(t) -

2.2.2 Derive and sketch the convolution x(t) = f (t) g(t) where f (t) and g(t) are as shown.
1

f (t) -

2 1

g(t) -

2 1

2.2.3 Sketch the continuous-time signals f (t), g(t); nd and sketch the convolution f (t) g(t). (a) f (t) = u(t + 1) + u(t) g(t) = u(t 1) + u(t 2). (b) f (t) = (t + 1) (t 2.5) g(t) = 2 (t + 1.5) (t 2) (c) f (t) = (t) + (t 1) + 2 (t 2) g(t) = (t 2) (t 3). (d) f (t) = (t + 1.2) (t 1) g(t) = (t + 0.3) (t 1).

62

Page 76 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(e) f (t) = u(t + 2) u(t 2)

g(t) =
k=

(t 3 k)

(f) f (t) = et u(t), g(t) = et u(t) 2.2.4 The impulse response of a continuous-time LTI system is given by h(t). Find and sketch the output y(t) when the input is given by x(t). Also, classify each system as BIBO stable/unstable. (a) h(t) = 2 e3t u(t). x(t) = u(t 2) u(t 3). (b) h(t) = 1 |t| |t| 1 0 |t| 1

x(t) =
k=

(t 4 k).

(c) h(t) = et u(t) x(t) = u(t) u(t 2), (d) h(t) = cos (t) u(t). x(t) = u(t) u(t 3). 2.2.5 Consider the cascade connection of two continuous-time LTI systems

x(t)

SYS 1

SYS 2

y(t)

with the following impulse responses,


1

h1 (t) 1 0 1 2 3

63

Page 77 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

h2 (t) 1 0 1 3

Accurately sketch the impulse response of the total system.

2.3

Laplace Transform

You may use MATLAB. The residue and roots commands should be useful for some of the following problems. 2.3.1 Given h(t), nd H(s) and its region of convergence (ROC). h(t) = 5e4t u(t) + 2e3t u(t) 2.3.2 Given H(s), use partial fraction expansion to expand it (by hand). You may use the Matlab command residue to verify your result. (a) H(s) = (b) H(s) = 2.3.3 Let f (t) = et u(t), g(t) = et u(t) 2s2 s1 + 3s + 1 s2 s+4 + 5s + 6

Use the Laplace transform to tind and sketch the convolution of these two signals, y(t) = f (t) g(t). (Yes, f (t) and g(t) are the same here.) 2.3.4 The impulse response of a continuous-time LTI system is given by h(t) = 1 2
t

u(t).

Sketch h(t) and nd the transfer function H(s) of the system. 2.3.5 Given the impulse response of a continuous-time LTI system, nd the transfer function H(s), the ROC of H(s), and the poles of the system. Use Eulers formula! (a) h(t) = sin(3 t) u(t) (b) h(t) = et/2 sin(3 t) u(t) (c) h(t) = et u(t) + et/2 cos(3 t) u(t)

64

Page 78 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.3.6 Suppose the impulse response of an LTI system has the form h(t) = B e3t u(t). Suppose a signal x(t) with the form x(t) = A cos(10 t) u(t) is applied to the system. Which of the following signal forms can the output take? (Chose all that apply.) (a) y(t) = C e3t cos(10 t + ) u(t) (b) y(t) = C cos(10 t + ) u(t) + D e3t u(t) (c) y(t) = C e3t cos(10 t + 1 ) u(t) + D cos(10 t + 2 ) u(t) + E e3t u(t) 2.3.7 What is the Laplace transform of r(t 2)? L{r(t 2)} = ? where r(t) is the ramp function t u(t).

2.4

Dierential Equations

2.4.1 A causal continuous-time LTI system is described by the dierential equation 2 y (t) + y(t) = 3 x(t). (a) Find the output signal when the input signal is x(t) = 5 e3 t u(t). Show your work. (b) Is the system stable or unstable? (c) Sketch the pole-zero diagram of this system. 2.4.2 A causal continuous-time LTI system is described by the dierential equation y (t) + 4 y (t) + 3 y(t) = 2 x (t) + 3 x(t) (a) Find the output signal y(t) when the input signal x(t) is x(t) = 3 e2t u(t). (b) What is the steady state output when the input signal is x(t) = 3 u(t). (The steady state output is the output signal value after the transients have died out.) 2.4.3 The impulse response h(t) of a continuous-time LTI system is given by h(t) = 3 e2t u(t) e3t u(t). (a) Find the transfer function H(s) of the system. (b) Find the dierential equation for this system. 65

Page 79 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(c) Classify the system as stable/unstable. 2.4.4 The dierential equation of a causal continuous-time LTI system is given by y (t) + y (t) 2 y(t) = x(t) (a) Find the transfer function H(s) of the system. (b) Find the impulse response h(t) of this system. (c) Classify the system as stable/unstable. 2.4.5 The impulse response of a continuous-time LTI system is given by h(t) = 2 et u(t) e2t u(t) Find the dierential equation that describes the system. 2.4.6 Consider a causal continuous-time LTI system described by the dierential equation y (t) + 3 y (t) + 2 y(t) = 2 x (t) (a) Find the transfer function H(s), its ROC, and its poles. (b) Find the impulse response h(t). (c) Classify the system as stable/unstable. (d) Find the output of the system when the input signal is x(t) = 2 u(t). 2.4.7 A causal continuous-time LTI system is described by the dierential equation y (t) + 5 y (t) + 4 y(t) = 3 x (t) + 6 x(t) (a) Find the impulse response h(t). (b) Find the output signal y(t) when the input signal x(t) is as shown:
1

x(t) 1 0 1 2 3

2.4.8 Consider a causal continuous-time LTI system described by the dierential equation y (t) + y(t) = x(t). (a) Find the transfer function H(s), its ROC, and its poles. (b) Find the impulse response h(t). (c) Classify the system as stable/unstable. (d) Find the step response of the system (the output when x(t) = u(t)). 2.4.9 A causal LTI system is described by the dierential equation y (t) + 7 y (t) + 12 y(t) = 3 x (t) + 2 x(t). (a) Find the transfer function H(s) and the ROC of H(s). 66

Page 80 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(b) List the poles of H(s). (c) Find the impulse response h(t). (d) Classify the system as stable/unstable. (e) Fnd the output y(t) when the input is x(t) = et u(t) + e2t u(t). 2.4.10 Given the two LTI systems described the the dierential equations: T1 : y (t) + 3 y (t) + 7 y(t) = 2 x (t) + x(t) T2 : y (t) + y (t) + 4 y(t) = x (t) 3 x(t) (a) Let T be the cascade of T1 and T2 , T [x(t)] = T2 [T1 [x(t)]], as shown in the diagram.

x(t)

SYS 1

SYS 2

y(t)

What are H1 (s), H2 (s), Htot (s), the transfer functions of T1 , T2 and T ? What is the dierential equation describing the total system T ? (b) Let T be the sum of T1 and T2 , T [x(t)] = T2 [x(t)] + T1 [x(t)], as shown in the diagram.

E x(t) E

SYS 1 c l + E T SYS 2 y(t)

What is Htot (s), the transfer function of the total system T ? What is the dierential equation describing the total system T ? 2.4.11 Find the dierential equation describing each of the systems of Problem 5 on page 64. 2.4.12 Given a causal LTI system described by the dierential equation nd H(s), the ROC of H(s), and the impulse response h(t) of the system. Classify the system as stable/unstable. List the poles of H(s). You should the Matlab residue command for this problem. (a) y (b) y + 3y + 2y = x + 6x + 6x + 8 y + 46 y + 68y = 10 x + 53 x + 144 x

2.4.13 Given a causal LTI system described by y (t) + 1 y(t) = 2 x(t) 3

nd H(s). Given the input x(t) = e2t u(t), nd the output y(t) without explicitly nding h(t). (Use Y (s) = H(s)X(s), and nd y(t) from Y (s).)

67

Page 81 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.5

Frequency Response
1 for || < 4 0 for || 4 .

2.5.1 The frequency response of a continuous-time LTI system is given by H f () =

Find the output y(t) of the system when the input is x(t) = 3 cos(2 t) + 6 sin(5 t). 2.5.2 The signal x(t) in the previous problem is ltered with a continuous-time LTI system having the following frequency response. Find the output y(t). 6 t  t f  t H ()  t  t 4 0 4

2.5.3 Consider the cascade combination of two continuous-time LTI systems.

x(t)

SYS 1

SYS 2

y(t)

The frequency response of SYS 1 is


f H1 () =

1 for || < 6 0 for || 6 .

The frequency response of SYS 2 is


f H2 () =

0 for || < 4 1 for || 4 .

(a) If the input signal is x(t) = 2 cos(3 t) 3 sin(5 t) + 4 cos(7 t) what is the output signal y(t)? (b) What is the frequency response of the total system? 2.5.4 The frequency response H f () of a continuous-time LTI system is given by H f () = 1 . j

(a) Find the output y(t) when the input is given by x(t) = cos(2 t) + sin(4 t). (b) Sketch the magnitude of the frequency response, |H f ()|, and the phase of the frequency response, H f (). 68

Page 82 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(c) Classify the system as stable/unstable and give a brief explanation for your answer. 2.5.5 The impulse response of a continuous-time LTI system is given by h(t) = (t) et u(t). (a) What is the frequency response H f () of this system? (b) Find and sketch |H f ()|. (c) Is this a lowpass, bandpass, or highpass lter, or none of those? 2.5.6 The impulse response of a continuous-time LTI system is given by h(t) = (t 2). (This is a delay of 2.) (a) What is the frequency response H f () of this system? (b) Find and sketch |H f ()|. (c) Is this a lowpass, bandpass, or highpass lter, or none of those? 2.5.7 When the continuous-time signal x(t) x(t) = sin(10 t) + cos(5 t) is applied as the input to an unknown continuous-time system, the observed output signal y(t) is y(t) = 3 sin(10 t) + 2 cos(7 t). Which of the following statements is true? Given an explanation for your choice. (a) The system is LTI. (b) The system is not LTI. (c) There is not enough information to decide. 2.5.8 The continuous-time signal x(t) = sin(10 t) u(t) + cos(5 t) u(t) is sent through a continuous-time LTI system with the frequency response H f () = 3 ej 2.3 . What is the output signal y(t)? 2.5.9 Consider the cascade connection of two copies of the same continuous-time LTI system:

x(t)

h1 (t)

h1 (t)

y(t)

where h1 (t) is as shown:

69

Page 83 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

h1 (t) 1
f (a) Find the frequency response H1 (). f (b) Find the frequency response of the total system Htot ().

2.5.10 Suppose H is an ideal lowpass lter with cut-o frequency o . Suppose H is connected in series with another copy of itself, x(t) H H y(t)

Find and sketch the frequency response of the total system. 2.5.11 An echo can be modeled with a causal LTI system described by the equation y(t) = x(t) 1 x(t 10). 2

(a) Find the impulse response h(t). (b) Classify the system as stable/unstable. (c) Find the frequency response H f () and sketch |H f ()|2 . 2.5.12 Two continuous-time LTI systems are connected in cascade.

x(t)

h1 (t)

h2 (t)

y(t)

The impulse responses are given by h1 (t) = (t 0.5) h2 (t) = e2t u(t) (a) Find the impulse response h(t) of the total system. (b) Find the frequency response H f () of the total system. (c) Find the steady-state output signal y(t) when the input is x(t) = cos(2 t) u(t).

2.6

Fourier Transform

For each of the following problems, you are encouraged to use a table of Fourier transforms and properties. The function sinc(t) is dened as sinc(t) = sin( t) t

2.6.1 Sketch each of the following signals, and nd its Fourier transform. You do not need to perform any integration instead, use the properties of the Fourier transform. 70

Page 84 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(a) x(t) = e(t1) u(t 1) (b) x(t) = e(t1) u(t) (c) x(t) = et u(t 1) 2.6.2 Sketch each of the following signals, and nd its Fourier transform. (a) x(t) = e|t| (b) x(t) = e|t1| 2.6.3 The Fourier transform of x(t) is X f () = rect(). rect() = 1 || 0.5 0 || > 0.5

Use the Fourier transform properties to sketch the magnitude and phase of the Fourier transform of each of the following signals. (a) f (t) = x(t 2) (b) g(t) = x(2 t) (c) v(t) = x(2 t 1) (d) q(t) = x(t) x(t) 2.6.4 Find and sketch the Fourier transform of each of the following signals. (a) x(t) = cos(6 t) (b) x(t) = sinc(3 t) (c) x(t) = cos(6 t) sinc(3 t) (d) x(t) = cos(3 t) cos(2 t) 2.6.5 The spectrum X f () of a continuous-time signal x(t) is given by X f () = 1 ||/(3 ) for || 3 0 for other values of .

Sketch the magnitude and the phase of the Fourier transform of each of the following signals. a(t) = 3 x(2 t) b(t) = x(t) x(t) d(t) = x(t) cos(5 t) f (t) = x(t 5) 2.6.6 Let the signal g(t) be g(t) = sinc(2 t). (a) Find the Fourier transform of g(t). F{g(t)} = ? (b) Find the Fourier transform of g(t) convolved with itself. F{g(t) g(t)} = ? 71

Page 85 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(c) Find the Fourier transform of g(t 1) g(t 2). F{g(t 1) g(t 2)} = ? (Use part (a) together with properties of the Fourier transform.) (d) Find the Fourier transform of g(t) multiplied with itself. F{g(t) g(t)} = ? 2.6.7 The signal x(t) is a cosine pulse, x(t) = cos(10 t) [u(t + 1) u(t 1)]. Find and make a rough sketch of its Fourier transform X f (). Also, make a sketch of x(t). 2.6.8 Two continuous-time LTI system are used in cascade. Their impulse responses are h1 (t) = sinc(3 t) h2 (t) = sinc(5 t).

h1 (t)

h2 (t)

Find the impulse response and sketch the frequency response of the total system. 2.6.9 The signal x(t) is given the product of two sine functions, x(t) = sin( t) sin(2 t). Find the Fourier transform X f (). 2.6.10 The left-hand column below shows four continuous-time signals. The Fourier transform of each signal appears in the right-hand column in mixed-up order. Match the signal to its Fourier transform.

SIGNAL

FOURIER TRANSFORM

1 2 3 4

72

Page 86 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

#1 1.5 1.5

1 Xf() 0.5 x(t)

0.5

0 5 1.5

0 t #2

0 5 1.5

0 / B

1 Xf() 0.5 x(t)

0.5

0 5 1.5 1 0.5 0 0.5 5 2.5 2 1.5

0 t #3

0 5 2.5 2 1.5 Xf() 1 0.5 0 0.5

0 / C

x(t)

0 t #4

1 5

0 / D

4 3 Xf() 0 t 5 2 1 0 1 5 0 / 5

x(t)

1 0.5 0 0.5 1 5

73

Page 87 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.6.11 The ideal continuous-time band-stop lter has the frequency response 1 || 1 0 1 < || < 2 H f () = 1 || 2 . (a) What is the impulse response h(t) of the ideal band-stop lter? (b) Describe how to implement the ideal band-stop lter using only lowpass and highpass lters. 2.6.12 The ideal continuous-time band-pass lter has the frequency response 0 || 1 1 1 < || < 2 H f () = 0 || 2 . Describe how to implement the ideal band-pass using two ideal low-pass lters with dierent cut-o frequencies. (Should a parallel or cascade structure be used?) Using that, nd the impulse response h(t) of the ideal band-pass lter. 2.6.13 The ideal continuous-time high-pass lter has the frequency response H f () = 0, || c 1, || > c .

Find the impulse response h(t). 2.6.14 The frequency response of a continuous-time LTI is given by H f () = 0 || < 2 1 || 2

(This is an ideal high-pass lter.) Use the Fourier transform to nd the output y(t) when the input x(t) is given by (a) x(t) = sinc(t) = (b) x(t) = sinc(3 t)
sin( t) t = sin(3 t) 3t

2.6.15 What is the Fourier transform of x(t)? x(t) = cos(0.3 t) sin(0.1 t) X f () = F{x(t)} = ?

2.7

Matching

2.7.1 Match the impulse response h(t) of a continuous-time LTI system with the correct plot of its frequency response |H f ()|. Explain how you obtain your answer.
IMPULSE RESPONSE 1 0.5 0 0.5 1 0.5 0 0.5 1 1.5 2 t 2.5 3 3.5 4 4.5 5

74

Page 88 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

FREQUENCY RESPONSE A

1 0.8 0.6 0.4 0.2 0 8 6 4 2 0 2 4 6 8

FREQUENCY RESPONSE B

1 0.8 0.6 0.4 0.2 0 8 6 4 2 0 2 4 6 8

FREQUENCY RESPONSE C

1 0.8 0.6 0.4 0.2 0 8 6 4 2 0 2 4 6 8

FREQUENCY RESPONSE D

1 0.8 0.6 0.4 0.2 0 8 6 4 2 0 2 4 6 8

75

Page 89 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.7.2 For the impulse response h(t) illustrated in the previous problem, identify the correct diagram of the poles of H(s). Explain how you obtain your answer.
#1 10 10 #2

5 Imag part Imag part 2 1 0 1 Real part 2 3

10 3

10 3

0 1 Real part

#3 10 10

#4

5 Imag part Imag part 2 1 0 1 Real part 2 3

10 3

10 3

0 1 Real part

76

Page 90 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.7.3 The following diagrams indicate the pole locations of six continuous-time LTI systems. Match each with the corresponding impulse response with out actually computing the Laplace transform.

POLE-ZERO DIAGRAM

IMPULSE RESPONSE

1 2 3 4 5 6
#1 6 4 2 0 2 4 6 1 #4 6 4 2 0 2 4 6 1 0 1 6 4 2 0 2 4 6 1 0 1 0 1 6 4 2 0 2 4 6 1 #5 6 4 2 0 2 4 6 1 0 1 0 1 #2 6 4 2 0 2 4 6 1 #6 0 1 #3

2 1 0 1 0 2 D 4

2 1 0 1 0 2 E 4

2 1 0 1 0 2 F 4

2 1 0 1 0 2 4

2 1 0 1 0 2 4

2 1 0 1 0 2 4

77

Page 91 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.7.4 The gure shows the impulse responses and frequency responses of four continuous-time LTI systems. But they are out of order. Match the impulse response to its frequency response magnitude, and explain your answer.

IMPULSE RESPONSE

FREQUENCY RESPONSE

1 2 3 4
IMPULSE RESPONSE 1 1 0.6 FREQUENCY RESPONSE 1

0.5 0.4 0 0.2 0.5

1 1

0 10

10

IMPULSE RESPONSE 2 1 0.6

FREQUENCY RESPONSE 2

0.5 0.4 0 0.2 0.5

1 1

0 10

10

IMPULSE RESPONSE 3 1 0.6

FREQUENCY RESPONSE 3

0.5 0.4 0 0.2 0.5

1 1

0 10

10

IMPULSE RESPONSE 4 1 0.6

FREQUENCY RESPONSE 4

0.5 0.4 0 0.2 0.5

1 1

2 3 TIME (SEC)

0 10

0 FREQUENCY (Hz)

10

78

Page 92 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.7.5 The gure shows the impulse responses and frequency responses of four continuous-time LTI systems. But they are out of order. Match each impulse response with its frequency response.

IMPULSE RESPONSE

FREQUENCY RESPONSE

1 2 3 4
IMPULSE RESPONSE 1 1 0.5 0.4 0 0.5 1 1 0 1 2 3 4 5 6 10 5 0 5 10 0.3 0.2 0.1 0.6 0.5 FREQUENCY RESPONSE 1

IMPULSE RESPONSE 2 1 0.5 0.4 0 0.5 1 1 0 1 2 3 4 5 6 10 0.3 0.2 0.1 0.6 0.5

FREQUENCY RESPONSE 2

10

IMPULSE RESPONSE 3 1 0.5 0.8 0 0.5 1 1 0 1 2 3 4 5 6 10 0.6 0.4 0.2 1.2 1

FREQUENCY RESPONSE 3

10

IMPULSE RESPONSE 4 0.4 1 0.5 0 0.5 1 1 0 1 2 3 TIME (SEC) 4 5 6 0.35 0.3 0.25 0.2 0.15 0.1 0.05 10

FREQUENCY RESPONSE 4

0 FREQUENCY (Hz)

10

79

Page 93 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.7.6 The gure shows the pole diagrams and frequency responses of four continuous-time LTI systems. But they are out of order. Match each pole diagram with its frequency response.

POLE DIAGRAM

FREQUENCY RESPONSE

1 2 3 4
POLEZERO DIAGRAM 1 20 0.4 0.35 10 0.3 0.25 0 0.2 0.15 10 0.1 0.05 20 3 2.5 2 1.5 1 0.5 0 0.5 6 4 2 0 2 4 6 FREQUENCY RESPONSE 1

POLEZERO DIAGRAM 2 20 0.6 0.5 0.4 0 0.3 0.2 10 0.1 20 3 2.5 2 1.5 1 0.5 0 0.5 6

FREQUENCY RESPONSE 2

10

POLEZERO DIAGRAM 3 20 1.2 1 0.8 0 0.6 0.4 10 0.2 20 3 2.5 2 1.5 1 0.5 0 0.5 6

FREQUENCY RESPONSE 3

10

POLEZERO DIAGRAM 4 20 0.6 0.5 0.4 0 0.3 0.2 10 0.1 20 3 2.5 2 1.5 1 0.5 0 0.5 6

FREQUENCY RESPONSE 4

10

2 0 2 FREQUENCY (Hz)

80

Page 94 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.7.7 The diagrams on the following pages show the pole-zero diagrams and frequency responses of 8 causal continuous-time LTI systems. But the diagrams are out of order. Match each diagram by lling out the following table. In the pole-zero diagrams, the zeros are shown with o and the poles are shown by .

POLE-ZERO DIAGRAM

FREQUENCY RESPONSE

1 2 3 4 5 6 7 8

81

Page 95 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

POLEZERO DIAGRAM 1 10 5 0 5 10 6 4 2 0 2 4 6 10 5 0 5 10 6 4

POLEZERO DIAGRAM 2

POLEZERO DIAGRAM 3 10 5 0 5 10 6 4 2 0 2 4 6 10 5 0 5 10 6 4

POLEZERO DIAGRAM 4

POLEZERO DIAGRAM 5 10 5 0 5 10 6 4 2 0 2 4 6 10 5 0 5 10 6 4

POLEZERO DIAGRAM 6

POLEZERO DIAGRAM 7 10 5 0 5 10 6 4 2 0 2 4 6 10 5 0 5 10 6 4

POLEZERO DIAGRAM 8

82

Page 96 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

FREQUENCY RESPONSE 1 1 0.8 0.6 0.4 0.2 0 20 1 0.8 0.6 0.4 0.2 0 20

FREQUENCY RESPONSE 2

10

10

20

10

10

20

FREQUENCY RESPONSE 3 1 0.8 0.6 0.4 0.2 0 20 1 0.8 0.6 0.4 0.2 0 20

FREQUENCY RESPONSE 4

10

10

20

10

10

20

FREQUENCY RESPONSE 5 1 0.8 0.6 0.4 0.2 0 20 1 0.8 0.6 0.4 0.2 0 20

FREQUENCY RESPONSE 6

10

10

20

10

10

20

FREQUENCY RESPONSE 7 1 0.8 0.6 0.4 0.2 0 20 1 0.8 0.6 0.4 0.2 0 20

FREQUENCY RESPONSE 8

10

10

20

10

10

20

83

Page 97 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.7.8 The gures on the next pages show a continuous-time signal x(t) and its spectrum. This signal consists of one cosine pulse followed by another. This signal is used as the input to four continuous-time LTI systems (Systems A, B, C, and D) and four output signals are obtained. The frequency responses of each of these four systems are also shown below. The last gure shows the four output signals. But the output signals are out of order. For each of the four systems, identify which signal is the output signal by completing the table below. Explain your answer. System 1 2 3 4 Output Signal

SPECTRUM of INPUT SIGNAL 2 1.5 1 0.5 0

2 3 4 FREQENCY (HERZ)

FREQUENCY RESPONSE

FREQUENCY RESPONSE

1 SYSTEM 1 SYSTEM 2 0 1 2 3 4 5 6 0.8 0.6 0.4 0.2 0

1 0.8 0.6 0.4 0.2 0 0 1 2 3 4 5 6

FREQUENCY RESPONSE 1.2 1 SYSTEM 3 SYSTEM 4 0.8 0.6 0.4 0.2 0 0 1 2 3 4 FREQUENCY (HERZ) 5 6 1.2 1 0.8 0.6 0.4 0.2 0 0 1

FREQUENCY RESPONSE

2 3 4 FREQUENCY (HERZ)

84

Page 98 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

INPUT SIGNAL 1 0.5 0 0.5 1 0 1 2 3 4 5 TIME (SECONDS) 6 7 8 9 10

OUTPUT SIGNALS 1.5 OUTPUT SIGNAL 1 1 0.5 0 0.5 1 1.5 0 1 2 3 4 5 6 7 8 9 10

1.5 OUTPUT SIGNAL 2 1 0.5 0 0.5 1 1.5 0 1 2 3 4 5 6 7 8 9 10

1.5 OUTPUT SIGNAL 3 1 0.5 0 0.5 1 1.5 0 1 2 3 4 5 6 7 8 9 10

1.5 OUTPUT SIGNAL 4 1 0.5 0 0.5 1 1.5 0 1 2 3 4 5 TIME (SECONDS) 6 7 8 9 10

85

Page 99 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.7.9 The gure shows two input signals x1 (t) and x2 (t), two impulse responses h1 (t) and h2 (t), and four output signals y1 (t), y2 (t), y3 (t), y4 (t). Identify which input signal and which impulse response causes each of the four output signals. (Your answer should have four parts, y1 (t) = h? (t) x? (t), etc.)
x1(t) x2(t)

0 h1(t)

0 h2(t)

y1(t)

y2(t)

0 y (t)
3

0 y (t)
4

86

Page 100 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.7.10 The gure shows two input signals x1 (t) and x2 (t), two impulse responses h1 (t) and h2 (t), and four output signals y1 (t), y2 (t), y3 (t), y4 (t). Identify which input signal and which impulse response causes each of the four output signals. (Your answer should have four parts, y1 (t) = h? (t) x? (t), etc.)
x1(t) x2(t)

0 h1(t)

0 h2(t)

y1(t)

y2(t)

0 y (t)
3

0 y (t)
4

87

Page 101 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.8

Fourier Series

2.8.1 Find the Fourier series coecients c(k) for the periodic signal x(t) = | cos(t)|. 2.8.2 The periodic signal x(t) is given by x(t) = | sin(t)|. (a) Sketch the signal x(t). What is its period? (b) Find the Fourier series coecients of x(t). Simplify! (c) Is x(t) band-limited? 2.8.3 Consider the signal x(t) = cos(10 t) (a) Write the Fourier series expansion of x(t). (b) Sketch the line spectrum of x(t). 2.8.4 Consider the signal x(t) = cos(12 t) cos(8 t). (a) Write the Fourier series expansion of x(t). (b) Sketch the line spectrum of x(t). 2.8.5 Find the Fourier series coecients c(k) for the periodic triangular pulse shown below. x(t)
1

d d d d d d d d d d d d d d d
4 3 2 1 0 1 2 3 4 5

2.8.6 The signal x(t) is x(t) = [cos( t)]2 sin(t). (a) Find its Fourier transform X f (). (b) Is x(t) periodic? If so, determine the Fourier series coecients of x(t). 2.8.7 The signal x(t), which is periodic with period T = 1/4, has the Fourier series coecients ck = 1 . 1 + k2

The signal is ltered with an ideal lowpass lter with cut-o frequency of fc = 5.2 Hz. What is the output of the lter? Simplify your answer so it does not contain any complex numbers. Note: = 2 f converts from physical frequency to angular frequency.

88

Page 102 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.8.8 Consider the signal x(t) = |0.5 + cos(4t)| The signal is ltered Hz. 0 f 1 H () = 0 with an ideal bandpass lter that only passes frequencies between 2.5 Hz and 3.5 || < 5 5 || 7 || > 7

(a) Sketch the input signal x(t). (b) Find and sketch the output signal y(t). Hint: Use the Fourier series, but do not compute the Fourier series of x(t).

2.9

Modulation

2.9.1 Suppose the signal x(t) has the following spectrum X(). X()
1 1

'
0 2 3

Suppose the signal x(t) is sent through the following continuous-time system.

x(t)

E g T

a(t) E

h(t)

y(t)

cos(3 t)

where the frequency response H() is an ideal low-pass, H()

'

E
0 2

(a) Sketch the spectrums (Fourier transforms) of cos(3 t), a(t), and y(t). (b) Is the total system an LTI system? 2.9.2 Suppose h(t) is the impulse response of a lowpass lter with frequency response shown.
1

H()

89

Page 103 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Suppose a new system is constructed so that its impulse response h2 (t) is given by h2 (t) = 2 cos(6 t) h(t). (a) Sketch the frequency response of the new system. (b) Is the new system a low-pass, band-pass, or high-pass lter? (c) If the signal x(t) = 2 cos (3 t) + 4 sin (6 t) is sent through the new system, what is the output y(t)?

x(t)

E h2 (t)

E y(t)

2.10

Summary

2.10.1 Consider the parallel combination of two continuous-time LTI systems.

E x(t) E

h1 (t) c j + E y(t) T

h2 (t)

You are told that the step response of the upper branch is s1 (t) = 2 u(t) + u(t 1). You observe that the impulse response of the total system is h(t) = 2 (t) + (t 2). Find and sketch h1 (t) and h2 (t). 2.10.2 Lets dene two continuous-time signals, x1 (t) = (t) + 2 (t 1) + (t 2), x2 (t) = (t) + 3 (t 1) + 3 (t 2) + (t 3). (a) It turns out x2 (t) can be written as x2 (t) = x1 (t) f (t). What is f (t)? (b) When x1 (t) is applied to some continuous-time LTI system, the following output signal y1 (t) is observed.
2

y1 (t) r rr rr 1 0 1 2 3 4 5

90

Page 104 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Sketch the output signal y2 (t) that results when x2 (t) is applied to the same system. 2.10.3 When the signal x(t) x(t) = sin(10 t) is applied as the input to an unknown continuous-time system, the observed output signal y(t) is y(t) = u(t) u(t 2). Which of the following statements is true? Given an explanation for your choice. (a) The system is LTI. (b) The system is not LTI. (c) There is not enough information to decide. 2.10.4 The output y(t) of a continuous-time LTI system is given by y(t) = 3 x(t) x(t 1.5) + x(t 2) where x(t) is the input to the system. (a) What is the impulse response h(t) of this system? (b) What is the transfer function H(s) of this system? 2.10.5 2.10.6 Two continuous-time LTI systems have the following impulse responses h1 (t) = e2 t u(t) h2 (t) = e3 t u(t)

(a) If the two systems are connected in parallel,

x(t) -

h1 (t) ? j + - y(t) 6

h2 (t)

What is the frequency response of the total system? What dierential equation describes this system? (b) If the two systems are connected in series,

x(t)

h1 (t)

h2 (t)

y(t)

What is the frequency response of the total system? What dierential equation describes this system?

91

Page 105 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.10.7 The impulse response of a continuous-time LTI is given by h(t) = u(t) u(t 2). Find the output y(t) when the input x(t) is given by x(t) = t u(t). Classify the system as BIBO stable/unstable. 2.10.8 Consider the cascade of two causal continuous-time LTI systems.

H1 (s)

H2 (s)

You are told that the rst system is described by the dierential equation y + 2 y = x. You observe that the step response of the total system is s(t) = e2t u(t) 2 et u(t) + u(t). Find and sketch the impulse response of the second system. 2.10.9 Consider the following connection of two continuous-time LTI systems.

E+ E i T

h1 (t)

h2 (t)

'

You are told that h1 (t) = et u(t), h2 (t) = 2 e4t u(t).

Find the impulse response h(t) of the total system. 2.10.10 The frequency response of a continuous-time LTI system is given by H f () = 2 ej . (a) Find and sketch the impulse response h(t). (b) Sketch the output of this system when the input is

x(t) =
k=

(t 4 k).

92

Page 106 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.10.11 Suppose the impulse response of a continuous-time LTI system has the form h(t) = B e3t sin(5 t) u(t). Suppose a signal x(t) with the form x(t) = A cos(10 t 0.5 ) u(t) is applied to the system. What is the generic form of the output signal? 2.10.12 Consider a causal continuous-time LTI system described by the dierential equation y (t) + 5 y (t) + 4 y(t) = 3 x (t) + 2 x(t). (a) Find the transfer function H(s) and its region of convergence, and sketch the pole-zero diagram for this system. (b) When the input signal is x(t) = 3 et cos(2 t) u(t) nd the generic form of the output signal y(t). (I mean that you do not have to compute the residue of the partial fraction expansion; you may leave them as A, B, etc.) 2.10.13 The impulse response of a continuous-time LTI system is given by h(t) = e3 t sin(2t) u(t). Suppose the input signal is given by x(t) = et u(t). (a) Without doing any arithmetic, write down the form you know the output signal y(t) must take. (b) Find the transfer function. (c) Find the dierential equation that represents this system. (d) Find the frequency response H f () of this system. (e) Sketch the pole diagram of the system. 2.10.14 A continuous-time LTI system has the following impulse response:
1

h(t) 1 0 1 2 3

The signal x(t) = 4 + 3 cos(2 t) is sent through the system.

x(t)

h(t)

E y(t)

93

Page 107 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(a) Sketch x(t). (b) Find and sketch the output y(t). 2.10.15 Consider the cascade connection of two continuous-time LTI systems

x(t)

SYS 1

SYS 2

y(t)

with impulse responses h1 (t) = 4 e2t cos(5 t) u(t) h2 (t) = 5 e3t u(t) (a) Sketch the pole diagram of the two transfer functions H1 (s), H2 (s), (b) Sketch the pole diagram of the transfer function of the total system Htot (s). (c) Which form can the total impulse response htot (t) take? (Choose all that apply.) 1) 2) 3) 4) 5) 6) A e2t u(t) + B e3t u(t) + C cos(5 t + ) u(t) A e5t cos(5 t + ) u(t) A e3t cos(5 t + ) u(t) + B e2t u(t) A e2t cos(5 t + ) u(t) + B e3t u(t) A e2t cos(5 t + 1 ) u(t) + B e3t cos(5 t + 2 )u(t) A e2t cos(5 t + 1 ) u(t) + B e3t cos(5 t + 2 )u(t) + C e2t u(t) + D e3t u(t)

2.10.16 Suppose the impulse response of a continuous-time LTI system is h(t) = 3 et u(t) and the signal x(t) = 2 cos(t) u(t) is applied to the system. Find the steady-state output. (First nd H f ().) 2.10.17 The frequency response of a continuous-time LTI lter is given by 2, || 2 1, 2 < || 4 H f () = 0, 4 < ||.
2

H f ()


4 2 0 2 4

Find the impulse response h(t).

94

Page 108 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2.10.18 Suppose a tape recording is made with an inferior microphone which has the frequency response H f () = 1 0,
|| W ,

|| < W || W,

where W = 1200 (600 Hz). (a) What is the frequency response of the system you would use to compensate for the distortion caused by the microphone? Make a sketch of your frequency response and explain your answer. (b) Suppose you wish to digitally store a recording that was made with this microphone. What sampling rate would you use? Give your answer in Herz. 2.10.19 A continuous-time LTI system H(s) is described by the dierential equation y + 2 y + y = x. You are considering the design of an LTI system G(s) that inverts H(s). (a) Find the frequency response Gf () of the inverse system. (b) Find and sketch |Gf ()|. (c) Bonus: Why will it be dicult to implement G(s) exactly? 2.10.20 Which of the following diagrams shows the frequency response of an elliptic lter? (Recall the Matlab exercise on lter design.)
|Hf ()| 1 |Hf ()| 2

1 0.8 0.6 0.4 0.2 0 5 0 |Hf ()| 3 5

1 0.8 0.6 0.4 0.2 0 5 0 5

1 0.8 0.6 0.4 0.2 0 5 0 5

Also identify the Chebyshev-I lter and the Butterworth lter.

95

Page 109 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

The Sampling Theorem


X() = 0 for || 8 .

3.0.1 The Fourier transform of a signal x(t) satises

What is the maximum sampling period T such that x(t) can be recovered from the samples x(nT )? 3.0.2 For the following continuous-time system x(t) E g T s (t) a(t) E h(t) y(t)

the input to the lter h(t) is the product of x(t) and s (t): a(t) = x(t) s (t) and the impulse train is given by

s (t) =
n=

(t n Ts )

where the sampling period is Ts = 2 . 3

The frequency response H() is an ideal low-pass, 1 2 Suppose the input signal is x(t) = 4 cos(6 t). (a) Sketch the spectrums (Fourier transforms) of x(t), s (t), a(t), and y(t). (b) Find and sketch a(t) and y(t). (c) Does y(t) = x(t)? Does this contradict the sampling theorem? Explain. 3.0.3 For the following continuous-time system 0 H() 2

x(t)

E a(t) E g T T (t)

h(t)

y(t)

96

Page 110 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

the input to the lter h(t) is the product of x(t) and T (t): a(t) = x(t) T (t) and the impulse train is given by

T (t) =
n=

(t n T ).

The lter h(t) is not an ideal low-pass lter. Instead, its frequency response H() is T
6

H() e e e
6

'
12

E
12

What is the slowest sampling rate such that y(t) = x(t) when . . . (a) the spectrum of the signal x(t) satises X() = 0 for || 6 .

(b) when the spectrum of the signal x(t) satises X() = 0 for || 4 .

Express the sampling rate in samples/sec.

97

Page 111 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

EE 3054: Signals, Systems, and Transforms Additional Notes for the MATLAB Lab

Page 112 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Notes on Partial Fraction Expansion in Matlab


The Matlab command residue allows one to do partial fraction expansion.
>> help residue RESIDUE Partial-fraction expansion (residues). [R,P,K] = RESIDUE(B,A) finds the residues, poles and direct term of a partial fraction expansion of the ratio of two polynomials B(s)/A(s). If there are no multiple roots, B(s) ---A(s) = R(1) s - P(1) R(2) s - P(2) R(n) s - P(n) The residues -------- + -------- + ... + -------- + K(s)

Vectors B and A specify the coefficients of the numerator and denominator polynomials in descending powers of s. vector P, and the direct terms in row vector K. are returned in the column vector R, the pole locations in column The number of poles is n = length(A)-1 = length(R) = length(P). The direct term coefficient vector is empty if length(B) < length(A), otherwise length(K) = length(B)-length(A)+1. If P(j) = ... = P(j+m-1) is a pole of multiplicity m, then the expansion includes terms of the form R(j) s - P(j) R(j+1) (s - P(j))^2 R(j+m-1) + ... + -----------(s - P(j))^m -------- + ------------

[B,A] = RESIDUE(R,P,K), with 3 input arguments and 2 output arguments, converts the partial fraction expansion back to the polynomials with coefficients in B and A. See also POLY, ROOTS, DECONV.

Page 113 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

To perform partial fraction expansion on T (z) T (z) = we enter the following Matlab commands. >> num = [4 1]; >> den = [1 -1 -2]; >> [r,p,k] = residue(num,den) z2 4z + 1 z2

r = 3 1

p = 2 -1

k = [] This tells us that, T (z) = 1 3 + . z2 z+1

Page 114 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

The residue command also works when some poles are complex. For example, to nd the partial fraction expansion of X(z) X(z) = 2 z3 4z + 3 3.4 z 2 + 1.98 z 0.406

we can use the following Matlab commands. >> num = [4 3]; >> den = [2 -3.4 1.98 -0.406]; >> [r,p,k] = residue(num,den)

r = 36.2500 -18.1250 +13.1250i -18.1250 -13.1250i

p = 0.7000 0.5000 + 0.2000i 0.5000 - 0.2000i

k = [] This tells us that, X(z) = 18.125 + 13.125i 18.125 13.125i 36.25 + + . z 0.7 z (0.5 + 0.2i) z (0.5 0.2i)

Notice that the residues and poles appear in complex-conjugate pairs. In fact, this is always the case when the coecients in X(z) are real.

Page 115 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Here is an example with a repeated pole. To perform partial fraction expansion on T (z) T (z) = we enter the following Matlab commands. >> num = [2 1]; >> den = [1 5 8 4]; >> [r,p,k] = residue(num,den) z3 2z + 1 + 5z 2 + 8z + 4

r = 1.0000 3.0000 -1.0000

p = -2.0000 -2.0000 -1.0000

k = [] This tells us that, T (z) = 3 1 1 + + 2 z + 2 (z + 2) z+1

Page 116 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

The residue command also works in the other direction. To write G(z), G(z) = 6 7 5 + z 3 z + 4 z + 1/5

as the ratio of two polynomials we can use the following commands. >> r = [5 6 -7]; >> p = [3 -4 -1/5]; >> [num,den] = residue(r,p,[])

num =

4.0000

-2.8000

84.4000

den =

1.0000

1.2000

-11.8000

-2.4000 4z 2 2.8 z + 84.4 . z 3 + 1.2z 2 11.8z 2.4

This tells us that G(z) =

The argument k is needed only when the degree of the numerator is greater than or equal to the degree of the denominator, so it was not needed for these examples.

Page 117 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

In this example, the degree of the numerator is greater than the degree of the denominator, so k is required. X(z) = 3 z 4 1.1 z 3 + 0.88 z 2 2.396 z + 1.348 z 3 0.7 z 2 0.14 z + 0.048

The partial fraction expansion of X(z) can be found using the following Matlab commands. >> num = [3 >> den = [1 -1.1 -0.7 0.88 -0.14 -2.396 0.048]; 1.348];

>> [r,p,k] = residue(num,den)

r = 1.0000 4.0000 -3.0000

p = 0.8000 -0.3000 0.2000

k = 3.0000 1.0000

This tells us that X(z) = 3 z + 1 + 4 3 1 + z 0.8 z + 0.3 z 0.2

Page 118 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Notes on Recursive Digital Filters


A recursive digital lter is an LTI system based on a dierence equation of the form:
N M

y(n) =
k=1

a(k) y(n k) +
k=0

b(k) x(n k)

(1)

A system described by this type of dierence equation is called an IIR (Innite Impulse Response) lter, a recursive lter, or an autoregressive moving-average (ARMA) lter. The output y(n) of the lter can be written as

y(n) =
k=0

h(k) x(n k).

(2)

The transfer function of the system H(z) can be written as

H(z) =
k=0

h(k) z k .

(3)

The frequency response is given by

H () = H(e ) =
n=0

h(n) ej .

(4)

The transfer function can also be written in terms of the dierence equation coecients as H(z) = or H(z) = where B(z) =
n=0 N M

b0 + b1 z 1 + b2 z 2 + + bM z M 1 + a1 z 1 + a2 z 2 + + aN z N B(z) A(z) b(n) z n

(5)

(6)

(7)

A(z) = 1 +
n=1

a(n) z n .

(8)

Computing h(n). Given the dierence equation coecients a(k) and b(k), the impulse response h(n) can be obtained by taking the inverse Z-transform of H(z), but it is usually simpler to calculate h(n) numerically by running the dierence equation with the input x(n) = (n). The Matlab function filter implements a recursive dierence equation. The following code fragment computes the rst 30 values of h(n) from a(k) and b(k). 8

Page 119 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

x = [1, zeros(1,29)]; h = filter(b,a,x); where the vectors b and a contain the lter parameters b = [b(0), b(1), . . . , b(M )] a = [a(0), a(1), . . . , a(N )] (9) (10)

Computing H f () [H(ej )]. The frequency response can be calculated with the Matlab command freqz, which uses the FFT (Fast Fourier Transform). The following code, filt1.m, illustrates how to use these commands to display the frequency response and impulse response of a digital lter. This code is available of the class web page.
b = [0.0931 a = [1.0000 0.0960 -1.5757 0.1801 2.2408 0.1801 -1.5554 0.0960 0.8123 0.0931]; -0.1837];

% ------ Plot frequency response magnitude --subplot(3,1,1) [H,w]=freqz(b,a,2^10); plot(w/pi,abs(H)) axis([0 1 0 1.2]) xlabel(\omega/\pi) ylabel(|H(e^{j \omega})|) % ------ Plot frequency response in dB ------subplot(3,1,2) plot(w/pi,20*log10(abs(H))) axis([0 1 -60 10]) xlabel(\omega/\pi) ylabel(|H(e^{j \omega})| in dB) % ------ Plot impulse response h(n) ---------subplot(3,1,3) N = 30; im = [1 zeros(1,N-1)]; h = filter(b,a,im); stem(0:N-1,h,.) xlabel(n) ylabel(h(n)) axis([-1 30 -0.2 0.6])

This code produces the following gure.

Page 120 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1 |H(ej )| 0.5 0

0.2

0.4

0.6

0.8

|H(ej )| in dB

0 20 40 60 0 0.2 0.4 0.6 0.8 1

0.4 h(n) 0.2 0 0.2 0 10 n 20 30

Because the ideal low-pass lter can not be implemented, it is necessary to settle for an approximation to it. The problem of digital lter design is choose coecients a(k), b(k), so that the frequency response of the lter H f () matches a desired target function. A good approximation to the ideal low-pass lter is the elliptic lter, also called the Cauer lter. The coecients a(k), b(k) of elliptic lters can be obtained with the Matlab command ellip. (It is part of the signal processing toolbox.) Here is the beginning of the help le for this command.
ELLIP Elliptic or Cauer digital and analog filter design. [B,A] = ELLIP(N,Rp,Rs,Wn) designs an Nth order lowpass digital elliptic filter with Rp decibels of ripple in the passband and a stopband Rs decibels down. ELLIP returns the filter coefficients in length N+1 vectors B (numerator) and A (denominator). The cut-off frequency Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding to half the sample rate. Use Rp = 0.5 and Rs = 20 as starting points, if you are unsure about choosing them.

The meaning of Rp and Rs is given by p = 1 10Rp /20 s = 10Rs /20 10 (11) (12)

Page 121 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

and Rp = 20 log10 (1 p ) Rs = 20 log10 (s ) (13) (14)

where p represents the size of the ripple in the pass-band, and s represents the size of the ripple in the stop-band. Rp , and Rs are just p and s in decibels. The pass-band ripple size p is the maximum deviation of the actual frequency response from 1 in the pass-band. The stop-band ripple size s is the maximum deviation of the actual frequency response from 0 in the stop-band. The Matlab lter design commands use a somewhat non-standard convention for specifying the cuto frequency c . For example, if you want to design a discrete-time lter with cut-o frequency at c = 0.4 , then you should set Wn = 0.4 when using the ellip command. The same is true for the other Matlab digital lter design commands. By the way, this assumes that the sampling period is 1 second. That is, the values x(n) are obtained from sampling a continuous-time signal once each second. If the sampling period (call it Ts ) is dierent from 1 second, and you want to design a digital lter with cut-o frequency at Fo Hz. Then you should take Wn = 2*Fo/Fs. Here Fs is the sampling frequency in Herz, Fs = 1/Ts . For example, suppose we sample an analog signal with a sampling rate of 100 Hz and we want to design a digital lter with a cut-o frequency of 30 Hz. Here are the Matlab commands to set up the design parameters, call the function, and plot the frequency response versus frequency in Herz.
Ts = 0.01; Fs = 1/Ts Fo = 30; Wn = 2*Fo/Fs; % Sampling Period Ts = 0.01 seconds % Sampling frequency Fs = 100 Hz % Cut-Off frequency Fo = 30 Hz % Normalize the cut-off frequency

dp = 0.01; ds = 0.01; N = 5; Rp = -20*log10(1-dp); Rs = -20*log10(ds); [b,a] = ellip(N,Rp,Rs,Wn); figure(1), clf % Plot frequency response magnitude [H,w] = freqz(b,a); plot(w/pi*Fs/2,abs(H)) % rescale frequency axis appropriately. axis([0 Fs/2 0 1.2]) xlabel(FREQUENCY (Hz)) ylabel(FREQUENCY RESPONSE) grid orient portrait

11

Page 122 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

print -deps filt2

1.2

FREQUENCY RESPONSE

0.8

0.6

0.4

0.2

10

15

20 25 30 FREQUENCY (Hz)

35

40

45

50

12

Page 123 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Notes on Stable Inverses of Discrete-Time LTI Systems


Suppose the signal x(n) represents binary data that is to be transmitted.
2 x(n) 1 0 1 0 20 40 60 80 100 120 140 160 180 200

However, the channel over which x(n) is transmitted introduces some distortion. The signal r(n) that is received is changed.
2 r(n) 1 0 1 0 20 40 60 80 100 120 140 160 180 200

In this example, the channel can be modeled as an LTI system described by the dierence equation r(n) 11 r(n 1)/20 r(n 2)/5 = x(n)/10 + 7 x(n 1)/30 + 2 x(n 2)/30 where r(n) represents the received signal. Equivalently, the channel can be modeled by the transfer function H(z) = 1 1 + 7 z 1 + 2 z 2 3 3 , 1 10 1 11 z 1 5 z 2 20 1 z2 + 7 z + 2 3 3 , 10 z 2 11 z 1 20 5 (15) (16)

H(z) = or equivalently by its impulse response:


0.4 h(n) 0.2 0 0.2

10

12

14

16

18

20

Dene G(z) := 1 . H(z) (17)

13

Page 124 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Then G(z) = 10

z 2 11 z 1 20 5 2 . z2 + 7 z + 3 3

(18)

A causal system with the transfer function G(z) can be implemented by the dierence equation y(n)/10 + 7 y(n 1)/30 + 2y(n 2)/30 = r(n) 11 r(n 1)/20 r(n 2)/5 where r(n) represents the input to the system and y(n) represents the output of the system. This system can be implemented in a causal fashion by writing the dierence equation as y(n) = 10 r(n) 11 r(n 1)/2 2 r(n 2) 7 y(n 1)/3 2 y(n 2)/3. However, when this is done, the signal y(n) that you obtain is:
2 y(n) 1 0 1 0 20 40 60 80 100 120 140 160 180 200

Because the causal implementation of this dierence is unstable, the signal blows up after a short while. In order to obtain a stable inverse for the system H(z), we need to be more careful. Let us nd a partial fraction expansion of G(z)/z 10z 2 11 z 2 G(z) 2 = 3 7 2 2 z z + 3z + 3z We can use Matlab to help with the partial fraction expansion. >> [r,p,k] = residue([10 -11/2 -2],[1 7/3 2/3 0]) r = 14.7000 -1.7000 -3.0000 p = -2.0000 -0.3333 0 k = [] 14 (19)

Page 125 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Therefore, we have 14.7 1.7 3 G(z) = + + z z + 2 z + 1/3 z or G(z) = and g(n) = 14.7 (2)n u(n) or 14.7 (2)n u(n 1) 14.7 z 1.7 z + 3 z+2 z + 1/3 1.7 (1/3)n u(n) or 1.7 (1/3)n u(n 1) (21) (20)

3 (n).

Consider the rst component the causal signal 14.7 (2)n u(n) grows without bound:
14.7 (2)n u(n) 100 50 0 50 100 5 0 5

On the other hand, the noncausal signal 14.7 (2)n u(n 1) decays:
14.7 (2)n u(n1) 10 5 0 5 10 5 0 5

To obtain a stable system, we must choose the noncausal form for this component. Consider the second component the causal signal 1.7 (1/3)n u(n) decays:
1.7 (1/3)n u(n) 2 1 0 1 2 5 0 5

On the other hand, the noncausal signal 1.7 (1/3)n u(n 1) grows without bound: 15

Page 126 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

1.7 (1/3)n u(n1) 100 50 0 50 100 5 0 5

To obtain a stable system, we must choose the causal form for this component. Therefore, to obtain a stable system, the impulse response g(n) must be given by g(n) = 14.7 (2)n u(n 1) 1.7 (1/3)n u(n) 3 (n). This impulse response g(n) is shown in the gure.
10 g(n) (STABLE) 5 0 5 10 10 8 6 4 2 0 2 4 6 8 10

(22)

For an inverse system, it is required that h(n) g(n) = (n). We can verify this by numerically convolving the two functions.
1 0.5 0 0.5 10

h(n) conv g(n)

10

We can now recover x(n) from r(n) by using the LTI system with impulse response g(n). Note that even though g(n) is noncausal, for n < 10, the values of g(n) are very small and for practical purposes can be set to zero. If they are set to zero, then the shifted signal g(n 10) will be causal. So you can dene a causal system with impulse response gc (n): g(n 10) n 0 gc (n) := 0 n<0 or more compactly as gc (n) := g(n 10) u(n). 16 (24)

(23)

Page 127 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

This is shown in the gure:


gc(n) (STABLE and CAUSAL)

10 5 0 5 0 2 4 6 8 10 12 14 16 18 20

10

The signal gc (n) is a good approximation to g(n) because the values of g(n) that are lost due to truncation are close to zero. Using the causal stable system gc (n) to lter the received signal r(n) gives:
2 1 x(n) and y2(n) 0

1 2 3

20

40

60

80

100

120

140

160

180

200

The top signal is x(n). The lower signal is y2 (n), obtained by convolving r(n) with gc (n). Notice that y2 (n) is almost the same as x(n) except for a delay of 10 samples. Therefore, we can get a stable near-inverse of the channel if we allow for some delay. The following Matlab code, used for this problem, can be found on the course webpage.
% generate a data signal (dont worry about understanding this command) x = kron(round(rand(1,40)),ones(1,5)); % ------ Plot data signal -----figure(1) subplot(4,1,1), plot(x), ylabel(x(n)) axis([0 200 -1 2]) % ------ Define System I -----b = [1 +7/3 2/3]*(1/10); a = [1 -11/20 -4/20]; r = filter(b,a,x);

17

Page 128 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

% r(n) is the distorted version of x(n) subplot(4,1,2), plot(r), ylabel(r(n)) y = filter(a,b,r); % y(n) is what you get when you try the "simple" thing. % The "simple" thing is to reverse the difference equation. subplot(4,1,3), plot(y), ylabel(y(n)) % --> the "simple" thing is unstable!

im = [1 zeros(1,100)]; h = filter(b,a,im);

% define impulse signal % impulse response of System I

% ------ Let G(z) = 1/H(z) -----% ------ Compute partial fraction expansion of G(z)/z -----[R,P,K] = residue([10 -11/2 -2],[1 7/3 2/3 0]); % % R = % 14.7000 % -1.7000 % -3.0000 % % P = % -2.0000 % -0.3333 % 0 % % K = % [] % so g(n) = -14.7 (-2)^n u(-n-1) - 1.7 (-1/3)^n u(n) - 3 delta(n) % ------ create stable signal g(n) corresponding to G(z) -----n = -10:10; g1 = -14.7 .* (-2).^n .* (-n-1>=0); g2 = -1.7 .* (-1/3).^n .* (n>=0); g3 = -3*(n==0); g = g1 + g2 + g3; % ------ plot h(n) and stable g(n) -----% ------ also plot h(n) convolve g(n) ---figure(2) subplot(4,1,1), stem(h,.), ylabel(h(n)) subplot(4,1,2), stem(g,.), ylabel(stable g(n)) chck = conv(h,g); subplot(4,1,3), stem(chck,.), ylabel(h(n) conv g(n)) % ------ send r(n) through the system G(z) ------

18

Page 129 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

y2 = conv(r,g); figure(1) subplot(4,1,4), plot(y2); ylabel(y_2(n)) axis([0 200 -1 2]) % ------ plot x(n) and recovered signal y2(n) ---% ------ on same graph -----figure(3) k = 1:200; plot(k,x(k),k,y2(k)-2) axis([0 200 -3 2]) ylabel(x(n) and y_2(n)) % notice that y2(n) is a delayed version of x(n) % ---> with a delay we can get x(n) back from y(n) using % a STABLE system.

19

Page 130 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 1: Introduction to Matlab


1. Creating vectors (a) Generate the following vectors: A = [1 0 4 5 3 9 0 2] a = [4 5 0 2 0 0 7 1] Be aware that Matlab are case sensitive. Vector A and a have dierent values. (b) Generate the following vectors: B = [A a] C = [a,A] Concatenation is the process of joining small matrices to make bigger ones. In fact, you made your rst matrix by concatenating its individual elements. The pair of square brackets, [], is the concatenation operator. (c) Generate the following vectors using function zeros and ones: D = [0 0 0 . . . 0] with fty 0s. E = [1 1 1 . . . 1] with a hundred 1s. (d) Generate the following vectors using the colon operator F = [1 2 3 4 . . . 30] G = [25 22 19 16 13 10 7 4 1] H = [0 0.2 0.4 0.6 . . . 2.0] The colon, :, is one of Matlabs most important operators. 2. Operate with the vectors V1 = [1 2 3 4 5 6 7 8 9 0] V2 = [0.3 1.2 0.5 2.1 0.1 0.4 3.6 4.2 1.7 0.9] V3 = [4 4 4 4 3 3 2 2 2 1] (a) Calculate, respectively, the sum of all the elements in vectors V1, V2, and V3. (b) How to get the value of the fth element of each vector? What happens if we execute the command V1(0) and V1(11)? Remember if a vector has N elements, their subscripts are from 1 to N.

Page 131 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(c) Generate a new vector V4 from V2, which is composed of the rst ve elements of V2. Generate a new vector V5 from V2, which is composed of the last ve elements of V2. (d) Derive a new vector V6 from V2, with its 6th element omitted. Derive a new vector V7 from V2, with its 7th element changed to 1.4. Derive a new vector V8 from V2, whose elements are the 1st, 3rd, 5th, 7th, and 9th elements of V2 (e) What are the results of 9-V1 V1*5 V1+V2 V1-V3 V1.*V2 V1*V2 V1.^2 V1.^V3 V1^V3 V1 == V3 V1>6 V1>V3 V3-(V1>2) (V1>2) & (V1<6) (V1>2) | (V1<6) any(V1) all(V1)

Page 132 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

3. Using Matlab help system, click on Help -> MATLAB help or type helpdesk to can open the help les. For description of a single function or command, type help command_name on the command line, or use search in the help window. For example, type help plot on the command line. 4. Flow control What are the results of these sets of commands? Think them over and run them with Matlab to see if you are right. (a) A = zeros(1,5); for n = 1:4 for m = 1:3 A = A + n*m; end end A (b) B = [1 0]; if (all(B)) B = B + 1; else if (any(B)) B = B + 2; else B = B + 3; end B 5

Page 133 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(c) C = 7:2:22 num = 0; while (all( C>0)) C = C - 3; num = num + 1; end C num (b) Situations under which loops can be avoided. Does the set of commands: for i = 1:20 H(i) = i * 5; end have the same result as: H = 1:20; H = H*5; Does the set of commands: for n = 1:100000 x(n) = sin(n*pi/10); end have the same result as: n = 1:100000; x = sin(n*pi/10); 5. Compare a script and a function (a) Write a script: In the main menu of Matlab, select file -> new -> M-file A new window will pop up. Input the following commands:

Page 134 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

x = 1:5; y = 6:10; g = x+y; and then save the le as myscript.m under the default path matlab/work (b) Write a function: Create a new m le following the procedure of above. Type in the commands: function g = myfunction(x,y) g = x + y; and then save it as myfunction.m (c) Compare their usage (1) run the commands one by one: myscript x y g z = myscript (error?)

(2) Run command clear to remove all variables from memory (3) Run the commands one by one: x = 1:5; y = 6:10; myfunction (error?)

z = myfunction(x,y) g a = 1:10; b = 2:11; myfunction(a,b) Can you explain what is going on here? (error?)

Page 135 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 2: Basic Plotting of Signals


Using MATLAB, make plots of the signals below. Put your code in a Matlab script le so you can rerun it from the Matlab command after you make revisions to your le. Use the subplot command to put several plots on the same page. Print out the plots and turn them in with your code. Use help subplot to nd out how to use the command. Use the plot command to plot continuous-time signals. Use the stem command to plot discretetime signals. Use help plot and help stem to nd out how to use these commands. Our convention is that f (t) denotes a continuous-time signal, and that f (n) denotes a discrete-time signal.

1. Plotting Continuous-Time Signals For the following: Run the following three lines and explain why the plots are dierent. t = 0:2*pi; plot(t,sin(t)) t = 0:0.2:2*pi; plot(t,sin(t)) t = 0:0.02:2*pi; plot(t,sin(t)) For the last graph, add a title and axis labels with: title(My Favorite Function) xlabel(t (Seconds)) ylabel(y(t)) Change the axis with: axis([0 2*pi -1.2 1.2]) Put two plots on the same axis: t = 0:0.2:2*pi; plot(t,sin(t),t,sin(2*t)) Produce a plot with out connecting the points: t = 0:0.2:2*pi; plot(t,sin(t),.) Try the following command: t = 0:0.2:2*pi; plot(t,sin(t),t,sin(t),r.) What does the r do?

Page 136 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

2. Plotting Discrete-Time Signals Use stem to plot the discrete-time step-function: n = -10:10; f = n >= 0; stem(n,f) Make stem plots of the following signals. Decide for yourself what the range of n should be. f (n) = u(n) u(n 4) g(n) = n u(n) 2 (n 4) u(n 4) + (n 8) u(n 8) x(n) = (n) 2 (n 4) y(n) = (0.9)n (u(n) u(n 20)) v(n) = cos(0.12 n) u(n)

3. The conv Command Use help conv to nd out how to use the conv command. Let f (n) = u(n) u(n 4) g(n) = n u(n) 2 (n 4) u(n 4) + (n 8) u(n 8). Make stem plots of the following convolutions. Use the MATLAB conv command to compute the convolutions. (a) f (n) f (n) (b) f (n) f (n) f (n) (c) f (n) g(n) (d) g(n) (n) (e) g(n) g(n) Comment on your observations: Do you see any relationship between f (n) f (n) and g(n) ? Compare f (n) with f (n) f (n) and with f (n) f (n) f (n). What happens as you repeatedly convolve this signal with itself? Use the commands title, xlabel, ylabel to label the axes of your plots.

Page 137 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

4. Plotting a Sampled-Signal. Suppose the continuous-time signal x(t) is sampled with a sampling period of 0.3 seconds between each sample. Suppose also that the rst sample is at t = 0 and that a total of 12 samples are collected. The table below lists the samples of x(t) that were collected. sample number 0 1 2 3 4 5 6 7 8 9 10 11 x(t) 6.0 -1.3 -8.0 -11.7 -11.0 -6.0 1.3 8.0 11.7 11.0 6.0 -1.3

Using the plot command, make a plot of this signal. The horizontal axis should be labeled: TIME (SECONDS). Make sure that the horizontal time axis shows the correct time for each sample: 0, 0.3, 0.6, . . . , 3.3.

10

Page 138 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 3: Smoothing Data and Dierence Equations


1. Convolution of Non-Causal Signals Use Matlab to make stem plots of the following signals. Decide for yourself what the range of n should be. Note that both of these signals start to the left of n = 0. f (n) = 3 (n + 2) (n 1) + 2 (n 3) g(n) = u(n + 4) u(n 3) Next, use Matlab to make a stem plot of x(n) = f (n) g(n). Also: plot the signals by hand without relying on Matlab and check that you get the same result as your Matlab plot (not to turn in). To turn in: The plots of f (n), g(n), x(n), and your Matlab commands to create these signals and plots.

2. Smoothing Data Save the data le DataEOG.txt from the course website. Load the data into Matlab using the command load DataEOG.txt Type whos to see your variables. One of the variables will be DataEOG. For convenience, rename it to x by typing: x = DataEOG; This signal comes from measuring electrical signals from the brain of a human subject. Make a stem plot of the signal x(n). You will see it doesnt look good because there are so many points. Make a plot of x(n) using the plot command. As you can see, for long signals we get a better plot using the plot command. Although discrete-time signals are most appropriately displayed with the stem command, for long discrete-time signals (like this one) we use the plot command for better appearance. Create a simple impulse response for an LTI system: h = ones(1,11)/11; Make a stem plot of the impulse response. Find the output signal y(n) of the system when x(n) is the input (using the conv command). Make plot of the output y(n). (a) What is the eect of the convolution in this example? (b) How is the length of y(n) related to the length of (n) 11

Page 139 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(c) Plot x(n) and y(n) on the same graph. What problem do you see? Can you get y(n) to line up with x(n)? (d) Use the following commands: y2 = y; y2(1:5) = []; y2(end-4:end) = []; What is the eect of these commands? What is the length of y2? Plot x and y2 on the same graph. What do you notice now? (e) Repeat the problem, but use a dierent impulse response: h = ones(1,31)/31; What should the parameters in part (d) be now? (f) Repeat the problem, but use h = ones(1,67)/67; What should the parameters in part (d) be now? Comment on your observations. To turn in: The plots, your Matlab commands to create the signals and plots, and discussion.

3. Dierence Equations Suppose a system is implemented with the dierence equation: y(n) = x(n) + 2 x(n 1) 0.95 y(n 1) Write your own Matlab function, mydiffeq, to implement this dierence equation using a for loop. (Type help for to see how to use the for loop.) If the input signal is N -samples long (0 n N 1), your program should nd the rst N sample of the output y(n) (0 n N 1). Remember that Matlab indexing starts with 1, not 0, but dont let this confuse you. Use x(1) = 0 and y(1) = 0. To see how to write a Matlab function see the Matlab Getting Started Guide. This tutorial to Matlab is very useful. It is available on the web see the link on the course webpage. (a) Is this system linear? Use your Matlab function to conrm your answer: y1 = mydiffeq(x1) 12

Page 140 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

y2 = mydiffeq(x2) y3 = mydiffeq(x1+2*x2) Use any signals x1, x2 you like. (b) Is this system time-invariant? Conrm this in Matlab (how?). (c) Compute and plot the impulse response of this system. Use x = [1, zeros(1,100)]; as input. (d) Dene x(n) = cos( n/8) [u(n) u(n 50)]. Compute the output of the system in two ways: (1) y(n) = h(n) x(n) using the conv command. (2) Use your function to nd the output for this input signal. Are the two output signals you compute the same? (e) Write a new Matlab function for the system with the dierence equation: y(n) = x(n) + 2 x(n 1) Find and plots the impulse response of this system. What is the dierence between the two impulse responses? (f) Write a new Matlab function for the system with the dierence equation: y(n) = x(n) + 2 x(n 1) 1.1 y(n 1) Find and plots the impulse response of this system. What do you nd? Discuss your observations. To turn in: The plots, your Matlab commands to create the signals and plots, and discussion.

13

Page 141 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 4: Complex Poles


Before you begin this lab, please read the notes on Partial Fraction Expansion. These notes show how to use the Matlab residue command. Given the transfer function H(z) of a causal discrete-time LTI system, how do you nd the impulse response h(n)? In this lab, we cover three ways get the impulse response from the transfer function. For the following problems, please use the following transfer function, H(z) = 1 2.5 z 1 + z 2 . 1 z 1 + 0.7 z 2

1. What is the dierence equation that implements this system? In Lab 3 you wrote a Matlab function that implements a dierence equation. Modify that function so that it implements the dierence equation for the system considered here. Use your new program to numerically compute the impulse response of this system. Once you have computed the impulse response, make a stem plot of it. By the way, Matlab has a built in command filter that implements a dierence equation. Use the help command to nd out how to use the filter command. Use the filter command to compute the impulse response. Does it agree with the one computed using your own program? (It should!) 2. A second way to get h(n) from H(z) is to use partial fraction expansion. Partial fraction expansion can be performed in Matlab with the residue command. Use this command to perform partial fraction expansion on H(z)/z. Then you can write the impulse response as h(n) = C1 pn u(n) + C2 pn u(n). 2 1 (1)

The four values C1 , C2 , p1 , p2 are found using the residue command. For this example they will be complex! Use Equation (1) to compute in Matlab the impulse response, n = -5:30; h = C1 * p1.^n .* (n>=0) + ... Note that even though C1 , C2 , p1 , p2 are complex, the impulse response h(n) is real-valued. (The imaginary parts cancel out.) Is this what you nd? Make a stem plot of the impulse response you have computed using Equation (1). Verify that the impulse response is the same as the one you computed in the previous part. 3. In this part you are to write a formula for the impulse response that does not involve complex numbers. The impulse response you have found can also be written as h(n) = A rn cos(o n + o ) u(n). 14 (2)

Page 142 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

This is a damped sinusoid. This formula is obtained from Equation (1) by putting the complex values C1 , C2 , p1 , p2 into polar form: C1 = R1 ej 1 C2 = R2 ej 2 p1 = r1 ej 1 p2 = r2 ej 2 . Note about complex numbers: to put a complex number c into polar form (c = r ej ) we set r = |c| and = c. In Matlab, |c| is computed with the command abs(c) and c is computed with the command angle(c). In part (b) you found the complex values C1 , etc. Now nd the real values R1 , 1 , etc, by using the commands abs and angle. You should nd that R2 = R1 , 2 = 1 , r2 = r1 , and 2 = 1 . Is this what you nd? Therefore, the formula in Equation (1) becomes h(n) = R1 ej 1 (r1 ej 1 )n u(n) + R1 ej 1 (r1 ej 1 )n u(n)
n n = R1 ej 1 r1 ej 1 n u(n) + R1 ej 1 r1 ej 1 n u(n) n = R1 r1 (ej(1 n+1 ) + ej(1 n+1 ) ) u(n) n = 2 R1 r1 cos(1 n + 1 ) u(n).

This nally has the form in Equation (2). The equation now contains no complex numbers. Although the derivation looks messy, each step uses a basic identity which you should know. The last step uses the complex form for cosine. In Matlab, nd the real constants in Equation (2) and use this equation to compute the impulse response, n = -5:30; h = A * r.^n .* ... Also, make a stem plot of the impulse response. It should be exactly the same as what you got in the previous two parts. 4. Please note the following! (a) The frequency o of the damped cosine in Equation (2) is exactly the angle of the pole p1 . 15

Page 143 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(b) The decay of the damped cosine depends on r which is exactly the absolute value (modulus) of the pole p1 . Therefore, the locations of the poles of an LTI system provides information about the form of the impulse response. To make a diagram of the poles and zeros of the system, use the zplane command. zplane(b,a) where b and a are the same vectors used for the filter and residue commands. (Note: when using zplane the vectors b and a must be row vectors. If they are column vectors you must take the transpose of them to get row vectors.) Make a diagram of the poles and zeros of the above system using zplane. 5. The system considered above was a very simple one. For additional practice, take the transfer function H(z) = 1 0.6 z 1 . 1 2.1 z 1 + 1.6 z 2 0.4 z 3

For this system repeat the previous parts. For this system Equation (1) will have three components instead of two. Equation (2) will have an extra term: h(n) = A rn cos(o n + o ) u(n) + B pn u(n). 3 To turn in: the plots you produced, the Matlab code to produce the plots and intermediate results (show your use of the residue and filter commands). Also include discussion of your observations, explanation of your steps, and derivation of the impulse response in Equation (1).

16

Page 144 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 5: Frequency Responses


Consider a causal discrete-time LTI system implemented using the dierence equation, y(n) = 0.1 x(n) 0.1176 x(n 1) + 0.1 x(n 2) + 1.7119 y(n 1) 0.81 y(n 2) For convenience, the frequency response of the system, H(ej ), is sometimes denoted H f (). 1. What is the transfer function H(z) of the system? (Not a Matlab question!) 2. Plot the magnitude of the frequency response H f () of the system using the Matlab command freqz: >> [H,w] = freqz(b,a); >> plot(w,abs(H)); where b and a are appropriately dened. 3. When the input signal is x(n) = cos(0.1 n) u(n) (3)

nd the output signal y(n) using the Matlab command filter. Use n = 0, 1, 2, . . . , 100. Make a stem plot of the input and output signals. from the frequency response of the system? 4. Lets nd the exact value of H f () at = 0.1 . First, express H f (0.1 ) as H f (0.1 ) = B(ej 0.1 ) A(ej 0.1 ) Use subplot(2,1,1) for x(n) and subplot(2,1,2) for y(n). Comment on your observations. How could y(n) be predicted

where B(z) and A(z) are polynomials. Second, use the exp command to nd the complex number z = ej 0.1 . Third, evaluate B(z) and A(z) at the complex value z = ej 0.1 using the Matlab command polyval. (Use help to see how to use this command.) 5. Recall that when the input signal x(n) is x(n) = cos(0.1 n) then the output signal is y(n) = |H f (0.1 )| cos(0.1 n + H f (0.1 )). 17

Page 145 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

(Assuming that the impulse response h(n) is real.) Here is the general diagram: cos(o n) h(n) |H f (o )| cos(o n + H f (o ))

Note that this input signal x(n) starts at n = . (There is no u(n) term.) However, we are interested here in the case when x(n) starts at n = 0, namely when x(n) is given by Equation (3). In this case, we have cos(o n) u(n) h(n) |H f (o )| cos(o n + H f (o )) u(n) + Transients

The transients die out, and the steady-state output signal is simply |H f (o )| cos(o n + H f (o )) u(n). In Matlab, create a stem plot of the steady-state output signal s(n) = |H f (0.1 )| cos(0.1 n + H f (0.1 )) Compare your plot of s(n) with your plot of y(n) you computed using the filter command. You can do this by plotting them on the same graph with plot(n,y,n,s) (stem does not make multiple plots on the same graph, so we use must plot here.) You should nd that s(n) and y(n) agree after a while. (After the transient response has died out.) Is this what you nd? After the transient response has died out, the steady-state output signal s(n) remains. 6. When the input signal is x(n) = cos(0.3 n) u(n) nd the output signal y(n) using the Matlab command filter. Use n = 0, 1, 2, . . . , 100. Make a stem plot of the input and output signals. Use subplot(2,1,1) for x(n) and subplot(2,1,2) for y(n). Comment on your observations. How could y(n) be predicted from the frequency response of the system? What is the steady-state signal? Relate your explanation to the concept describe in the previous question. 7. Plot the poles and zeros of the transfer function using the Matlab command zplane: zplane(b,a) Comment on how the frequency response magnitude |H f ()| can be predicted from the polezero diagram. 18

Page 146 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

8. Some Simple Systems For the causal discrete-time LTI systems implemented by each of the following dierence equations plot the frequency response magnitude |H f ()|, the pole-zero diagram, and the impulse response. y(n) = x(n) + 1.8 y(n 1) 0.9 y(n 2) y(n) = x(n) + 1.6 y(n 1) 0.72 y(n 2) y(n) = x(n) + 1.53 y(n 1) 0.9 y(n 2) y(n) = x(n) + 1.4 y(n 1) + 0.72 y(n 2) y(n) = x(n) 0.85 y(n 1) y(n) = x(n) 0.95 y(n 1) (4) (5) (6) (7) (8) (9)

Comment on your observations: How can you predict from the pole-zero diagram what the frequency response will look like and what the impulse response will look like? (Remember the partial fraction expansion procedure.) Suppose you were given a diagram of each of the pole-zero diagrams, frequency responses, and impulse responses, but that they were out of order. Could you match each diagram to the others (without doing any computation)? 9. Placing the Zeros and Poles In this part of the lab, you are to derive the dierence equation of a system that has the poles and zeros you want it to have. Suppose you want a 3rd order LTI system with the following poles and zeros. p1 = 0.8 ej0.2 , p2 = 0.8 ej0.2 , p3 = 0.7, z1 = 1, z2 = ej0.6 , z3 = ej0.6 Use the poly command in Matlab to nd B(z) and A(z) from the zero and poles. This gives b and a from which you can write down the dierence equation. Also make a stem plot of the impulse response and frequency response magnitude. You can use zplane to plot the pole and zeros of the system. This way you can verify that the system you derived has the poles and zeros you designed it to have. Now change the poles p1 and p2 to p1 = 0.98 ej0.2 , p2 = 0.98 ej0.2 ,

19

Page 147 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

nd the new dierence equation, and plot the impulse response and frequency response magnitude. How does this change to the position of the poles aect the nature of the impulse response of the system and the frequency response? To turn in: The plots you produced, your Matlab commands to produce the plots, and your discussion of your observations.

20

Page 148 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 6: Recursive Digital Filters


Please carefully read the notes on Recursive Digital Filters before the lab. 1. Use the Matlab function ellip to obtain a 3rd order digital lter with pass-band ripple p = 0.01, stop-band ripple s = 0.01, and cut-o frequency 0.4 . [That means, use Wn = 0.4 in ellip.] You will need to convert p , s to Rp and Rs . Make a plot of the magnitude of the frequency response, on a linear scale and in dB, and of the impulse response. Also make a plot of the pole-zero diagram (using zplane). 2. Repeat the previous problem, but instead use a lter of order 4. 3. Repeat the previous problem, but obtain instead a lter of order 6. Comment on your observations. How does the frequency response of the elliptic lter improve as the lter order is increased? How does the impulse response change? 4. Read the full help le for ellip. This command can be used to obtain high-pass lters, band-pass lters, and band-stop lters as well. Design a discrete-time high-pass lter and plot the frequency response, impulse response, and pole-zero diagram. 5. Design a discrete-time bandpass lter and plot the frequency response, impulse response, and pole-zero diagram. 6. Other types of IIR digital lters can be design with Matlab. The Butterworth and Chebyshev lters are commonly used lter types. These lters can be designed in Matlab using the commands butter, cheby1, cheby2. Use the help command to investigate these lters. Design a Butterworth low-pass digital lter of order 4 using butter, and make the corresponding graphs. 7. Design a Chebyshev-I low-pass IIR digital low-pass lter of order 4 using cheby1, and make the corresponding graphs. 8. Design a Chebyshev-II low-pass IIR digital low-pass lter of order 4 using cheby2, and make the corresponding graphs. To turn in: Graphs of the frequency responses, impulse responses, and pole-zero diagram and your comments: In what ways do the four types of IIR lters dier (ellip, butter, cheby1, cheby2)? How do they dier in the frequency response and pole-zero plots? What happens as you increase the order of these lters? 21

Page 149 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 7: Noise Reduction


Matlab comes with a speech data set of someone saying Matlab. The Matlab command load mtlb will load this data set. If your computer supports sound, you can listen to the original signal with the command soundsc(mtlb). [Type help soundsc to nd out how this command works.] The speech data set was obtained with a sampling frequency of Fs = 7418 Hz. The sampling period is Ts = 1/Fs . The signal can be plotted with the following commands. >> clear, close all >> load mtlb >> who

Your variables are:

Fs

mtlb

>> L = length(mtlb); >> plot([1:L]/Fs,mtlb) >> axis tight >> xlabel(TIME (SECONDS)) The data set NoisySpeech.txt on the class webpage, shown in the following gure, contains the mtlb data set corrupted by additive noise.
NOISY SPEECH SIGNAL 3 2 1 0 1 2 3 0 0.05 0.1 0.15 0.2 0.25 0.3 TIME (SECONDS) 0.35 0.4 0.45 0.5

We will call the noisy signal x(n). You are to design a low-pass lter to lter out the noise. You will try dierent low-pass lters until you nd one that works well. 1. Download the data from the course webpage and make a plot of the data. You should get the same gure as shown above. 22

Page 150 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

To obtain the data le, go to the course webpage and save the le NoisySpeech.txt, then type load NoisySpeech.txt on the Matlab command line. (You may need to change your Matlab working directory with the cd command to where-ever you have saved the le. Alternatively, you can append the directory to the Matlab path with the command path). Typing load NoisySpeech.txt on the Matlab command line will create a vector called NoisySpeech. For convenience, type x = NoisySpeech; on the command line so that you can use x instead of the longer variable name. The command plot([1:L]/Fs,x) will then display the plot above. If your computer supports sound, you can listen to the noisy signal x(n) with the command soundsc(x). 2. Use the dtft command as shown to plot the magnitude of the spectrum of the signal mtlb. What frequencies are predominant in the speech signal? The dtft is not a built in Matlab command, you must download it from the course webpage. DTFT stands for the Discrete-Time Fourier Transform. >> [M,f] = dtft(mtlb,1/Fs); >> plot(f,M) >> xlabel(FREQUENCY (Hz)) >> title(SPECTRUM of MTLB) 3. As in the previous part, use the dtft command to plot |X f ()|, the spectrum of the noisy signal x(n). Can you identify which part of the spectrum corresponds to the noise and which part corresponds to the speech signal? Explain how a low-pass lter can remove the high frequency noise. From the spectrum can you can you estimate what the cut-o frequency for the lowpass lter should be? 4. Design an appropriate elliptical low-pass lter with the ellip command. Use the filter command to lter the noisy signal x(n) with the lowpass lter you design. Try dierent cut-o frequencies and dierent values for the stop-band ripple and the passband ripple. Can you remove most of the noise from the noisy signal?

23

Page 151 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Is the noise reduction quality aected more by the size of passband ripple or by the size of the stopband ripple? (What is more important that the passband be very close to 1 or that the stopband be very close to 0? You should try dierent lter designs and listen to the results to nd out.)

24

Page 152 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 8: Synthesizing the Sound of a Plucked String


There are several methods for electronically producing the sound of musical instruments. One method is to record the sound, sample it, and save the samples. This method is computationally simple and produces naturalistic sounds, however, it requires a lot of memory and lacks exibility: For each note, all the samples must be stored in memory. In addition, it is not possible to tune the notes. A second method to simulate the sound of a musical instrument is to model the sound as a sum of cosine signals. This method requires very little memory only the frequency and amplitude of each cosine signal. However, this method usually produces somewhat articial sounds. A third method is based on physically modelling the instrument using an appropriately designed system. Methods based on physical modeling can sound realistic, need very little memory, are tunable, and can be eciently implemented. In this lab, we investigate a system for simulating the sound of a plucked string. K. Karplus and A. Strong described a very simple system for generating a signal which sounds like a plucked string. This system can be used to synthesize the sound of a guitar. They published their method in the paper Digital Synthesis of Plucked-String and Drum Timbres in the Computer Music Journal in 1983. The Karplus-Strong system uses this system:

E+ i T

LPF

'

Delay

'

Gain

'

This system contains three components in a feedback loop: a lowpass lter (LPF), a delay, and a gain. We will use the simplest lowpass lter and the simplest delay. 1. The simplest digital lowpass lter is the two-point averager. Its transfer function is H(z) = 0.5 + 0.5 z 1 . 2. The simplest delay is an integer delay by N samples. Its transfer function is D(z) = z N . 3. The transfer function for the gain is G(z) = K. For the system to be stable, it is required that K < 1. 25

Page 153 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

LPF: Delay: Gain:

H(z) = 0.5 + 0.5 z 1 D(z) = z N G(z) = K

Question: What is the transfer function of the Karplus-Strong system pictured above? How many poles does it have? Question: What is the dierence equation that implements this system? Question: We will use the command y = filter(b,a,x); to implement this system. What should a and b be? To simulate the sound of a plucked string, the input to the system should be an N -point random signal. In Matlab, the following command can be used to make the input signal. x = [randn(1,N) zeros(1,L)]; Then when we use y = filter(b,a,x) we will get a signal y that is N + L points long. We can then listen to the result with the command soundsc(y,Fs). Where Fs is the sampling frequency. For this lab use Fs = 8000. Question: With Fs = 8000 what should N+L be if we want the output signal to be 1 second in duration? When N = 100, K = 0.98, the system produces the following output signal. Because the input signal is random for the rst N points, the output signal will be a bit dierent each time this method is used.
SIMULATED PLUCKED STRING SIGNAL 2

0.1

0.2

0.3

0.4 0.5 0.6 TIME (SECONDS)

0.7

0.8

0.9

26

Page 154 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

In Matlab: Write a Matlab program to simulate the sound of a plucked-string using the Karplus-Strong system above. Use the values N = 100, K = 0.98. Choose L so that the output signal is one second in duration. Use the filter command. Listen to the output signal using the soundsc command. Does it sound like a plucked string? Zoom in on the signal (magnify a small portion of it). Does it look almost periodic? Run your program several times. Does it sound exactly the same each time? In Matlab: Plot the frequency response of the system using the freqz command. To ensure that the plot captures the details of the frequency plot, you can use freqz with a third input argument, for example: [H,w] = freqz(b,a,2^16) plot(w/pi*Fs/2,abs(H)) This will give a denser frequency axis grid. Question: From the frequency response, how could you have predicted that the output signal of the Karplus-Strong system is nearly periodic? (Note: the spectrum of a periodic signal is a line spectrum.) We can tune the sound by changing the system parameters. In Matlab: Run the system again, using dierent values of K. Plot the output signal, listen to the signal, and plot the frequency response. When you change K what aect does it have on the output signal and the frequency response? In Matlab: Run the system again, using dierent values of N . Plot the output signal, listen to the signal, and plot the frequency response. When you change N what aect does it have on the output signal and the frequency response? Note: The fundamental frequency Fo of the sound produced by this system will depend on the sampling frequency Fs , the delay N , and the delay incurred by the lowpass lter. It is Fo = Fs N +d

where d is the delay of the lowpass lter. The two-point averager has a delay of d = 0.5. In Matlab: In the above description, we are driving the system with a burst of noise (that means, the input to the system is a short random signal). Suppose the system is driven by only an impulse. Run the system with the input x = [1 zeros(1,L)]. (The output will be just the impulse response of the system.) How does this eect the sound quality of the output signal? Does it sound more or less natural? Take a close look at the output signal, what do you notice? 27

Page 155 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

In Matlab: Suppose the lowpass lter is taken out of the Karplus-Strong system. If the feedback loop of this system contains only the gain K and the delay z N then it is called a comb lter. For the comb lter, what is the dierence equation and transfer function? Run the system without the lowpass lter component. Plot the output signal, listen to the signal, and plot the frequency response. How does removing the lowpass lter aect the sound and the frequency response of the system? Why is this system called a comb lter? Notes: 1. The frequency of the sound produced by the Karplus-Strong system can not be continuously varied. The delay N must be an integer, so only a discrete set of fundamental frequencies Fo can be simulated with this model. To overcome this limitation we can introduce a fractional delay in the feedback loop. 2. If you allow the delay in the feedback loop to be a time-varying delay, then the frequency of the sound can vary over the duration of the note. Time-varying systems add exibility. 3. You can learn more about simulating musical instruments using signals and systems on the web. http://www.harmony-central.com/Synth/Articles/Physical_Modeling/

28

Page 156 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 9: Stable Inverse Systems and Equalization


1. Suppose that a causal system has the impulse response h1 (n) = 0.5n u(n) and that an anti-causal system has the impulse response h2 (n) = 3n u(n 1). (11) (10)

(a) If these two systems are connected in cascade, what is the transfer function H(z) and ROC of the total system? (Not a MATLAB question.) (b) Find the impulse response h(n) of the total system and make a stem plot of h(n) using Matlab. (c) Consider the stable inverse G(z) = 1/H(z). Find the ROC of G(z) and g(n). Make a stem plot g(n) using Matlab. Verify in Matlab that it is an inverse by convolving g(n) and h(n) to get (n). (You will need to truncate h and g rst as they are innite in length.) 2. Distortion removal. A binary signal is sent over an imperfect channel which introduces distortion. The channel can be modeled as a discrete-time LTI system with the transfer function H(z) = 1 2.5 z 1 + z 2 . 1 z 1 + 0.7 z 2

(a) Determine the impulse response g(n) of the stable inverse of H(z). You may use the residue command in Matlab. (b) Using Matlab, make a stem plot of h(n), g(n), and h(n) g(n). Check that you get an impulse. (c) Using Matlab (freqz) plot |H f ()| and |Gf ()|, the magnitudes of the frequency responses. Also plot the product |H f () Gf ()|. What do you expect to get for the product? Did you get it? (d) The binary signal x(n) is sent through the channel and the received signal r(n) is shown in the gure.

29

Page 157 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

3 2 1 r(n) 0 1 2 3 0 10 20 30 40 50 n 60 70 80 90 100

On the course webpage you will nd r(n) contained in the le DistortedSignal.txt, but not x(n). Download r(n) and make plot of it using Matlab. Filter r(n) with the impulse response g(n) (use the conv command) and make a plot of the new signal. Has the distortion been removed? (You should obtain a binary signal.) (e) Suppose the frequency response H f () were equal to zero for some frequency o . Would that make the design of an inverse system more dicult? Explain.

30

Page 158 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 10: Echo Cancellation


In this lab you will work on the problem of removing an echo from a recording of a speech signal. An echo has a couple of parameters: The rst parameter is the delay: to seconds (or N samples). The second parameter is the amplitude of the echo: . The lab has the following parts: 1. Create the Echo Signal. You will add an echo to a speech signal. 2. Remove the Echo. You will remove an echo from a speech signal. In this part you know what the echo parameters to and are. 3. Estimating Unknown Echo Parameters. You will try to determine the echo parameters to and from a speech signal, and then remove the echo. The lab consists of the following activities and questions: 1. Create the Echo Signal Load the matlab speech signal with the command >> load mtlb Then type who to see your variables. You can listen to the signal mtlb with the command soundsc(mtlb,Fs), provided your computer has a sound card. You should hear the phrase matlab. For convenience, lets redene this to be x by typing x = mtlb;. Make a plot of the signal x versus time (in SECONDS). You will need the sampling frequency Fs which is loaded when you typed load mtlb. You should nd that the speech signal is about 0.55 seconds in duration. 2. How do you nd the exact duration of this signal in seconds? 3. We can create an echo by ltering this signal with the following dierence equation: y(n) = x(n) + x(n N ) where x(n) is the echo-free speech signal, which has been delayed by N samples and added back in with its amplitude scaled by . This is a reasonable model for an echo resulting from the signal reecting o an absorbing surface like a wall. The delay parameter to in seconds is N/Fs where Fs is the sampling frequency. (Can you explain why?) What is the impulse response of this system? 31

Page 159 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

4. Lets add an echo to the signal with a delay of to = 0.12 seconds and an amplitude of = 0.8. What is the delay N in samples? Based on the dierence equation, create an echo version of the signal x using the command y = conv(h,x);. What is h? Listen to the output of the dierence equation. Do you hear the echo? 5. Remove the Echo. The dierence equation above for modeling the echo is an LTI system. To remove the echo, we need to implement the inverse system. What is the impulse response of the inverse system? What is the duration of this impulse response? 6. For the echo parameters you used above, plot the impulse response of the inverse system. Make the horizontal axis in your plot in units of SECONDS. 7. Implement the inverse of the echo system to perform echo cancellation. You can use the command g = filter(b,a,y). What are the vectors b and a? 8. Listen to the result. Is the echo removed? 9. Estimating Unknown Echo Parameters In a real problem, you will probably not know what the echo parameters to and are. You will need to estimate them from the echo signal itself. Suppose you are given the data y(n) (which is corrupted by an echo) but suppose you do not know the value of the delay N . Determine a method of estimating N based on the autocorrelation function of y(n). Let ryy (n) be the autocorrelation of y(n), ryy (n) = y(n) y(n), and let rxx (n) be the autocorrelation of x(n), rxx (n) = x(n) x(n). First, nd a formula for the signal ryy (n) in terms of rxx (n) (this is not a Matlab question). To do this, use the expression you have for the impulse response together with properties of the convolution sum. 10. Compute in Matlab and plot rxx (n) vs time (in SECONDS). rxx (n) is the autocorrelation of the echo-free signal. To compute in Matlab the autocorrelation of a signal you can use the commands 32

Page 160 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

>> rxx = conv(x,x(end:-1:1)); or the command xcorr. You should see that it has a peak in the middle. 11. For the signal and echo parameters above, plot ryy (n). Can you determine what the value of N is from the plot of ryy (n)? (Look at the peaks.) Does it agree with the known value? 12. From the course website, there is a data le you can download for this lab. It contains a signal which is corrupted by an echo with unknown echo parameters to and . Can you estimate N for this data from its autocorrelation? 13. The amplitude is harder to estimate than N . Once you have estimated N , try to remove the echo by trying out dierent values of and listening to your result. What N and do you nd work best? Are you able to successfully remove the echo? 14. What if an echo has two components? y(n) = x(n) + 1 x(n N1 ) + 2 x(n N2 ) Discuss what system is required for echo cancellation. How would you nd the echo parameters?

33

Page 161 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

Lab 11: Fourier Series


1. Find the Fourier series coecients c(k) for the periodic signal x(t) = | cos( t)|.

2. Find the Fourier series coecients c(k) for the periodic triangular pulse shown below. x(t)
1

d d d d d d d d d d d d d d d
4 3 2 1 0 1 2 3 4 5

3. (a) Run the Matlab program fs1.m to see the convergence of the Fourier series of the periodic pulse signal. The program is available on my.poly.edu. (b) Write a Matlab program fs2.m to generate the same plots but for the signal x(t) = | cos(t)|. This entails replacing the line for c0 and ck in fs1.m, with the formula from question 1. (c) Write a Matlab program fs3.m to generate the same plots but for the periodic triangular pulse. (d) For which signal does the Fourier series converge more rapidly, the periodic rectangular pulse signal or the periodic triangular signal? How could you predict your answer? 4. Numerical Computation of Fourier Series Coecients Sometimes the integration formula for the Fourier series coecients is dicult to carry out. In these cases, the coecients can be obtained numerically. Remember that an integral f (t) dt T
m

f (m T )

For example, c(k) = can be approximated as a sum: T c(k) T


M 1

1 T

x(t) ej k o t dt
<T >

x(m T ) ej k o m (T )
m=0

34

Page 162 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

The following Matlab program computes the rst N Fourier series coecients c(k) numerically of the signal x(t) = | cos( t)| The program plots the line spectrum (a graph of the FS coecients). The program also creates a periodic signal using the calculated coecients this veries if the coecients were computed correctly. Run this program and verify that it works. It can be obtained from my.poly.edu Change the program so that it computes the Fourier series coecients of the periodic triangle wave shown above. 5. The Time-Shift Property The time-shift property states that if a periodic signal is shifted, then the Fourier coecients of that signal are modied according to the following rule: If x(t) then x(t to ) ej k o to c(k) c(k)

Verify this property numerically using Matlab, by setting g(t) = | cos( (t 0.2))|. Find the Fourier coecients of g(t) by rst nding the Fourier coecients of x(t) = | cos( t)| and modifying those coecients according to this rule. Then use the new coecients to synthesize the periodic signal g(t) by adding up complex exponentials. Are you able to conrm the time-shift property?

35

Page 163 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

EE 3054: Signals, Systems, and Transforms Example Matlab Quiz No laptop, no notes, no documentation.
1. Given the following array a, a =

1 7 -5

4 5 7

2 9 -2

4 2 0

determine the result of each of the following commands. >> a(2, 3) >> a(2, :) >> a(6) >> a(3, 2:end) >> a(1:2, 4:-1:2) >> a([2 2], [2 3]) >> a > 5 >> sum(a) >> a(:) >> [a(1,:), a(2,:)] >> [a(1,:); a(2,:)] 2. What are the results of the following commands? >> a = [5 2 3 5 8]; >> b = [9 2 5 0 8]; >> a == 5 >> a == b 3. What is the result of each of the following commands?

36

Page 164 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

>> a = [zeros(3); ones(1,3)] >> b = [zeros(3); ones(3,1)] 4. What is the result of the following command? >> n = 0:0.5:3.2 5. What is the result of the following commands? >> n = 2:7 >> n(2) = []; >> n 6. What are all the results of the following commands? >> a = [3 4; 7 8]; >> b = [1 0; 0 1]; >> a >> a - 1 >> a .* b >> a * b >> a | b >> a & b >> a .^ 2 >> a ^ 2 7. The following code fragment produces 3 graphs. Sketch each of the three graphs. >> n = 0:7; >> x = 2*n + 1; >> stem(n,x) >> plot(n,x) >> y = (-1).^n; >> plot(n,x,n,y) 8. Sketch the 3 graphs produced by the following code.

37

Page 165 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

>> n = 0:10; >> x = (n >= 1) - (n >=5); >> stem(n,x) >> h = (n == 5); >> y = conv(h,x); >> stem(0:20,y) >> z = conv(x,x); >> stem(0:20,z) 9. Write a short Matlab code that will plot a sinusoid of frequency 50 Hz for 10 cycles. 10. The le kiwi.m contains the following: y = 5; x = 6; z = x + y; The le grape.m contains the following: function z = grape(x,y) z = x + y; What is the result of the following commands? >> clear >> x = 2; >> y = 5; >> kiwi >> z What is the result of the following commands? >> clear >> x = 2; >> y = 5; >> z = grape(x,y); >> z

38

Page 166 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

EE 3054: Signals, Systems, and Transforms Lab Quiz 1 Spring 2005 No laptop, no notes, no documentation.
1. Given the following array a, a = 9 1 3 4 6 10 7 3 6 2 5 4

determine the result of each of the following commands. >> a(2, 3) >> a(0, 2) >> a(5) >> a >> a(:, [2 2 2]) >> a(1:2:end, 1:2:end) >> a(end:-1:1, :) >> max(a) >> b = a; b([2 3],[1 4]) = [11 22; 33 44]; b >> b = a; b(:,2) = []; b >> log10([1 10 100 0.1])

2. What are the results of the following commands? >> a = [9 4 7 >> a(2) >> a(1,2) >> a(2,1) >> a > 5 >> find(a > 5) >> a * a 39 2 8];

Page 167 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

>> [a, a] >> [M, k] = min(a); M, k >> a(1:end-1) >> a([1 1 1], :) 3. What is the result of each of the following commands? >> a = [1+j, 1+2*j, 3, 4, 5*j]; >> k = find(imag(a)==0); >> a(k) 4. What is the result of the following commands? >> a = []; >> for k = 5:-1:2 a = [a, k]; end >> a 5. What is the result of the following commands? >> a = [-2 3]; >> b = [4 2 -1]; >> conv(a,b) 6. The following code fragment produces 3 graphs. Sketch each of the three graphs. >> n = 2:0.5:4; >> x = [3 1 2 0 3]; >> plot(n,x) >> plot(x) >> stem(n,x) 7. Write a MATLAB function called over that has one output and two inputs. The rst input is a vector; the second input is a scalar. The output should be the sum of all those elements in the vector that exceed the scalar. For example,

40

Page 168 of 169

EE 3054 - Polytechnic University

Prof. Ivan Selesnick

>> over([5 1 3 6 9],4) ans = 20 because the elements in the vector that are greater than 4 are: 5, 6, and 9, so we have 5 + 6 + 9 = 20. Your program should not use a for or while loop and it should not use an if statement.

41

Page 169 of 169

You might also like