24
3.3.3 Derivative-based operators to remove low- frequency artifacts

3.3.3 Derivative-based operators to remove low-frequency artifacts

Embed Size (px)

Citation preview

3.3.3 Derivative-based operators to remove low-frequency artifacts

H(f)X(t) dx(t)/dt

f

|H(f)|

Differentiation HPF (highpass filtering) L[d/dt] = s

Continuous-time signals:

H(f)X(t) x(t)dt

Integration LPF (lowpass filtering) dt = 1/s

f

|H(f)|

H(z)x(n) y(n)

f

|H(f)|

Difference HPF Z[x(n) - x(n-1)] = (1 - z^-1) X(z)

Discrete-time signals:

H(z)X(n) x(n) + x(n-1)

Summation LPF (lowpass filtering)

f

|H(f)|

y(n) = [x(n) – x(n-1)]/T, T = sampling frequency

Z[x(n) + x(n-1)] = (1 + z^-1) X(z)

Matlab command: freqz

),,(

:responseequency plot thefr To

],,,,[

],,,,[

pi) and 0between (normally mpleradians/sain frequency, : w

responsefrequency :H

),,(],[

:responsefrequency obtain the To

)(

210

210

22

11

00

22

11

00

NABfreqz

aaaaA

bbbbB

NABfreqzwH

zazazaza

zbzbzbzbzH

n

m

nn

mm

Matlab command: freqz

])1[],1,1([])1,1([]1,1[

]1[],1,1[

1)(1

:

12

21

10

0

22

11

00

freqzORfreqzwH

AB

zzazazaza

zbzbzbzbzH

Example

nn

mm

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

20

40

60

80

100

Normalized Frequency ( rad/sample)

Phase (

degre

es)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-50

-40

-30

-20

-10

0

10

Normalized Frequency ( rad/sample)

Magnitude (

dB

)

In MatLab,Normalized with respect to fs/2Normalized with

respect to fs

ECG signal with baseline drift (, and high-frequency noise)

Baseline drift

What we want : to eliminate the baseline drift.

In this section, three derivative-based operators will be introduced.They are Filter 1, Filter 2, & Filter 3.

Filter 1: First-order difference operator

H(z)x(n) y(n)

Difference HPF

Z[x(n) - x(n-1)] = (1 - z^-1) X(z)

y(n) = [x(n) – x(n-1)]/T, T = sampling frequency

-1.5 -1 -0.5 0 0.5 1 1.5

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Real Part

Imag

inar

y P

art

Pole/Zero Plot

How to generate pole-zero plot in Matlab

(1. Use “Matlab help”(2. Search “pole-zero plot”(3. Choose “zero-Pole Analysis”(4. Use “fvtool”

Example: Fvtool([1 -1],[1])

Filter 1: First-order difference operator

B = [1 -1]; A = [1];freqz(B,A,200,1000)

0 50 100 150 200 250 300 350 400 450 5000

20

40

60

80

100

Frequency (Hz)

Phase (

degre

es)

0 50 100 150 200 250 300 350 400 450 500-40

-30

-20

-10

0

10

Frequency (Hz)

Magnitude (

dB

)>>help freqz[H,F] = FREQZ(B,A,N,Fs) and [H,F] = FREQZ(B,A,N,'whole',Fs) return frequency vector F (in Hz), where Fs is the sampling frequency (in Hz).

0 100 200 300 400 500 600 700-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

3

Estimation of the frequency components of ECG

Filter 1: frequency response

Figure 3.22

Frequency: f(T) < f(P) < f(QRS) < f(noise)Amplification: A(T) < A(P) < A(QRS) < A(noise)

High-frequency noise

Any problem in phase response? No, because of phase linearity

QR

S (1

7 H

z)P

(5.6

Hz)

T (4

.5 H

z)

Baseline drift

Filter 1: the output

Figure 3.24

Why do P and T waves disappear?What is the gain for them?

270 280 290 300 310 320 330 340 350 360 370

-1

0

1

2

3x

270 280 290 300 310 320 330 340 350 360 370-1

-0.5

0

0.5

y

n

Filter 2: How to attenuate HF as well as LF noise

2/]1,0,1[2

1

)(

)()(

2/)]2()([

2/)]}2()1([)]1()({[

int2/)]1()([)(

)1()()(

23

3

3

Bz

zX

zYzH

nxnx

nxnxnxnx

egrationnynyny

aldifferentinxnxny

H3(z)x(n) y3(n)

[H3 w3] = freqz([1/2,0,-1/2])

Filter 2 --- frequency response

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-100

-50

0

50

100

Normalized Frequency ( rad/sample)

Pha

se (

degr

ees)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-50

-40

-30

-20

-10

0

Normalized Frequency ( rad/sample)

Mag

nitu

de (

dB)

[H3 w3] = freqz([1/2,0,-1/2])

Filter 2 frequency response

Figure 3.23

High-frequency noise

Filter 2 the output

Figure 3.25

Filter 3

y(n+1) = x(n+1) - x(n) + 0.995 * y(n)y(n) = x(n) - x(n-1) + 0.995 * y(n-1)

Filter 3 frequency response

Filter 3:

Figure 3.26

Filter 3 frequency response

Figure 3.27

Filter 3 the output

Figure 3.28