dspb digital signal processing in bioengineering rate changing in the discrete domain by using only...

62
DSPB Digital Signal Processing in Bioengineering (PDSB - Processamento Digital de Sinais em Bioengenharia) Bioengineering Department Instituto Superior T´ ecnico - Technical University of Lisbon 2nd Semester 2012/2013 Jo˜ ao Miguel Sanches ([email protected]) Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013

Upload: nguyentruc

Post on 14-Apr-2018

217 views

Category:

Documents


4 download

TRANSCRIPT

DSPBDigital Signal Processing in

Bioengineering(PDSB - Processamento Digital de Sinais em Bioengenharia)

Bioengineering DepartmentInstituto Superior Tecnico - Technical University of Lisbon

2nd Semester 2012/2013

Joao Miguel Sanches([email protected])

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013

Multi-rate signal processingSampling Rate Changing ([1]-4.6, pp. 167)

Sampling rate changing in the discrete domain by using onlyDigital Signal Processing

• Downsampling (Decimation) - Filtering and samples removing

yD(n)|Fs/D = x(nD)|Fs

D)(nx )(ny

• Upsampling (Interpolation)- Samples insertions and filtering

y(Ln)|LFs = x(n)|Fs (1)

)(nx )(nyL

• Sampling rate changing by a rational factor

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 1

Sampling of discrete sequences

Let xs(n) be the sequence obtained from x(n) where thesamples to be discarded are set to zero, obtained by xs(n) =δD(n)x(n) where

δD(n) =

1 if n/D is integer

0 otherwise

The signal δD(n) may be expresses as follows (prove),

δD(n) =1

D

D−1∑k=0

ej2πD kn

which means that its spectral components are complexexponentials with frequency ωk = 2π

D k with k = 0, ..., D − 1.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 2

Ideal/Real discrete sampled spectrum

By the convolution theorem, FT [x(n)δD(n)] = X(ω) ∗∆D(ω),

Xs(ω) =1

D

D−1∑k=0

X(ω − 2π

Dk)

!

π! 2π!#π!#2π!

!

2π/D=π! 2π!#2π!

!

#2π/D=#π!

!

!

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 3

Ideal/Real discrete sampled spectrum

y(n) = x(nD)

Y (z) = ...+ y(0)︸︷︷︸x(0)

+ y(1)︸︷︷︸x(D)

z−1

+ ...+ y(n)︸︷︷︸x(nD)

z−n

+ ...

=∑n

x(nD)z−n

=∑m

xs(m)z−m/D

= Xs(z1/D

)

Y (ω) = Xs(z1/D

)|z=ejω =1

D

D−1∑k=0

X(ω

D−

2πk

D) =

1

D

D−1∑k=0

X(ω − 2πk

D)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 4

Downsampling

0 10 20 30 40 50 60-1

-0.5

0

0.5

1

0 5 10 15-1

-0.5

0

0.5

1

-2 2

)(X

-2 2

)(Y

c= /2

c=

2

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 5

Decimation

The downsampling expand the spectrum which may lead toaliasing, therefore, an anti-aliasing low pass filter (LPF) filter,with cut-off frequency ωc = π/D is needed,

D

π−

D

ππ− π

D

π−

D

ππ− π

Filtro Passa Baixo

↓D

D

π

)(ωX )(ωY

)(nx )(ny

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 6

Upsampling

• Zero samples insertion

Y (z) =∑n

y(n)z−n =∑m

y(mL)︸ ︷︷ ︸x(m)

z−mL =∑n

x(n)z−nL = X(zL)

Y (ω) = X(ωL)

• Filtering - In the case of the upsampling operation, aliasingdoes not happens because there is a compression of thefrequency axis. However, spectrum copies may appear in theinterval [0, 2π]. These copies appear as spectral artifacts thatmust be removed and therefore, low pass filtering (LPF) isneeded with cut off frequency, ωc = π/L.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 7

Interpolation

L

π−

L

ππ− π

L

π−

L

ππ− π

Filtro Passa Baixo

↑L

L

π

)(ωX )(ωY

)(nx )(ny

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 8

Sampling rate changing by a rational non integerfactor.

Sampling rate increasing by a factor L followed by adecreasing by a factor D, that is, R = L/D.

Filtro Passa Baixo

↑L

C

π)(nx )(ny↓D

where C = minπ/D, π/L

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 9

Linear filter polyphase decomposition

• Motivation: Digital signal processing is performed by usingnumeric processors, therefore, efficient algorithms are needed.

• Decimation: Anti-aliasing followed by sample removing:The removed samples were processed.

• Interpolation: The zero value sample inserted areinterpolated

In both cases the interchange of the operations isdesirable, that is,

• Decimation: Samples removing followed by filtering

• Interpolation: Filtering followed by sample insertion

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 10

Interchange

The filtering and sample rate changing operations arenot always permutable, only when

H(z) =∑

g(n)z−nM

where M is the sampling rate changing factor.

TD↓[H(zD)X(z)

]= H(z)TD↓[X(z)]

H(zL)TL↑[X(z)] = TL↑[H(z)X(z)]

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 11

Interchange

)(zHD)(nx )(ny)(nxa

)( DzH D)(nx )(ny

)(nxb

)(zH

L

)(nx )(ny)(nxa

)( LzH)(nx )(ny

L

)(nxb

Upsampling

Downsampling

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 12

Interchange

• Interchange the filter and dowsampling blocks

Xb(ω) = H(ωD)X(ω)

Y (ω) =1

D

D−1∑k=0

Xb

(ω − 2πk

D

)=

1

D

D−1∑k=0

X

(ω − 2πk

D

)H(ω − 2πk)︸ ︷︷ ︸

Periodic

= H(ω)1

D

D−1∑k=0

X

(ω − 2πk

D

)= H(ω)Xa(ω) q.e.d

• Interchange the filter and upsampling blocks

Y (ω) = Xa(ωL) = X(ωL)︸ ︷︷ ︸Xb(ω)

H(ωL) = H(ωL)Xb(ω) q.e.d

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 13

Noble identities

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 14

Polyphase decomposition

Every linear FIR or IIR filter can be decomposed as followed,

H(z) =

M−1∑k=0

z−kHk(zM)

H(z) =

M−1∑k=0

zkH−k(zM)

where

H±k(zM) =

∑n

h(nM ± k)z−nM

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 15

Polyphase decomposition

)(zH D↓

D↓

D↓

)(0

zH

)(1

zH

)(1

zHD−

D↓

1−z

1−z

+

+

)(nx

)(nx

)(ny

)(ny

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 16

Polyphase decomposition - Example

H(z) = 1 + 2z−1 + 3z−2 + 4z−3 + 5z−4 + 6z−5

• Decomposition with M = 2

H(x) = (1 + 3z−2 + 5z−4)︸ ︷︷ ︸H0(z2)

+z−1 (2 + 4z−2 + 6z−4)︸ ︷︷ ︸H1(z2)

= H0(z2) + z−1H1(z2)

• Decomposition with M = 3

H(z) = (1 + 4z−3)︸ ︷︷ ︸H0(z3)

+z−1 (2 + 5z−3)︸ ︷︷ ︸H1(z3)

+z−2 (3 + 6z−3)︸ ︷︷ ︸H2(z3)

= H0(z3) + z−1H1(z3) + z−2H2(z3)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 17

Signal analysis/synthesis

• Analysis - Signal decomposition in several components

• Synthesis- Signal mixture from several components

• Filter Banks - Analysis

• Transmultiplexers- Synthesis

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 18

Filter banksDecomposition of a given signal, x(n), in M spectral

components, xk(n), from M evenly spaced and equal lengthbands.

)(0

ωH )(1

ωH )(2

ωH )(ωk

H

M

π

M

π2

M

π4k

M

π2

)(1

ω−M

H

)1(2

−MM

π

The filters Hk(ω) are obtained from a prototype filter H(ω)by frequency shifting,

Hk(ω) = H(ω − 2π

Mk)

Hk(z) = H(W kMz), k = 0, 1, ...,M − 1

where W = e−j2π/M

Example: M = 2,H0(ω) = H(ω), H1(ω) = H(ω − π)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 19

Filter banks

A filter bank is called Maximally Decimated if the wholespectrum is covered and no information is lost or distorted. Witha maximally decimated filter bank it is possible to recover theoriginal signal from the components,

x(n) =

M−1∑i=0

hk(n) ∗ x(n)⇒

X(ω) =

M−1∑k=0

H(ω − 2π

Mk)X(ω)⇒

M−1∑k=0

H(ω − 2π

Mk) = 1

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 20

Prototype characteristics

The following conditions must be met to guarantee that theprototype filter H(ω) leads to a maximally decimated filter bank,

1. Time domain: h(nM) = (1/M)δ(n)

2. Frequency domain:∑M−1k=0 H(ω − 2π

M k) = 1

3. In the polyphase decomposition H(z) = E0(zM) +z−1E1(zM) + ...+ z−M+1E(zM), E0(zM) = 1/M

)2

(M

kHπ

ω −

M

π

M

π2

M

π4k

M

π2)1(

2−M

M

π

121

0

= !

"#$

%−&

=

M

k MkH

πω

)(1

)( nM

nMh δ=

M M2M−M2−

1

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 21

Filter bank implementation with DFT

Polyphase decomposition:

H(z) =

M−1∑k=0

zkE−k(zM)

Hk(z) = H(W kMz) =

M−1∑r=0

zrW krM E−r(z

MW kMM︸ ︷︷ ︸1

)

=

M−1∑r=0

zrW krM E−r(z

M),

the polyphase decomposition is the same for all filters but theconstants W kr

M ,

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 22

Filter bank implementation with DFT

H0(z)H1(z)

...HM−1(z)

= Φ

E0(zM)zE−1(zM)

...zM−1E−M+1(zM)

where

Φ =

1 1 ... 1

1 WM ... WM−1M

... ... . . . ...

1 WM−1M ... W

(M−1)2

M

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 23

Filter bank implementation with DFT

The computational complexity of the filter bank is thecomputational complexity of H(z) plus a DFT.

D↓

D↓

)(0

zE

)(1

zE

)(1 zE M +−D↓

1−z

1−z

)(nx )(0

ny

)(1 ny

)(1

nyM −

DFT

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 24

Limitations of frequency analysis

Fourier Transform limitations,

X(Ω) =

∫ ∞−∞

x(t)e−jΩtdt, X(ω) =

∞∑−∞

x(n)e−jωn

• The variable t/n is lost, the analysis is global

• No localized time information is provided by the FourierTransform

• The Fourier Transform expands the signal as combination ofinfinite support basis functions, e−jΩt/e−jωn

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 25

Time Frequency analysis

• STFT - Short Time Fourier Transform

• GT - Gabor transform

• WT - Wavelet Transform

– CWT - Continuous Wavelet Transform– WT - Wavelet Transform

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 26

STFT - Short Time Fourier Transform

X(τ,Ω) = STFT (x(t)) = TF [x(t)w(t− τ)] =

∫ ∞−∞

x(t)w(t− τ)e−jΩtdt

where w(t) = 0 for t /∈ [−T0, T0]

The STFT computes the FT by shifting the window alongthe time. It is desirable ∆t = 2T0 → 0 to compute the spectralcontents at given time interval.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 27

STFT - Short Time Fourier Transform

Analysis:, X(τ,Ω) =∫∞−∞ x(t)w(t− τ)e−jΩtdt;

Synthesis:, x(t) =∫∞−∞

∫∞−∞X(τ,Ω)w(t− τ)ejΩtdτdΩ.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 28

STFT - Time and frequency accuracy

If w(t) = rect(t/T0) is a ∆t = 2T0 length rectangularwindow, the respective Fourier transform is W (Ω) =K sin(ΩT0)/Ω where K is a constant and the length of itsmain lobe is ∆Ω = 2π/T0.

For a given τ , X(τ,Ω) = e−jΩτW (Ω) ∗ X(Ω), that is, assmall is the length of the window as large is its spreading inthe frequency domain and larger is the smoothing of x(t) asconsequence of the convolution.

Therefore, as accurate is the window location, smallerwindows, as inaccurate is its spectral contents, smootherspectrum.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 29

Uncertainty principle

Width of function:

∆2f =

∫∞−∞ x

2|f(x)|2dx∫∞−∞ |f(x)|2dx

It can be shown that:

∆2x(t)∆

2X(Ω) ≥ 1/4

∆2x(t)∆

2X(Ω) = 1/4 if w(t) =

1√πe−t

2

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 30

Gaussian window

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 31

STFT - Basis functions

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 32

STFT - Band pass filter (BPF)• The STFT has redundant information,

X(τ,Ω0) =

[∫ ∞−∞

x(t)w(t− τ)e−jΩ0(t−τ)dt

]e−jΩ0τ

• Fixing the frequency, Ω0, X(τ,Ω0) describes the evolution intime of the frequency spectrum around the frequency Ω0

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 33

GT - Gabor transform

G(t,Ω) =

∫ ∞−∞

e−π(τ−t)2e−jΩτx(τ)dτ

x(t) =1

∫ ∞−∞

G(t,Ω)ejΩtdΩ

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 34

Gabor transform discretization• To cover all frequencies it is only needed a discrete number of

bandpass filters, Ω = kΩ0, with Ω0 ≤ B.

• The output X(τ,Ω) of each bandpass filter can be sampledas τ = mT0 with T0/2π ≤ 1/B, T0 = MTs and F0 = Fs/N ,

X(m, k) = X(mT0, kF0)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 35

GT - Gabor transform

T0 ≤2π

Band Ω0 ≤ B ⇒ T0Ω0 ≤ 2π

The Gabor transform expand the signal x(t) into a contableset of basis functions,

x(t) =∑m,k

X(m, k)em,k(t)

em,k(t) = w(t−mT0)ejΩ0kt

The basis functions em,k(t) are windowed exponentials withtime and frequency discrete shifting.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 36

GT - Gabor transform

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 37

Gabor transform of discrete time signalsLet Ts = 1/Fs be the sampling period and x(n) = x(nTs)

and w(n) = w(nTs),X(m, k) =

∑∞−∞ x(n)w(n−mM)e−j2πkn/N

x(n) =∑N−1k=0

∑∞m=−∞X(m, k)w(n−mM)ej2πkn/N

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 38

Wavelet transform

• The basis functions in the STFT and GT are windowedexponentials as w(t−τ)ejΩt centered at time τ and frequencyΩ.

• This fixed length windows is a limitation of the STFT andGT, because ∆t e ∆Ω can not be made arbitrarily small.

• Short time events (like quick transients) are associated withhigh frequency components and low frequency components(like slow drifts) occur along wide time intervals.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 39

Non-uniform time/frequency sampling

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 40

Wavelet basis functionsIt is desirable a shorter window at high frequencies and a

larger one at low frequencies,

eτ,α = α0.5w(α(t− τ))e−jΩα(t−τ),

where the parameter α ≥ 0 determines both the length of thewindow and the frequency αΩ, or in general

eτ,α =√αψ(α(t− τ))

where√α is a normalization constant.

In order for eτ,α to be a basis of a transform it is needed todetermine the dual basis so that∫ ∞

−∞

∫ ∞−∞

eτ,α(t)e∗τ,α(λ)dτdα = δ(t− λ)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 41

Wavelet basis functions

It can be shown that for any signal ψ(t),

∫ ∞−∞

∫ ∞−∞

eτ,α(t)e∗τ,α(λ)dτdα =

[∫ ∞−∞

|Ψ(Ω)|2

|Ω|dΩ

]δ(t− λ)

where eτ,α(t) =√αψ(α(t− τ)) and Ψ(Ω) = FT [ψ(t)].

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 42

Mother wavelet constraints

Therefore, orthogonality holds and

eτ,α(t) = eτ,α(t) if

∫ ∞−∞

|Ψ(Ω)|2

|Ω|dΩ = 1

Ψ(Ω) = 0 to avoid singularity at Ω = 0 and Ψ(∞) = 0 toguarantee that the basis functions have finite energy, whichmeans, that the mother wavelet, ψ(t), is a bandpass function.X(τ, α) = CWT [x(t)] =

√α∫∞−∞ x(t)ψ(α(t− τ))dt

x(t) = ICWT [X(τ, α)] =√α∫∞−∞

∫∞−∞X(τ, α)ψ(α(t− τ))dτdα

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 43

Wavelet basis functions

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 44

Frequency coverage

• With the exclusion of the frequency F = 0 the whole frequencyspectrum can be covered by a discrete set of ideal bandpassfilters, corresponding to α = 2−j.

• At least in the ideal case, the output of the kth bandpassfilter, associated with the scaling factor α = 2−j, can besampled as τ = mTj with a sampling period Tj = 2jTs,where Ts = 1/(2F0).

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 45

Scaling functions

• The frequency F = 0 is not covered even when α → 0 (orequivalently k →∞).

• The whole spectrum is obtained by the sequence of waveletfunctions Ψ(2jF ) plus a lowpass filter φ(t) to cover the lowfrequencies, called scaling function.

• The wavelet transform can be viewed as a bank of filterswhose outputs are sampled without loss of information.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 46

Scaling functions

The expansion of x(t) by using this scaling function istherefore

x(t) =

∞∑m=−∞

φN(t−m2NTs)A[m,N ]

+

N∑j=−∞

∞∑m=−∞

ψk(t−m2jTs)D[m, j]

where

φN(t) =1√2Nφ(2−Nt)

ψj(t) =1√2kψ(2−jt)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 47

Approximation and Detail coefficients

The coefficients A[m,N ] and D[m, k] are calledapproximations and details respectively.

A[m,N ] =

∫ ∞−∞

x(t)φN(t−m2NTs)dt

D[m, k] =

∫ ∞−∞

x(t)ψk(t−m2kTs)dt

where

φN(t) =1√2NφN(2−Nt)

ψk(t) =1√2kψN(2−kt)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 48

Scaling functions

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 49

Multi-resolution analysis [Philips, 2003]

Goal: Find out a wavelet system such as all baby wavelets,

ψj,k(t) =√

2jψ(2jt− k),

form an orthogonal basis, which implies

cj,k =

∫ ∞−∞

x(t)ψj,k(t)dt

x(t) =∑j

∑k

cj,kψj,k(t)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 50

Multi-resolution analysis [Philips, 2003]

Let Wj be a set of signals, x(t), from the set of basis functionsψj,k(t) with −∞ ≤ k ≤ ∞,

xj(t) =

∞∑k=−∞

cj,kψj,k(t)

where xj(t) ∈Wj.

These spaces are orthogonal to each other and we cansynthesize any (energy) signal, x(t), as

x(t) =

∞∑j=−∞

xj(t)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 51

Multi-resolution analysis

Let Vj be the set of all signals, x(t), which can be expressedfrom the baby wavelets ψi,k(t) where i < j and −∞ < k <∞,

x(t) =

j−1∑i=−∞

∑k

ci,kψi,k(t)

The spaces Vj are nested inside each other,

0 ⊂ ... ⊂ V−2 ⊂ V−1 ⊂ V0 ⊂ V1 ⊂ V2 ⊂ ... ⊂ L2

• As j goes to infinity Vj enlarges to become L2

• As j goes to negative infinity Vj shrinks down to only the zerosignal.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 52

Multi-resolution analysis

x(t) =

j∑i=−∞

∑k

ci,kψi,k(t)︸ ︷︷ ︸Vj

=

j−1∑i=−∞

∑k

ci,kψi,k(t)︸ ︷︷ ︸Vj−1

+∑k

cj,kψj,k(t)︸ ︷︷ ︸Wj−1

or,

Vj+1 = Wj + Vj

which means that Wj are the differences (in the subspacesense) between adjacent spaces Vj and Vj+1.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 53

Multi-resolution analysis

where the spaces Wj are generated from a mother wavelet

ψ(t), ψj,k(t) =√

2jψ(2jt− k) and the spaces Vj are generatedby the wavelets ψi,k(t) (−∞ < i ≤ j − 1) and by the scale

functions φj,k =√

2jφ(2jt− k).

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 54

Multi-resolution analysis

V0 = V−1 +W−1

= V−2 +W−2 +W−1

= V−3 +W−3 +W−2 +W−1

= V−4 +W−4 +W−3 +W−2 +W−1 ⇒x(t) = A1(t) +D1(t)

= A2(t) +D2(t) +D1(t)

= A3(t) +D3(t) +D2(t) +D1(t)

= A4(t) +D4(t) +D3(t) +D2(t) +D1(t)

where Ai(t) and Dj(t) can be represented by discrete sets ofcoefficients. The basis functions that generates Vj are the scalefunctions, φj,k(t) and the basis functions that generates Wj arethe wavelet functions ψj,k(t).

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 55

Filter banks and the Discrete Wavelet Transform

There are discrete time filter coefficients h0(n) such that:

φ(t) =∑n

h0(n)√

2φ(2t− n)

which means that a scale function in a space Vj can beobtained by a linear combination of scale functions fromthe space Vj+1 and

ψ(t) =∑n

h1(n)√

2φ(2t− n)

because Wj is also contained in Vj+1, Wj ⊂ Vj+1.

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 56

Filter banks and the Discrete Wavelet Transform

Since the spaces Vj are getting larger and larger as j goesto ∞ it is possible to approximate any signal, x(t), closely bychoosing a large enough value of j = J and projecting the signalinto VJ using the basis φJ,m(t),

A0(m) =

∫ ∞−∞

x(t)φJ,m(t)dt

and the signal can be approximately recovered from

x(t) ≈∑m

A0(m)φJ,m(t)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 57

Filter banks and the Discrete Wavelet TransformIf this approximation is considered that our signal can be

represented by a set of discrete coefficients, it works like asampling process. From this first approximation the signal canbe decomposed by using approximations and details of coarserscales, e.g.

x(t) =∑m

cA0(m)φJ,m(t)

= A1(t) +D1(t)

= A2(t) +D2(t) +D1(t)

= ...

where cAj(m) and cDj(m) are the sets of approximation anddetail coefficients respectively at scale j and Aj(t) and Dj(t)are the corresponding continuous functions. In the finest scales,sometimes it is common to assume cA(m) ≈ A(t)

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 58

Filter banks and the Discrete Wavelet Transform

cA1(k) =∑n

h0(n− 2k)cA0(n)

cD1(k) =∑n

h1(n− 2k)cA0(n)

which can be interpreted as a convolution followed by adownsampling,

cA1(k) =[h0(m) ∗ cA0(m)

]↓ 2

where h0 = h(−n).

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 59

Analysis filter banks

MatLab command: [cA, cD]=dwt(x,Lo,Hi);, or [cA, cD]=dwt(x,’wname’);

MatLab command: [cA, cD]=wavedec(x,N,Lo,Hi);, or [cA,

cD]=dwt(x,N,’wname’);

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 60

Synthesis filter banks

MatLab command: x=idwt(cA, cD, Lo,Hi);, or x=dwt(cA, cD, ’wname’);

Digital Signal Processing in Bioengineering J. Miguel Sanches/IST/Lisbon 2nd Semester 2012/2013 61