EE3054 Signals and Systems Lecture 2 Linear and Time Invariant Systems

Yao Wang Polytechnic University

Most of the slides included are extracted from lecture presentations prepared by McClellan and Schafer License Info for SPFirst Slides

 This work released under a Creative Commons License with the following terms:  Attribution  The licensor permits others to copy, distribute, display, and perform the work. In return, licensees must give the original authors credit.  Non-Commercial  The licensor permits others to copy, distribute, display, and perform the work. In return, licensees may not use the work for commercial purposes—unless they get the licensor's permission.  Share Alike  The licensor permits others to distribute derivative works only under a license identical to the one that governs the licensor's work.  Full Text of the License  This (hidden) page should be kept with the presentation

1/30/2008 © 2003, JH McClellan & RW Schafer 2 Review of Last Lecture

 General FIR System {bk }  h[n]  FIR case: h[n]=b_n  y[n] = h[n]∗ x[n]  For any FIR system: y[n] = x[n] * h[n]

1/30/2008 © 2003, JH McClellan & RW Schafer 3 GENERAL FIR FILTER  FILTER COEFFICIENTS {bk}  DEFINE THE FILTER M = − y[n] ∑bk x[n k] k=0 = −  For example, bk {3, 1,2,1}

3 = − Feedforward Difference Equation y[n] ∑bk x[n k] k=0 = 3x[n] − x[n −1] + 2x[n − 2] + x[n − 3]

1/30/2008 © 2003, JH McClellan & RW Schafer 4 GENERAL FIR FILTER

 SLIDE a Length-L WINDOW over x[n]  When h[n] is not symmetric, needs to flip h(n) first!

x[n-M] x[n]

1/30/2008 © 2003, JH McClellan & RW Schafer 5 7-pt AVG EXAMPLE π Input : x[n] = (1.02)n + cos(2 n /8 + π / 4) for 0 ≤ n ≤ 40

CAUSAL: Use Previous

1/30/2008 © 2003, JH McClellan & RW Schafer 6 LONGER OUTPUT Unit Impulse Signal

 x[n] has only one NON-ZERO VALUE

1 n = 0 δ [n] =  0 n ≠ 0

UNIT-IMPULSE 1

n

1/30/2008 © 2003, JH McClellan & RW Schafer 7 4-pt Avg Impulse Response

= 1 + − + − + − y[n] 4 (x[n] x[n 1] x[n 2] x[n 3]) δ[n] “READS OUT” the FILTER COEFFICIENTS =  1 1 1 1  h[n] { , 0, 0, 4 , 4 , 4 , 4 , 0, 0, } “h” in h[n] denotes Impulse Response n=0 NON-ZERO n=–1 When window δ n=0 1 overlaps [n] n=1 n n=4 n=5 1/30/2008 © 2003, JH McClellan & RW Schafer 8 What is Impulse Response?

 Impulse response is the output signal when the input is an impulse  Finite Impulse Response (FIR) system:  Systems for which the impulse response has finite duration  For FIR system, impulse response = Filter coefficients  h[k] = b_k  Output = h[k]* input

1/30/2008 © 2003, JH McClellan & RW Schafer 9 FIR IMPULSE RESPONSE

 Convolution = Filter Definition  Filter Coeffs = Impulse Response

M M = − = − y[n] ∑bk x[n k] y[n] ∑h[k]x[n k] k=0 k=0 CONVOLUTION

1/30/2008 © 2003, JH McClellan & RW Schafer 10 Convolution Operation

 Flip h[n]  SLIDE a Length-L WINDOW over x[n] M y [ n ] = ∑ h [ k ] x [ n − k ] k = 0 CONVOLUTION

x[n-M] x[n]

1/30/2008 © 2003, JH McClellan & RW Schafer 11 More on signal ranges and lengths after filtering

 Input signal from 0 to N-1, length=L1=N  Filter from 0 to M, length = L2= M+1  Output signal?  From 0 to N+M-1, length L3=N+M=L1+L2-1

1/30/2008 © 2003, JH McClellan & RW Schafer 12 DCONVDEMO: MATLAB GUI

1/30/2008 © 2003, JH McClellan & RW Schafer 13  Go through the demo program for different types of signals  Do an example by hand  Rectangular * rectangular  Step * rectangular

1/30/2008 © 2003, JH McClellan & RW Schafer 14 CONVOLUTION via Synthetic Polynomial Multiplication

1/30/2008 © 2003, JH McClellan & RW Schafer 15 Convolution via Synthetic Polynomial Multiplication

 More example

1/30/2008 © 2003, JH McClellan & RW Schafer 16 MATLAB for FIR FILTER  yy = conv(bb,xx)  VECTOR bb contains Filter Coefficients  DSP-First: yy = firfilt(bb,xx)  FILTER COEFFICIENTS {bk} conv2() M for images = − y[n] ∑bk x[n k] k=0

1/30/2008 © 2003, JH McClellan & RW Schafer 17 POP QUIZ

 FIR Filter is “FIRST DIFFERENCE”  y[n] = x[n] - x[n-1]  INPUT is “UNIT STEP” 1 n ≥ 0 u[n] =  0 n < 0

 Find y[n] y[n] = u[n] − u[n −1] = δ [n]

1/30/2008 © 2003, JH McClellan & RW Schafer 18 SYSTEM PROPERTIES

x[n] y[n] SYSTEM

 MATHEMATICALMATHEMATICAL DESCRIPTIONDESCRIPTION  TIMETIME--INVARIANCEINVARIANCE  LINEARITYLINEARITY  CAUSALITY  “No output prior to input”

1/30/2008 © 2003, JH McClellan & RW Schafer 19 TIME-INVARIANCE

 IDEA:  “Time-Shifting the input will cause the same time-shift in the output”

 EQUIVALENTLY,  We can prove that  The time origin (n=0) is picked arbitrary

1/30/2008 © 2003, JH McClellan & RW Schafer 20 TESTING Time-Invariance

1/30/2008 © 2003, JH McClellan & RW Schafer 21  Examples of systems that are time invariant and non-time invariant

1/30/2008 © 2003, JH McClellan & RW Schafer 22 LINEAR SYSTEM

 = Two Properties  SCALING  “Doubling x[n] will double y[n]”

 SUPERPOSITION:  “Adding two inputs gives an output that is the sum of the individual outputs”

1/30/2008 © 2003, JH McClellan & RW Schafer 23 TESTING LINEARITY

1/30/2008 © 2003, JH McClellan & RW Schafer 24  Examples systems that are linear and non-linear

1/30/2008 © 2003, JH McClellan & RW Schafer 25 LTI SYSTEMS

 LTI: Linear & Time-Invariant  Any FIR system is LTI  Proof!

1/30/2008 © 2003, JH McClellan & RW Schafer 26 LTI SYSTEMS

 COMPLETELY CHARACTERIZED by:  IMPULSE RESPONSE h[n]  CONVOLUTION: y[n] = x[n]*h[n]  The “rule”defining the system can ALWAYS be re- written as convolution  FIR Example: h[n] is same as bk

1/30/2008 © 2003, JH McClellan & RW Schafer 27  Proof of the convolution sum relation  by representing x(n) as sum of delta(n-k), and use LTI property! Properties of Convolution

 Convolution with an Impulse  Commutative Property  Associative Property Convolution with Impulse

 x[n]*δ[n]=x[n]  x[n]*δ[n-k]=x[n-k]  Proof Commutative Property

 x[n]*h[n]=h[n]*x[n]  Proof Associative Property

 (x[n]* y[n])* z[n]=x[n]*(y[n]*z[n])  Proof HARDWARE STRUCTURES

x[n] y[n] M FILTER = − y[n] ∑bk x[n k] k=0  INTERNAL STRUCTURE of “FILTER”  WHAT COMPONENTS ARE NEEDED?  HOW DO WE “HOOK” THEM TOGETHER?  SIGNAL FLOW GRAPH NOTATION

1/30/2008 © 2003, JH McClellan & RW Schafer 33 HARDWARE ATOMS

 Add, Multiply & Store M = − y[n] ∑bk x[n k] k=0

y[n] = x [n] + x [n] y[n] = β x[n] 1 2

= − 1/30/2008 © 2003, JH McClellany[n &] RW Schaferx[n 1] 34 FIR STRUCTURE

 M Direct Form = − y[n] ∑bk x[n k] SIGNAL FLOW GRAPH k=0

1/30/2008 © 2003, JH McClellan & RW Schafer 35 FILTER AS BUILDING BLOCKS

OUTPUT x[n] + y[n] FILTER FILTER INPUT +

FILTER

 BUILD UP COMPLICATED FILTERS  FROM SIMPLE MODULES  Ex: FILTER MODULE MIGHT BE 3-pt FIR  Is the overall system still LTI? What is its impulse response?

1/30/2008 © 2003, JH McClellan & RW Schafer 36 CASCADE SYSTEMS

 Does the order of S1 & S2 matter?  NO, LTI SYSTEMS can be rearranged !!!  WHAT ARE THE FILTER COEFFS? {bk}

S1 S2

1/30/2008 © 2003, JH McClellan & RW Schafer 37  proof

1/30/2008 © 2003, JH McClellan & RW Schafer 38 CASCADE SYSTEMS

h [n] h1[n] 2 x[n] y[n]

 Is the cascaded system LTI?  What is the impulse response of the overall system?

1/30/2008 © 2003, JH McClellan & RW Schafer 39 CASCADE SYSTEMS

 h[n] = h1[n]*h2[n]!  Proof on board Does the order matter?

S1 S2

S2 S1

1/30/2008 © 2003, JH McClellan & RW Schafer 41  proof Example

 Given impulse responses of two systems, determine the overall impulse response Parallel Connections

h1[n]

x[n] + y[n]

h2[n]

h[n]=? Parallel and Cascade

h1[n] h2[n] x[n] + y[n]

h3[n]

h[n]=? Summary of This Lecture

 Properties of linear and time invariant systems  Any LTI system can be characterized by its impulse response h[n], and output is related to input by convolution sum: y[n]=x[n]*h[n]  Properties of convolution  Computation of convolution revisited  Sliding window  Synthetic polynomial multiplication  Block diagram representation  Hardware implementation of one FIR  Connection of multiple FIR • Know how to compute overall impulse response READING ASSIGNMENTS

 This Lecture:  Chapter 5, Sections 5-5 --- 5-9