There are two main classes of digital lter FIR (Finite impulse response) and IIR (innite impulse reponse).

Similar documents
Lecture 3 - Design of Digital Filters

EE 521: Instrumentation and Measurements

UNIVERSITY OF OSLO. Faculty of mathematics and natural sciences. Forslag til fasit, versjon-01: Problem 1 Signals and systems.

Filter Analysis and Design

Lecture 7 Discrete Systems

Digital Control & Digital Filters. Lectures 21 & 22

EE482: Digital Signal Processing Applications

Multimedia Signals and Systems - Audio and Video. Signal, Image, Video Processing Review-Introduction, MP3 and MPEG2

Digital Signal Processing Lecture 9 - Design of Digital Filters - FIR

Discrete-Time David Johns and Ken Martin University of Toronto

Digital Signal Processing

Digital Signal Processing Lecture 8 - Filter Design - IIR

Design of IIR filters

ECE 410 DIGITAL SIGNAL PROCESSING D. Munson University of Illinois Chapter 12

DIGITAL SIGNAL PROCESSING UNIT III INFINITE IMPULSE RESPONSE DIGITAL FILTERS. 3.6 Design of Digital Filter using Digital to Digital

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

Lecture 9 Infinite Impulse Response Filters

UNIT - III PART A. 2. Mention any two techniques for digitizing the transfer function of an analog filter?

Transform Analysis of Linear Time-Invariant Systems

V. IIR Digital Filters

2.161 Signal Processing: Continuous and Discrete Fall 2008

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

DIGITAL SIGNAL PROCESSING. Chapter 6 IIR Filter Design

Filter Design Problem

DHANALAKSHMI COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING EC2314- DIGITAL SIGNAL PROCESSING UNIT I INTRODUCTION PART A

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

Chapter 7: Filter Design 7.1 Practical Filter Terminology

(Refer Slide Time: 01:28 03:51 min)

1 1.27z z 2. 1 z H 2

Quadrature-Mirror Filter Bank

Chapter 5 Frequency Domain Analysis of Systems

Review of Fundamentals of Digital Signal Processing

-Digital Signal Processing- FIR Filter Design. Lecture May-16

Digital Signal Processing IIR Filter Design via Bilinear Transform

Filter structures ELEC-E5410

ELEG 305: Digital Signal Processing

Chapter 7: IIR Filter Design Techniques

Digital Signal Processing

/ (2π) X(e jω ) dω. 4. An 8 point sequence is given by x(n) = {2,2,2,2,1,1,1,1}. Compute 8 point DFT of x(n) by

Multirate signal processing

Digital Signal Processing:

PS403 - Digital Signal processing

Lecture 19 IIR Filters

Review of Fundamentals of Digital Signal Processing

LECTURE 12 Sections Introduction to the Fourier series of periodic signals

Stability Condition in Terms of the Pole Locations

Discrete Time Systems

VALLIAMMAI ENGINEERING COLLEGE. SRM Nagar, Kattankulathur DEPARTMENT OF INFORMATION TECHNOLOGY. Academic Year

GATE EE Topic wise Questions SIGNALS & SYSTEMS

LAB 6: FIR Filter Design Summer 2011

Basic Design Approaches

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

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

LINEAR-PHASE FIR FILTERS DESIGN

Transform Representation of Signals

Examples. 2-input, 1-output discrete-time systems: 1-input, 1-output discrete-time systems:

Elec4621 Advanced Digital Signal Processing Chapter 11: Time-Frequency Analysis

DSP. Chapter-3 : Filter Design. Marc Moonen. Dept. E.E./ESAT-STADIUS, KU Leuven

CITY UNIVERSITY LONDON. MSc in Information Engineering DIGITAL SIGNAL PROCESSING EPM746

Multirate Digital Signal Processing

DSP-CIS. Chapter-4: FIR & IIR Filter Design. Marc Moonen

Today. ESE 531: Digital Signal Processing. IIR Filter Design. Impulse Invariance. Impulse Invariance. Impulse Invariance. ω < π.

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science. Fall Solutions for Problem Set 2

DEPARTMENT OF EI DIGITAL SIGNAL PROCESSING ASSIGNMENT 1

! Introduction. ! Discrete Time Signals & Systems. ! Z-Transform. ! Inverse Z-Transform. ! Sampling of Continuous Time Signals

ELEG 5173L Digital Signal Processing Ch. 5 Digital Filters

( ) John A. Quinn Lecture. ESE 531: Digital Signal Processing. Lecture Outline. Frequency Response of LTI System. Example: Zero on Real Axis

Butterworth Filter Properties

Question Bank. UNIT 1 Part-A

EECE 301 Signals & Systems Prof. Mark Fowler

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

Exercises in Digital Signal Processing

Chapter 5 Frequency Domain Analysis of Systems

Very useful for designing and analyzing signal processing systems

Review of Discrete-Time System

Digital Signal Processing Lecture 10 - Discrete Fourier Transform

IT DIGITAL SIGNAL PROCESSING (2013 regulation) UNIT-1 SIGNALS AND SYSTEMS PART-A

Analog and Digital Filter Design

INF3440/INF4440. Design of digital filters

Signals and Systems. Lecture 11 Wednesday 22 nd November 2017 DR TANIA STATHAKI

Electronic Circuits EE359A

z-transforms Definition of the z-transform Chapter

ECE503: Digital Signal Processing Lecture 5

CMPT 318: Lecture 5 Complex Exponentials, Spectrum Representation

ECSE 512 Digital Signal Processing I Fall 2010 FINAL EXAMINATION

Final Exam January 31, Solutions

2.161 Signal Processing: Continuous and Discrete Fall 2008

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

CMPT 889: Lecture 5 Filters

A system that is both linear and time-invariant is called linear time-invariant (LTI).

Digital Filters. Linearity and Time Invariance. Linear Time-Invariant (LTI) Filters: CMPT 889: Lecture 5 Filters

2.161 Signal Processing: Continuous and Discrete Fall 2008

Ch. 7: Z-transform Reading

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

Chap 2. Discrete-Time Signals and Systems

Digital Signal Processing, Homework 1, Spring 2013, Prof. C.D. Chung

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

Discrete-Time Fourier Transform (DTFT)

EC Signals and Systems

EEL3135: Homework #4

Transcription:

FIR Filters I There are two main classes of digital lter FIR (Finite impulse response) and IIR (innite impulse reponse). FIR Digital Filters These are described by dierence equations of the type: y[n] = M a[k]x[n k] k=0 The current output is dependent on the past and present inputs. The FIR lter is sometimes called a non-recursive digital lter. It will become clear why after we study IIR lters. We have a weighted moving average process:

Very simple demonstration of the ltering action of an FIR llter: Take M =, a[0] = and a[] = y[n] = a[0]x[n] + a[]x[n ] = x[n] + x[n ] also Ỹ (z) = (a[0] + a[]z ) X(z) (i.e.) H(z) = a[0] + a[]z a rst order transfer function. Suppose the following input for x[n]: n x[n] x[n ] y[n] 0 0 0 0 0 0 3 0 0 0 4 0 0 0 5 0 0 0 Input:unit impulse Output: unit impulse response In general with FIR lters the three sets of numbers:. {Dierence equation coecients}. {Transfer function coecients} 3. {Unit impulse response}, are all identical.

H(z) = + z Unit step response: After some transient eects, the DC gain is. H(z) = + z Response to sinusoid at ωs 4 (4 samples per cycle): Gain at ωs 4 is. Phase shift: 45 o 3

H(z) = + z Response to sinusoid at ωs ( samples per cycle): Gain at ωs is 0. This very simple system is frequency selective, (i.e.) a lter. Analysis of the FIR lter We have seen how we may calculate the frequency response of a lter from its transfer function by setting z = e jωt. We can do this with the previous example: 4

Example of FIR frequency analysis: From the earlier example: H(z) = + z H(e jωt ) = + e jωt From this we can nd the magnitude response: = + (cos(ωt ) j sin(ωt )) = ( + cos(ωt )) j sin(ωt ) H(e jωt ) = ( + cos(ωt )) + sin (ωt ) = + cos(ωt ) + cos (ωt ) + sin (ωt ) = ( + cos(ωt )) H(e jωt ) = + cos(ωt ) And the phase response: H(e jωt ) = + e jωt = e jωt = ( cos (e jωt + e jωt ) ( ωt H(e jωt ) = tan sin ( ) ωt cos ( ) ωt ( ) ωt = ) ( ωt j sin )) ( ) ωt cos 5 Continued...

Example of FIR frequency analysis: (continued) The transfer function H(z) = + z has a zero at z = and a pole at z = 0: 6

In general, when the transfer function has real coecients (a[k] are real) the zeros of the of the transfer function will occur in conjugate pairs on the z-plane. 7

FIR Filters - II Linear Phase FIR digital lters A linear phase response is often desirable. Especially for video and data communications signals. The example in the previous lecture (FIR Filters - I) had an exactly linear phase response. Have a think about what linear phase response means! The following illustration shows it means that all sinusoidal components of a signal are delayed by the same amount. Hence there is no phase distortion.

Consider a lter with the phase response H(e jωt ) = ωt and suppose we input a sinusoid with frequency ω = π T rad/s. This gives a phase shift of H(e jω T ) = π T T = π Now suppose we input a sinusoid with frequency ω = 3π T H(e jωt ) = 3πT = 3π T rad/s. This gives a phase shift of As the frequency increases the phase shift increases (e.g. the angle by which the sinusoid is delayed by). π means delayed by one period. 3π means delayed by.5 periods. So it appears the sinusoids at higher frequencies are delayed more! But as the frequency, ω, increases, the period of the sinusoid decreases. So the actual time delay of any sinusoid input caused by the lter is xed and independent of the frequency.

General condition for phase linearity H(z) = M a[k]z k k=0 Say M is even (i.e.) we have an odd number (M + ) of coecients. H(z) = = M a[k]z k + a k=0 [ ] M M z M + a[k]z k k= M + M [ ] a[k]z k+ M M M + a + a[k]z k+ k=0 k= M + M z M Now let z = e jωt. H(e jωt ) = +a + M k=0 [ M M { (( a[k] cos k + M ) ) (( ωt + j sin k + M ) )} ωt ] k= M + a[k] { (( cos k + M ) ) (( ωt + j sin k + M ) )} ωt e j MωT In the second sum let l = k + M (hence, k = M l). when k = M +, l = M. when k = M, l = 0 H(e jωt ) = +a M k=0 [ M M + l=0 { (( a[k] cos k + M ) ) (( ωt + j sin k + M ) )} ωt ] { ( ( a[m l] cos l + M ) ) ( ( ωt + j sin l + M ) )} MωT ωt j e Now, if we replace l by k in the last term, and let a[k] = a[m k] for k = 0,..., M we get: H(e jωt ) = M k=0 = A(ω) }{{} Real { (( a[k] cos k + M MωT j e ) )} [ ] M MωT ωt + a j e, then 3

(The sin terms will cancel since sin(α) + sin( α) = 0) [ ( ) ( )] MωT MωT H(e jωt ) = A(ω) cos j sin. Remembering the denition of the phase response: This is a linear response: H(e jωt imag ) = tan real = tan sin ( MωT = MωT cos ( MωT ) ). Group Delay The Group Delay of a system is dened as τ = φ, where φ is the phase response of the ω system. For the above FIR: which is a constant! φ = MωT τ = φ ω = MT This is the amount of time it takes for a signal to `get through' lter. 4

3 Filter coecients We have seen that a condition for linearity is a[k] = a[m k] M is called the lter order. nd order lter has 3 coecients, etc. This condition implies even symmetry in the coecients. (e.g.) M = 8. (i.e. 9 coecients) The group delay is τ = MT = 4T 5

We can also show that the condition a[k] = a[m k] also makes a linear phase lter if M is odd. (e.g) M = 9 (i.e. 0 coecients) Group delay: τ = MT = 9T. 6

It can also be shown that odd symmetry leads to a linear phase response. (a[k] = a[m k]) (e.g.) M = 4 Since there are an odd number of coecients the middle coecient must be zero to get odd sysmmetry. (e.g.) M = 5 7

4 Zeros of a linear phase lter (even symmetry) M a[k]z k = k=0 = M a[m k]z k k=0 [ M ] a[m k]z M k k=0 z M Now let p = M k When k = 0, p = M. When k = M, p = 0. M a[k]z k = k=0 = [ M ] a[p]z p p=0 [ M ] a[k]z k k=0 z M z M Hence, if z = z is a zero of the transfer function, then so is z = z. The transfer function of a lter with linear phase which has a zero at z and therefore must have one at z = z. Since the lter has real coecients we know that there will also be a zero at z. and since the lter has linear phase, it must therefore have a zero at. z The same goes for the zero at z. 8

FIR Filters - III FIR Design Methods How to compute the coecients, a[k], to give us the desired frequency domain response.. Fourier Series Method (Windows Method) First, a reminder of the Fourier Series: If f(t) is periodic, Then, f(t) can be represented by a Fourier Series: f(t) = c[k]e jkω 0t k= (This is the complex form of the Fourier Series.) where, c[k] = T T f(t)e jkω 0t dt. T The Fourier series, as shown above, is for periodic functions of time We can apply the same technique to periodic functions of any variable. The frequency response of a digital lter is a periodic function of frequency, ω.

h = r(5,0.4); We see that the transfer function is periodic in ω with a period of π T and ω 0 = = π period π π/t = T Writing it as a Fourier Series: where, H(e jωt ) = c[k] = T π π T k= c[k]e jkt ω H(e jωt )e jkt ω dω π T But we know from the z-transform, H(z) = k= a[k]z k, evaluated at z = e jωt that: H(e jωt ) = a[k]e jkωt k= }{{} Allowing innite coecients So, by letting k = k in the RHS summation: k= a[k]e jkωt = k= = k= c[ k]e jkωt c[k]e jkωt } {{ } From above Hence, the coecients a[k] are given by a[k] = c[ k] = T π π T H(e jωt )e jωkt dω for k =,..., 0,..., π T This is the Filter Synthesis Formula.

H(e jωt ) = e jλωt ω c < ω < ω c 0 π T ω ω c and ω c ω π T Using the lter synthesis formula: a[k] = T π π T H(e jωt )e jkωt dω = T π = T π π T ω c ω c ω c e jλωt e jkωt dω e jω(k λ)t dω a[k] = ω ct π ω c sin(k λ)ω c T (k λ)ω c T, k =,...0,..., Let us be more specic: let λ = 0, and let ω c = ωs 8 = π 4T a[k] = sin ( ) kπ 4 ), k =,...0,..., 4 ( kπ 4 Continued... 3

Continued Take terms centered on k = 0 0.5 a[0] 0. 0.5 a[k] 0. 0.05 a[ 0] a[0] 0 0.05 0. 0 8 6 4 0 4 6 8 0 k In taking a nite number of lter coecients we should:. Center the samples on that part of the function containing most energy.. Preserve symmetry if a linear phase response is required. The samples above are the coecients of the dierence equation, the transfer function and the sampled values of the impulse response. This is non-causal; the lter must respond before the input has arrived! Taking λ = 0 makes this response causal. 0.5 a[0] 0. 0.5 a[k] 0. 0.05 a[0] a[0] 0 0.05 0. 0 4 6 8 0 4 6 8 0 k 4

Eects of rectangular windowing We have previously dealt with the eects of applying a rectangular window to select a nite number of samples from a signal. If we look at the previous example we see that since we took a nite number of coecients the lter response is not ideal: Magnitude response in db: 0 log 0 H(e jωt ). Magnitude (db) 0 0 40 60 80 Ideal Response Coefficients 3 Coefficients 0 0. 0. 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Normalized Frequency ( π rad/sample) 0 00 Phase (degrees) 00 300 400 500 600 700 800 0 0. 0. 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Normalized Frequency ( π rad/sample) The less coecients we use, the less sharp the cut-o will be. We see there is some ripple in the pass-band and stop-band. Note: As we increase the number of coecients used (i.e. use a wider window) the magnitude pass and stop-band ripples do not get any smaller! This is Gibb's phenomenon. If we use all coecients will get the ideal response (which is periodic in ω, which isn't shown here). 5

We can select a nite number of coecients using a rectangular window, whose Fourier transform is a sinc function. In the frequency domain the result of using a nite set of coecients becomes the convolution of the ideal response with the sinc of the rectangular window. As w(t) gets wider, W (jω) gets narrower. But when the narrower sinc is convolved with the ideal response, the ripples remain at the same amplitude. We see that as the number of coecients increases (wider window) the response approaches that which we want, but not gracefully!! 6

3 Tapered windows Instead of using rectangular windows we can use a tapered window (`bell-shaped'). 3. Hamming window (a raised-cosine window) ( w[k] = 0.54 0.46 cos π k ), for k = 0,,..., M M This is for designing an FIR lter with M + coecients (order M). 0.9 0.8 0.7 0.6 w[k] 0.5 0.08 0.4 0.3 0. 0. 0 0 4 6 8 0 4 6 8 0 k 7

Aside: Von Hann window: ( w[k] = 0.5 0.5 cos π k ), for k = 0,,..., M M used for spectral analysis (Known in the USA as a Hanning window! ) 0.9 0.8 0.7 0.6 w[k] 0.5 0.4 0.3 0. 0. 0 0 4 6 8 0 4 6 8 0 k For the coecient low-pass lter example the Hamming weighted coecients are: a[k] = [ ωc T π sin(k 0)ω c T (k 0)ω c T ] [ 0.54 0.46 cos ( π k 0 )], for k = 0,,..., 0 3. Kaiser window There are many (many!) dierent windows. Here's another one: The Kaiser Window. Non-causal form: w[k] = I 0 (β ( ) ) k N I 0 (β), for k = N,..., 0,..., N (for N + coecients) I 0 (x) is a modied Bessel function of the rst kind and zero order I 0 (x) can be approximated by: m chosen depending on accuracy. β gives a compromise between: ) m x M I 0 (x) + ( m= m! 8

. width of main lobe (i.e. the rate of cut-o in the transition band), and. the side lobe level (i.e. the stop-band attenuation). Usually 4 β 9 3.% Side-lobe levels 0.047% Below is the causal version of a point Kaiser window (N = 0). 0.9 0.8 0.7 0.6 w[k] 0.5 0.4 0.3 0. 0. 0 0 4 6 8 0 4 6 8 0 k 4 Performance of dierent windows Below is the magnitude response of the coecient low-pass lter designed earlier. Also shown is the result when coecients have been weighted using 3 dierent tapered windows. 9

0 0 0 Filter using Rectangular window Filter using Hamming window Filter using Von Hann window Filter using Kaiser window 0 0log 0 H 30 40 50 60 70 0 0.5.5.5 3 3.5 ω T The trade-o between cut-o rate and stop-band attenuation are obvious. Nearly all windows are symmetric If a linear phase lter is being designed the window must be applied in a way that preserves phase linearity! 5 Iterative design techniques There exist a number of techniques which are iterative rather than analytical (they use computers). Given a desired frequency response for the lter:. Make a guess about the coecients.. Check the error. (The dierence between the actual and desired frequency response.) 3. If `close enough' then stop. 4. Improve guess by changing the coecients. 5. Go to. One famous algorithm is the Remez algorithm. 0

FIR Filters IV Block Diagrams. Building Blocks Adders: x[n] z[n] = x[n] + y[n] y[n] Multiplier (by a constant): x[n] c y[n] = cx[n] Delay Element: This is implemented in practice as a parallel-in-parallel-out shift register. (i.e.) A bank of ip-ops. x[n] x[n ] z

Tapped delay line implementation We can show the signal ow diagram for the FIR lter 4 y[n] = a[k]x[n k] k=0 is given by: x[n] x[n ] x[n ] x[n 3] z z z z x[n 4] a[0] a[] a[] a[3] a[4] y[n] This same calculation can be performed using the following topology: x[n] a[4] a[3] a[] a[] a[0] z z z z y[n] Prove that this provides the same transfer function.

3 Cascasde implementation Given the 6 th order transfer function H(z) = a[0] + a[]z + a[]z + a[3]z 3 + a[4]z 4 + a[5]z 5 + a[6]z 6 we can factorise it to get a cascade implementation. (e.g.) H(z) = H (z) H (z) H 3 (z) = (b[0] + b[]z + b[]z )(c[0] + c[]z + c[]z )(d[0] + d[]z + d[]z ) x[n] y[n] z[n] H (z) H (z) H (z) w[n] x[n] x[n ] x[n ] z z b[0] b[] b[] y[n] z y[n ] z y[n ] c[0] c[] c[] z[n] z z[n ] z z[n ] d[0] d[] d[] w[n] However, we see that we are now using 9 multipliers rather than 7. 3

4 Linear Phase lter We saw before that a linear phase lter must have odd or even symmetry in its coecients. We can achieve even symmetry using the following conguration Say for M = 6 (odd number of coecients): x[n] x[n ] x[n ] x[n 3] z z z z z z a[0] a[] a[] a[3] y[n] Linear phase lters use less multipliers. 4

IIR Filters I Innite Impulse Response (IIR) Digital Filters These are described by the following dierence equation: y[n] = M L a[k]x[n k] b[k]y[n k] k=0 k= Or in the z-domain: Ỹ (z) X(z) = the transfer function of the system. H(z) has poles and zeros. M k=0 a[k]z k + = H(z) L k= b[k]z k Example: y[n] = x[n] + 0.8y[n ] H(z) = 0.8z No zeros. One pole at: 0.8z = 0 z = 0.8.

Unit impulse response: {, 0.8, 0.8, 0.8 3,... } Step response: {,.8,.44,.95, 3.36,...} (Exercise)

Sinewave response @ ωs : Analytically: Frequency response: Magnitude response: H(z) = H(e jωt ) = 0.8z 0.8e jωt For ω = 0: H(e j0t ) = = 0.8e j0t 0.8 = 5 For ω = ωs (ωt = π): H(e jπ ) = = 0.8e jπ + 0.8 = 0.56 3

Phase response: [ ] H(e jωt ) = 0.8e jωt = [ 0.8e ] jωt = [ 0.8 cos (ωt ) + j0.8 sin (ωt )] = tan 0.8 sin (ωt ) 0.8 cos (ωt ) = (not linear) Stable IIR lters cannot have a linear phase response. 4

Signicance of Pole and Zeros. Magnitude response Where z i are the zeros And p i are the poles. H(z) = M k=0 a[k]z k + L k= b[k]z k = G (z z )(z z )(z z 3 ) (z z M ) (z p )(z p )(z p 3 ) (z z L ) H(e jωt e jωt z e jωt z e jωt z M ) = G e jωt p e jωt p e jωt z L Example: Pole-Zero plot H(e jωt ) = G e jωt z e jωt p e jωt p e jωt q is the distance from e jωt to the point q. H(e jωt ) = G d d d 3 Product of distances to zeros Product of distances to poles The following plot would represent the transfer function of a band-pass lter: 5

. Phase response A similar interpretation can be made for the phase response: Which gives: H(z) = M k=0 a[k]z k + L k= b[k]z k = G (z z )(z z )(z z 3 ) (z z M ) (z p )(z p )(z p 3 ) (z z L ) H(e jωt ) = G + (e jωt z ) + (e jωt z ) + (e jωt p ) (e jωt p ) H(e jωt ) = G + θ θ θ 3 6

3 Example: Place a spectral null at ωt = π 3 We need a zero on the unit circle at z = e j π 3. However if we want the lter coecients to be real we must put a zero at the complex conjugate position, z = e j 4π 3. This gives the following transfer function: H(z) = H(e jωt ) = ( ) ( ) z e j π 3 z e j 4π 3 e jωt e j π 3 e jωt e j 4π 3 = L L or multiplying out: H(z) = + z + z h[n] = {,, } The pole-zero plot for this function is shown below. 7

This is essentially a low-pass lter. We would have expected as much since the output of the lter, y[n], is the sum of the present input and two previous inputs: y[n] = x[n] + x[n ] + x[n ]. We can imagine the zeros as depressions in the surface of the function H(z) as is shown below. Note that any component in the input signal at which ωt = π 3 will be completely removed. The lter is said the have a notch at ωt = π 3. 0 log 0 ( H(z) ).5 3.5 0.5 0.5 0 0.5 0 0.5.5.5 Im[z] Re[z] This is an FIR lter and is therefore stable. We will see in following lecture that placing poles outside the unit circle will make the resulting lter unstable. 8

IIR Filters - II Stability of IIR Digital Filters Denition: A system is stable if a bounded input signal always produces a bounded output. (i.e.) if the input x[n] M for all n then the output y[n] Q for all n

. Time-Domain Criterion Theorem: If h[j], for j =,..., 0,...,, is the unit impulse response of a digital lter, then a necessary and sucient condition for stability is that: h[j] < () k= Proof: Say the input x[n] is bounded such that x[n] < M n (where M is a positive constant), then which gives: y[n] = h[j]x[n j] j= y[n] h[j] x[n j] j= M h[j] j= Hence the output is bounded is Eq. () holds. This proves the suciency. To conrm necessity we are required to nd a bounded input that produces an unbounded output when Eq. () does not hold. For example consider this input: if h[j] > 0 x[n 0 j] = if h[j] < 0 (n 0 is a xed integer.) Then for output sample at n = n 0 : y[n 0 ] = = h[j]x[n 0 j] j= h[j] j= Thus y[n] is unbounded if Eq. () does not hold, which conrms the necessity. Q.E.D.

Example: Digital lter described by dierence equation: y[n] = αy[n ] + x[n] It's easy to show (by using z transform, followed by geometric series expansion) the impulse response is: h[j] = α j for all j 0 Hence: h[j] = α j. j= j= This is nite only if α <. 3

. z-plane (frequency-domain) Criterion The transfer function of of a digital lter (factorised) is: Mi= ( z i z H(z) ) = G Li= ( p i z ) Expanding H(z) using partial fractions: H(z) = L i= r i ( p i z ) = L i= H i (z) () If we take the inverse z-transform of both sides of Eq. which is due to a contribution, h i [j], from each pole p i : () we get the impulse response h[j] L h[j] = h i [j] j =,...0,...,. i= If the lter is stable, Eq. () must apply to each h i [j]. 4

Case : A pole on the real axis Consider H i (z) = r i ( p i z ), where p i is real. H i (z) = r i p j i z j j=0 (by geometric series). Hence h i [j] = r i p j i for j 0. This sequence diverges for p i >. So p i for a stable response. (i.e.) the pole must be inside the unit circle. 5

Case : Pair of conjugate poles p i = Re ±jθ r i H i (z) = Re jθ z + ri Re jθ z = ( r i Re jθ z ) m ( + r i Re jθ z ) m m=0 m=0 Let r i = ρe jφ, thus H i (z) = ρe jφ R m e jmθ z m + ρe jφ R m e jmθ z m m=0 j=0 Therefore: h i [m] = ρe jφ R m e jθm + ρe jφ R m e jθm = ρr m e j(mθ+φ) + ρr m e j(mθ+φ) = ρr m cos (mθ + φ) for m 0. This is stable if R < (i.e.) if poles are inside the unit circle. 6

Summary The necessary and sucient condition for a digital lter to be stable is that all its poles lie inside the unit circle. 7

IIR Filters - III Ad-hoc Pole-Zero Placement: Notch Filter Our insight into the how poles and zeros aect the amplitude response of the lter can be abused to do some ah-hoc lter design. One classic example is the `notch' lter. Suppose we want a lter which stops all frequncies at fs 3 ωt = π 3. We can add a zero at z = e j π 3 (and a conjugate zero at z = e j 4π 3 ). We saw in a previous lecture that the response of a lter with these zeros is H(z) = ( ) ( ) z e j π 3 z e j 4π 3 H(e jωt ) = e jωt e j π 3 e jωt e j 4π 3 = L L

We see frequencies at ωt = π 3 attenuated. are stopped. However, near by frequencies are also greatly We can augment the lter above by adding a pole: We must keep the pole inside the unit circle and we want to place it as near as possible to the zero. Let's place it at z = p = 0.95e j π 3. But we must also place one at the complex conjugate position to keep the lter coecients real: z = p = 0.95e j 4π 3. Now we have a new lter, H(z) = = ( ) ( ) z e j π 3 z e j 4π 3 ( ) ( ) z 0.95e j π 3 z 0.95e j 4π 3 + z + z + (0.95)z + (0.95) z z H(e jωt ) e j = π 3 z e j 4π 3 z 0.95e j π 3 z 0.95e j 4π 3 = L L M M.

Notice that when when z is far away from a pole-zero pair i, the absolute value of their ratio, let's call it R i (z), is approximately unity, i.e., for z far away from e j π 3. R i (z) = L M = z e j π 3 z 0.95e j π 3 This is exactly what we want, a zero at the specied frequency and approximately unity gain elsewhere. 3

The diagram below shows the function H(z) evaluated over the z-plane. Again, we nd the magnitude of the frequency spectrum, H(e jωt ), by circumnavigating the unit circle, z = e jωt. 0.5 0 log 0 ( H(z) ) 0.5.5.5 0.5.5 0.5 0 0.5.5.5 0.5 0 Im[z] Re[z] 4

A plot of H(e jωt ) (the height of the unit circle above the z-plane) is shown below..4. Magnitude 0.8 0.6 0.4 0. 0 0 0. 0. 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ωt (π) 5

All-pass IIR stabilisation We saw in the previous lecture that IIR lters with poles outside the unit circle are unstable. Here we see how to stabilise them while keeping the magnitude response the same. Consider the following lter Ã(z) = pz p ( ). p z This lter has a zero at z = p and a pole at z = p, where denotes the complex conjugate. We can examine what the magnitude of the frequency response is: Ã(z) = p + z ( p ) z Ã(e jωt ) = p + e jωt ( ) p e jωt ( ( p) ) e jωt = e jωt ( p ) e jωt = e jωt { b b } Ã(ejωT ) = The magnitude response of the lter at all frequencies is unity. So what! Well suppose we have designed a lter which has a pole, p, outside the unit circle. This lter will be unstable. However, the allpass lter removes that pole by placing a zero there, and a new pole is placed at the position (the distance from the origin is now the inverse of the original distance). p There is also a p factor to ensure the gain is one. We can make any IIR lter stable with the same magnitude response. Unfortunately the phase is altered. 6

Example: Make the lter with the following transfer function stable: H(z) = ( ( j)z ) ( ( + j)z ) = z + z. The poles lie at p = + j and p = j, which are outside the unit circle. The magnitude and phase response are as follows. 5 0 Magnitude (db) 5 0 5 0 0. 0. 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ωt (π) Phase (degrees) 400 350 300 50 00 50 00 50 0 0 0. 0. 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ωt (π) 7

We transform one pole at a time by multiplying by an allpass lter. The new transfer function is: H Stable (z) = = ( ) ( j)z ( ( ) ( j) z ) ( ( j)z ( ) ( + j)z ( ( ) ) ( + j) z ) ( ( + j)z ) ( j) ( ( j +j = (0.5)z + z = z + z ) ) z ( + j) ( ( j ) z ) +j This stable lter has poles at z = 0.5 ± j0.5. Since they are inside the unit circle the lter is stable. The magnitude and frequency response of the stable lter is shown below. 5 0 Magnitude (db) 5 0 5 0 0. 0. 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ωt (π) Phase (degrees) 0 0 0 30 40 50 60 70 0 0. 0. 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ωt (π) 8

IIR Filters - IV IIR Design Methods How to choose the coecients, {a[k]} and {b[k]}, such that the lter has the desired magnitude and phase response.. Method : Impulse Invariance Impulse invariance is rarely used as a design method. However it is the most obvious approach and is a good educational example! Start with a reference analog lter whose amplitude response we wish to emulate. We emulate the lter by designing the digital lter whose impulse response is a sampled version of the analog lter impulse response. Since the impulse response has innite duration we must employ some mathematical trickery (the geometric series, surprise surprise!) to do this...

Suppose the analog transfer function is H A (s). Express H A (s) as a partial fraction expansion: The s i are the poles of the analog lter. The corresponding impulse response is: H A (s) = L i= h A (t) = L [ L = i= L r i e s it i= r i (s s i ). ] r i (s s i ) Now sample this: L h A (nt ) = r i e s int i= Take the z-transform of both sides: H(z) = = = = ( L n= L r i i= n= L r i i= n=0 L i= r i e s int i= ) z n ( e s i T z ) n ( e s i T z ) n r i e s it z since h(t) is causal To compensate for scaling (see sampling theorem) caused by sampling we use T H(z) as the transfer function. Aside: A pole at s = s i maps to a pole at z = e sit = e σit e jω it If s i is in the left half plane (σ i < 0) (s-plane) then e sit is inside the unit circle (e σit < ). Stable analog lter Stable digital lter.

From sampling theorem: T H(e jωt ) = T T ( H A (j ω πm )) m= T Aliasing occurs in frequency response of lters. This essentially limits the method to the design of lowpass lters. The upper cut-o must be signicantly lower than fs in order to minimise aliasing eects. 3

Example: v o v i = H A (s) = v o = v i sc R + sc RC s + RC = H A (s) ω c, ω c = s + ω c RC Impulse invariance: H(z) = ω c T e ωct z y[n] = (ω c T )x[n] + e ωct y[n ] Say ω c = π 000 rad/s ( khz) and ω s = π 0 4 rad/s (0 khz). 5 0 Digital Filter response 0log 0 ( H ) (db) 5 0 Deviation due to aliasing Analog Filter response 5 3dB point 0 0 000 000 3000 4000 5000 6000 7000 8000 9000 0000 f (Hz) 4

For higher order H A (s) Preform partial fraction expansion. Map each pole to z = e sit. Recombine the terms to get a ratio of polynomials in z (i.e. H(z)). Note: Coecients must be real! 5

IIR Filters - V IIR Design Methods:. Bilinear transform One commonly used technique is the Bilinear Transform. analog lter, H A (s), and we do the following transformation: s z + z, We take a transfer function for an which will give us the digital lter ( ) z H D (z) = H A + z The frequency response of the analog lter, H A (s), is given by setting s = jω A. The frequency response of the digital lter, H(z), is given by setting z = e jω D T (ω A denotes analog frequency, ω D denotes digital frequency). So the digital and analog lters have the same frequency response when s = z + z jω A = e jω DT + e jω DT ( ) jωd T = tanh = j tan ω DT ω A = tan ω DT

This maps the entire frequency range of the analog lter, ω A (0, ), into the range (0, π) of the normalised digital frequency ω D T only once. Hence, there is no aliasing. The nature of the response is unchanged. The left half plane is mapped once only to the inside of the unit circle so the lter is once again stable given a stable analog prototype: This method is suitable for banded lters. Not suitable for arbitrary responses. The only drawback seems to be the warping of the frequency axis. We get around this by pre-warping...

. Design Procedure So if we are given the design specication of a digital lter we:. Decide on the desired critical frequencies (band edges) ω i D.. Prewarp the specied ω D frequencies to get the specs for the analog lter: ω i A = tan ωi D T To see this: ( ωd i T = tan (ω i A) = tan tan ωi D T ) = ωi D T. 3. Design the analog lter to obtain its transfer function, H A (s). 4. Substitute s = z +z to get the digital transfer function ( ) z H D (z) = H A. + z If the analog transfer function is rational in s then the digital transfer function is rational in z and has the same order. 3

Example: Design a 3 rd order low-pass digital lter with a sampling frequency of 8 khz and a cut-o (3dB point) at 89.3 Hz. Use an analog Butterworth as the prototype. Step : Decide on digital frequencies. We have one critical frequency at ω DT = π(89.3) 8 0 3 Step : Prewarp. ( ) ω ωa = tan D T ( ) π(89.3) = tan 8 0 3 =.0 Step 3: Design 3 rd order analog low-pass Butterworth lter with ω c =.0. From the tables: H A (s) = (s + )(s + s + ) s s ω c gives a cuto at ω c. Apply s to get: H A (s) = = ( s + ) ( s 4 + s + ) (s + )(s + s + 4) Check that H A (jω) ω= =. This is the analog prototype. 4

Step 4: Apply s z +z H D (z) = = = Check at ω D T = 0 z = 8 (( ) ) ( ( ) z +z + z ( ) ) +z + z +z + 4 8( + z ) 3 (z + 3)(z + 6z + 8z ) 8 ( + 3z + 3z + z 3 ) ( + 5 z + 5 z + 3 z 3 ) H D (z) = 64 z= 64 = Check at ω D T = π z = H D (z) = 0 z= 5

Special types of analog prototype. Butterworth Filter The butterworth lter is special in that has a maximally at response over the passband. H(jω A ) = + ( ω A ωc ) n n th order lter Here's a sketch of the analog response: The digital butterworth response looks like this: 6

. Chebyshev Filter The Chebyshev lter is special in that it gives you the sharpest cut-o for a given amount of ripple in either the pass-band (Type- lter) or the stop-band (Type-II lter). Elliptic lters can give an even sharper cut-o by allowing ripple in both the pass-band and stop-band. For Type-I lters: H A (jω A ) = ( ) + ɛ V ωa n ωc V n is a Chebyshev polynomial of degree n. The analog reponse (for Type I) looks like this: The digital response looks like: H D (e jωdt ) = + ɛ V n ( tan ωdt tan( ωct ) ) The actual transfer function is found using the bilinear transform. 7

3 Frequency transformations There are two ways to use the bilinear transform to design a lter: 8

3. Analog to analog frequency transformation LP LP s s ω c LP HP s ωc s LP BP s s +ω ω s(ω ω ) LP BS s s(ω ω ) s +ω ω 4 Other design methods for IIR lters Are iterative and require a computer. In practice, if your lter specication is not simply a banded lter, you will use one of these iterative techniques. 9

IIR Filters VI Realisation of IIR lters M L y[n] = a[k]x[n k] b[k]y[n k] k=0 k= }{{} Non-recursive } {{ } Recursive There is clearly a division between the recursive and non-recursive parts.

Since each part is a linear system, we can change the order if we like without changing the overall transfer function.

We see that we are using almost twice as many delay elements as we need. We can make savings by using the following structure. This conguration is known as Direct Form II. 3

We can check if this will give us the desired transfer function (or dierence equation same thing!): w[n] = x[n] L b[j]w[n j] j= y[n] = = = = M a[k]w[n k] k=0 M L a[k] x[n k] b[j]w[n k j] k=0 j= M L M a[k]x[n k] b[j] a[k]w[n k j] k=0 j= k=0 M L a[k]x[n k] b[j]y[n j] k=0 j= Q.E.D. }{{} y[n j]from two lines above The general principle of signal ow diagrams is that there should be no delay free loops. 4

Example: A second order transfer function H(z) = a[0] + a[]z + a[]z + b[]z + b[]z This is a Direct Form II implementation. 5

Exercise: Direct Form I Show the following Direct Form I conguration provides the same transfer function. Direct Form structures have the minimum number of delay elements and coecients possible. They are said to be canonical. 6

Cascade Realisation We can factorise the transfer function: H(z) = H (z) H (z) H 3 (z) 7

3 Parallel Realisation Or, we can nd a partial fraction expansion of the tranfer function: H(z) = H (z) + H (z) + H 3 (z) 8