Julien OSTER, [email protected]/teaching/cdt/A3/4_A3...for all values of the complex...

35
DEPARTMENT OF ENGINEERING SCIENCE CDT IN HELTHCARE INNOVATION Julien OSTER, [email protected] Dr. Julien Oster, Postdoctoral Researcher Institute of Biomedical Engineering, University of Oxford

Transcript of Julien OSTER, [email protected]/teaching/cdt/A3/4_A3...for all values of the complex...

Page 1: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

DEPARTMENT OF ENGINEERING SCIENCE

CDT IN HELTHCARE INNOVATION

Julien OSTER,

[email protected]

Dr. Julien Oster, Postdoctoral Researcher Institute of Biomedical Engineering, University of Oxford

Page 2: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

Signals can be characterized by their frequency content:

Music

Light

Let’s define tools for characterizing the frequency response of the filter

03 November 2013 More on Digital Filtering, Julien Oster Page 2

Page 3: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

Let us consider x[n] = eiωn

eiωn are eigenfunctions of LTI systems and is the eigenvalue If x[n]=Asin(ωn+ω0) then y[n]=A sin(ωn+ω0+ϕ)

is the frequency response of the filter

03 November 2013 More on Digital Filtering, Julien Oster Page 3

y[n] = h[m]x[n-m]m=-¥

¥

å

y[n] = h[m]e-iwmeiwn

m=-¥

¥

å

y[n] = x[n] h[m]e-iwm = x[n]H (e-iw )m=-¥

¥

å

y[n] = x[n] H (e-iw ) eif

H(e-iw )H(e-iw )

H(e-iw )

Page 4: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

Generalization of Frequency response (because Fourier transform doesn’t exist for all time series)

Is equivalent to the Laplace transform in Analogue filtering If x[n]=zn

The output of the system is thus equal to the input, multiplied by a

complex constant H(z). The complex exponential signal zn is said to be an eigenfunction of

the linear, time invariant system h[n]. H(z) is the z-transform of h[n]. z defines a plane, with the real and the imaginary parts (as

orthogonal coordinates).

03 November 2013 More on Digital Filtering, Julien Oster Page 4

y[n]=x[n]H[z]

For LTI systems described by an impulse response h[n], H(z)

is referred to as the system function or transfer function.

Page 5: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

Consider the class of digital filters described by linear, constant coefficient,

difference equations of the form

Substituting y[n]=H[z]x[n] produces:

Dividing both sides by zn and rearranging terms gives which is the transfer function

03 November 2013 More on Digital Filtering, Julien Oster Page 5

Page 6: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

The K complex roots of the denominator of H(z) are

called the poles of the filter,

while the M roots of the numerator are called zeros.

03 November 2013 More on Digital Filtering, Julien Oster Page 6

Page 7: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

1. The Z-transform of simple digital filters can be computed by:

1. Direct application of if the impulse response h[n] is known

2. , if the difference equation is known

2. We will use the notation to denote the relation

between the signal h[n] and its z-transform H(z).

1. Gain: i.e., the z-transform of the unit sample δ[n] is 1. 2. Delay by n0 samples: , so z-1 denotes unit delay.

03 November 2013 More on Digital Filtering, Julien Oster Page 7

Page 8: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

3. Rectangular filter of length N:

The filter has N-1 zeroes equally spaced on the unit circle (Except for z=1)

4. First-order recursive low-pass filter y[n]=ay[n-1]+x[n]

The filter has a pole at z=a.

03 November 2013 More on Digital Filtering, Julien Oster

Page 8

Page 9: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

The z-transform is a linear operation in the sense that

where c1 and c2 are arbitrary constants. This implies that the z-transform of a parallel combination of

filters is the sum of the transforms for each of the filters.

The most important property of z-transforms is the convolution theorem

03 November 2013 More on Digital Filtering, Julien Oster Page 9

Because it replaces the complicated convolution operation by a simpler multiplication,

this theorem is useful for computing the responses of digital filters to signals given

by analytic expressions and for finding the impulse response of cascades of filters.

Page 10: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

Proof of convolution theorem: Taking the z-transform of

Interchanging the order of summations over n and

m, and using

Making the change of variable l=n-m, we recognize

the product of H(z) and X(z).

03 November 2013 More on Digital Filtering, Julien Oster Page 10

Page 11: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

For signals of finite duration, the z-transform is well defined for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters always converge.

On the other hand, the z-transforms of IIR filters are only defined for certain values of z.

The region of convergence is the portion of the complex z-plane for which the summation

converges. For example, the z-transform of the first-order recursive

low-pass filter h[n]=anu[n] is . The corresponding region of convergence is then |z| > |a|.

03 November 2013 More on Digital Filtering, Julien Oster Page 11

Page 12: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

We saw earlier that the system is stable is its impulse response is absolutely summable. In this case, the z-transform converges for |z|=1, that is the values of z that are on the unit circle.

Since the region of convergence of a stable filter must include the unit circle and since the region of convergence must be a continuous region and not include any poles, we conclude that the z-transform of a stable filter has all poles either inside or outside the unit circle.

If we restrict our consideration to causal filters which require that the region of convergence be the exterior of a circle, then we conclude that the region of convergence of a causal stable filter is the outside of a circle whose radius is less than unity and the poles of a causal stable filter are all inside the unit circle.

There is no restriction on the location of zeros for causal, stable filters.

03 November 2013 More on Digital Filtering, Julien Oster Page 12

Page 13: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

Once the poles and zeros have been found for a given z-Transform, they can be plotted onto the z-plane. The z-plane is a complex plane with an imaginary and real axis referring to the complex-valued variable z.

03 November 2013 More on Digital Filtering, Julien Oster Page 13

When mapping poles

and zeros onto the

plane, poles are denoted

by an "x" and zeros by

an "o".

Page 14: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 14

Page 15: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 15

Page 16: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 16

Page 17: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

When deciding on what filter to design for a given task we need to consider:

IIR or FIR? FIR are always stable but IIR can be computationally efficient...

Lowpass, highpass, bandpass, bandstop? Depends on the task at hand...

Order? Trade-off between computation time and complexity.

The objective is to obtain a reliable transfer function H(z) approximating a desired frequency response. That is best done in the frequency domain.

03 November 2013 More on Digital Filtering, Julien Oster Page 17

Page 18: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

Low-pass: designed to pass low frequencies from zero to a certain cut-off frequency and to block high frequencies.

High-pass: designed to pass high frequencies from a certain cut-off frequency to π and to block low frequencies.

Band-pass: designed to pass a certain frequency range which does not include zeroand to block other frequencies.

Bandstop: designed to block a certain frequency range which does not include zeroand to pass other frequencies.

The frequency band where the signal is passed is the passband. The frequency band where the signal is removed is the stopband.

03 November 2013 More on Digital Filtering, Julien Oster Page 18

Page 19: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 19

Page 20: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 20

All frequencies suffer the same delay In some applications (ECG for example) this is important

Page 21: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 21

Page 22: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 22

What is the delay of FIR filters:

h[n] = δ[n]-δ[n-1]

h[n]=Σ0mδ[n-m]

Page 23: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

Ideal low-pass Filter example

03 November 2013 More on Digital Filtering, Julien Oster Page 23

Page 24: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 24

Consider and

Page 25: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 25

Page 26: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 26

Page 27: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 27

Page 28: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 28

Page 29: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

As M increases, transition band gets narrower, but the ripple remains!

03 November 2013 More on Digital Filtering, Julien Oster Page 29

Page 30: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

Hamming, Hanning and Blackman windows.

They all provide different trade-offs wrt the width of the main lobe and the ripple effect.

03 November 2013 More on Digital Filtering, Julien Oster Page 30

Page 31: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

There are much less ripples with the Hanning window but the transition width has increased. That can be improved by increasing the size of the window.

03 November 2013 More on Digital Filtering, Julien Oster Page 31

Page 32: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 32

Page 33: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 33

Page 34: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

03 November 2013 More on Digital Filtering, Julien Oster Page 34

Page 35: Julien OSTER, julien.oster@eng.ox.acgari/teaching/cdt/A3/4_A3...for all values of the complex variable z because it is a finite sum of finite terms. Thus, the z-transforms of FIR filters

Use filter designed for analogue filtering

Butterworth (flat in the pass-band)

Chebyshev (equi-ripples, faster transition)

In Matlab:

Use functions butter or cheby2.

03 November 2013 More on Digital Filtering, Julien Oster

Page 35