emg and wavelet analysis – part iborgbros/artiklar/emgwlet.pdf · technical report hur – fb...

23
Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg 1 , HUR Ltd EMG and Wavelet Analysis – Part I Introduction 1 Continuous wavelets 3 Multi resolution analysis 7 Appendix 18 A. The orthogonality condition 18 B. The B-spline solution 19 C. Frames 20 D. The Morelet “wavelet” 21 Literature 22 Introduction EMG stands for electromyography; that is, the study of electric signals recorded from muscles (myoelectric signals). Motorneurons in the brain send signals to the motor units (MU) of the muscles, which respond with a motor unit action potential (MUAP). Muscular activity is thus associated with a sum (CMUAP, compound MUAP) of MUAPs (amplitude of the order of 120 mV), which give rise to the signal recorded as the EMG signal, which may be measured using surface electrodes (surface EMG, short SEMG) or needle electrodes. The EMG-signal is of the order from a few μV to a few mV. Differential amplifiers are therefore necessary in order to extract the signal from a noisy environment (bipolar electrodes are typically used). Typical sampling rates used are in the range of 2000 to 600 S/s. With needle electrodes signals up to several kHz can be recorded, but with surface electrodes skin and fatty tissue filter frequencies above 500 Hz. Isometric contraction: Red curve shows force, while the blue curve shows rectified EMG-signal from the muscle sampled at 1000 S/s. A number of mathematical methods have been developed for analyzing the EMG-signals of which most are based on the standard Fourier Transform. By dividing a time series into subintervals and calculating the spectrum for every subinterval (giving the so-called spectrogram) one may follow how the spectrum changes with time (Short Time Fourier Transform, STFT). 1 E-mail: [email protected]

Upload: lamnhan

Post on 25-Apr-2018

231 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

1

EMG and Wavelet Analysis – Part IF Borg1, HUR Ltd

EMG and Wavelet Analysis – Part I

Introduction 1

Continuous wavelets 3

Multi resolution analysis 7

Appendix 18A. The orthogonality condition 18B. The B-spline solution 19C. Frames 20D. The Morelet “wavelet” 21

Literature 22

Introduction

EMG stands for electromyography; that is, the study of electric signals recorded from muscles(myoelectric signals). Motorneurons in the brain send signals to the motor units (MU) of the muscles,which respond with a motor unit action potential (MUAP). Muscular activity is thus associated with asum (CMUAP, compound MUAP) of MUAPs (amplitude of the order of 120 mV), which give rise tothe signal recorded as the EMG signal, which may be measured using surface electrodes (surface EMG,short SEMG) or needle electrodes. The EMG-signal is of the order from a few µV to a few mV.Differential amplifiers are therefore necessary in order to extract the signal from a noisy environment(bipolar electrodes are typically used). Typical sampling rates used are in the range of 2000 to 600 S/s.With needle electrodes signals up to several kHz can be recorded, but with surface electrodes skin andfatty tissue filter frequencies above 500 Hz.

Isometric contraction: Red curve shows force, while the blue curve showsrectified EMG-signal from the muscle sampled at 1000 S/s.

A number of mathematical methods have been developed for analyzing the EMG-signals of whichmost are based on the standard Fourier Transform. By dividing a time series into subintervals andcalculating the spectrum for every subinterval (giving the so-called spectrogram) one may follow howthe spectrum changes with time (Short Time Fourier Transform, STFT).

1 E-mail: [email protected]

Page 2: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

2

Isometric test: Spectrum of the EMG-signal.

Isometric test: Spectrogram of the EMG. The time series (4 seconds) wasdivided into 32 subintervals and the spectrum were calculated for each subinterval.

For instance, it has been found that for a contracting muscle the fatigue is accompanied by a trend ofdecreasing mean frequency of the EMG-signal, and by a trend of increasing “energy” of the signal (theenergy is defined here as the integral of the square of the signal amplitude). Another characteristicproperty of the EMG-signal is that its mean amplitude correlates positively with the force produced bythe contracting muscle; an increasing force yields higher mean EMG-amplitude.

Isometric contraction: Red curve shows a decreasing trendof mean frequency of the EMG-signal. The blue curve isthe “energy” which exhibits an increasing trend with timeduring contraction. Calculations based on the spectrogram

for the EMG-signal.

Page 3: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

3

STFT is a very useful mathematical method and has also been generalized in a number ways. Fouriertransformation methods are based on the sinus-cosinus functions and are therefore especially welladapted for analyzing periodic signals (the Hartley transform is a variation of the Fourier transformwhich uses the sum of sinus and cosinus functions as the base functions). The popularity of the Fouriertransform is also due to its important use for solving linear differential equations. However, there aremany sorts of signals in nature that are non-stationary, non-periodic, “fractal” or seemingly chaotic. Ithas been realized in recent decades that many processes in nature are “non-linear” (at least when drivenoff their near equilibrium regions).

Non-linear mathematical models may exhibit very irregular behavior. It is therefore reasonable tosuspect that other base functions than the sinus-cosinus functions might serve well for analyzing such“irregular” signals. Thus, instead of decomposing and reconstructing a signal in terms of the sinus-cosinus functions, one might e.g. use saw tooth functions, rectangle waves (Walsh functions), or finitetime pulses. Since EMG-signals are typically non-stationary and irregular it could be that such newmethods of analysis have a chance of supplementing the traditional methods. The best known of thesenew tools is the wavelet (fr. ondelette) analysis, which started to develop (by Morlet, Grossmann,Mallat, Daubechies and Meyer) in earnest around the mid-eighties as a method for analyzing seismicwaves. During the last decade wavelets have emerged as a major tool in signal processing. (A famouscase is FBI using wavelets for compressing fingerprint data).

There are a number of standard wavelet transforms associated with the names of Haar, Daubechies,Meyer, Morlet, Coifman (“ Coiflets”), Battle-Lemarié, Chui, etc. The so-called continuous wavelettransforms (CWT) are employed for studying the scalogram of the signal, which generalizes thestandard spectrogram. The wavelet has been likened to a “mathematical microscope” that allows us tostudy the signal at various scales. Scalograms can also be compared to musical transcription, which isbased on dividing the frequency range into octaves. By special choices of wavelets one arrives at theso-called multi resolution analysis (MRA), which is linked to the 2-channel filter bank methods. Thesespecial wavelets (e.g. Haar and Daubechies) allow signals to be expressed as a sum of a discrete set ofscaled versions of the wavelet, thus generalizing the classical Fourier series expansion. Finding a well-adapted wavelet basis makes it possible to express the signal with a high degree of approximation usinga small subset of the expansion (wavelet-) coefficients (data compression).

The CWT has found a number of applications in the field of biomedical signals, such as the study oftransients and spikes in ECG-signals (cardiac patterns) and EEG-signals (seizure detection). There isalso evidence of interesting similarities between the wavelets and biological information processing(cell responses). Thus one may look for optimal wavelets for detecting certain signal patterns (matchedfilter). One successful application is the detection of so-called QRS complex in the ECG-signals, whichcan discriminate between normal and abnormal patterns. The Gabor-Morelet wavelet has been used inanalyzing arterial sounds. For extracting impulse-like events the so-called B-spline wavelets are quitepopular because these wavelets match the potentials quite well. The question is whether there could besimilar useful applications to the EMG-signals: Could wavelets provide methods to extract moreinformation from the EMG data? Better timing of transients is an obvious target, but could there alsobe other useful forms of feature extraction? We may suggest a few lines along which to pursueinvestigations in this area.

A typical problem is to distinguish between “normal” and “abnormal” states. Thus, one couldinvestigate the possibility of distinguishing signals from healthy and injured muscles (using e.g. filtermethods in combination with learning networks); i.e., a diagnostic tool. One problem to address couldbe to refine the signal processing with the view of getting an improved estimate of the number of motorunits activated. A special issue is also the use of matched filter in a noisy environment typical forEMG-signals. Here one may take advantage of works done in related areas (the use of so-calledwhitening filters). It is also important to advance from the other direction; that is, refining mathematicalmodels for the generation of EMG on which one can devise optimal matching wavelets. - In the nextsections some of the mathematical background of wavelets is presented.

Continuous wavelets

For a signal x(t) we define its (complex) Fourier transformation as

Page 4: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

4

(1) ∫∞

∞−

−= dttxefx fti )()(ˆ 2π

which is a function of the frequency. Conversely, we get back the signal from its frequencyrepresentation through the inverse Fourier transform

(2) ∫∞

∞−

= dffxetx fti )(ˆ)( 2π

The integral (1) is a measure how well the analyzing function ei2πft matches the signal. The continuouswavelet transform may use any well-behaved analyzing function (analyzing wavelet) g(u), which for“admissible wavelets”, however, must satisfy

(3)

0)()0(ˆ

,)(ˆ

thatimplieswhich 0

2

==

∞<±

∫∞

∞−

duugg

dfffg

The wavelet transform W(a, τ) of a the signal x(t) is defined as (CWT, continuous wavelet transform)

(4)

=

=

=

∫∞

∞−

∞−

at

ga

tg

dttgtx

dta

tgtx

aaW

a

a

τ

ττ

τ

τ

1)(

,)()(

)(1

),(

,

*,

*

notation thegintroducinby

Here a is called the scale (or dilatation) factor. If the function g is concentrated around zero then itfollows that for small a the integral (4) emphasizes the detail of the signal around t = τ, whereas forlarge a it gives a sort of an average value of the signal around t = τ. It is in this sense that the wavelettransform acts as “mathematical microscope”.

If (3) is satisfied we can reconstruct the signal from the wavelet transform W(a, τ) by the formula(applies when the Fourier transform of the wavelet is an even function):

(5)

∫∫∞

=

=

0

2

2,

)(ˆ

,)(),(1

)( where

dfffg

c

adad

tgaWc

tx aτ

τ τ

The squared modulus 2

),( τaW of the wavelet transform represents the so-called scalogram of the

signal. The energy of the signal is defined as

(6) ∫∫ == dffxdttxE22

)(ˆ)(

Page 5: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

5

where 2

)(ˆ fx represents the spectrum of the signal. The spectrum and the scalogram can be related by

the equation

(7) ∫∫∫∫ =>

duuug

dffxa

dadaW

a

22

02

2 )(ˆ)(ˆ),(

ττ

For numerical calculations of W(a, τ) one can adopt the Fast Fourier Transform (FFT) to the equation

(8) ∫= duauguxeaaW ui )(ˆ)(ˆ),( *2πττ

As an example we may use the “Mexican wavelet” (popular e.g. among the seismologists)

(9) ( ) 2/2 2

1)( xexxg −−=

Its Fourier transformation is

(10) ( ) ( ) 2/22 2

22)(ˆ feffg πππ −=

for which we have from (5) c = π , whence it indeed satisfies the condition (3).

The above figure shows the scalogram – calculated using the “Mexican wavelet” - for the EMG-signalfrom the isometric test data used before. Time (in seconds) is along the x-axis, whereas the scalingparameter is along the y-axis (logarithmic scale: a = 2-y, thus y = 10 corresponds to a = 1/1024 and y =0 to a = 1; we get a finer scale when we move upwards in the figure). The value of W(a, τ) isrepresented by gray scale color; darker means lower value. From the figure it is apparent that thebeginning of the contraction is marked by a sharply localized maximum in time. This is a typicalfeature of scalograms. They are good at localizing transients. Indeed, suppose we have a Dirac pulsesignal δ(t – t0), which is peaked at time t0, then the transform (4) gives

(11)

=a

tg

aaW 0*1

),(τ

τ

which is sharply peaked at τ = t0 for small a if |g(x)| has its maximum at x = 0.

Page 6: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

6

The next figure above shows the scalogram of signal which is a sum of two Dirac pulses at t = 1 and t= 2; the location of the pulses are easily determined from the scalogram. Since the spectrogram on theother hand uses a fixed “window” (fixed size of the subintervals into which the time series is divided) itdoes not give a similar sharp location of the transients. For a comparison we give the spectrogram ofthe same data as contour map.

The frequency (Hz) is along the y-axis. The region of contraction is here also visible, and pronouncedactivity seems to take place around and below 100 Hz.

The spectrogram and the scalogram can be compared through the so-called Wigner-Ville distributiondefined for a signal x by

(12) ∫ −

+= due

utx

utxftWV fui

xπ2*

22),(

Apparently, for a harmonious signal of frequency f0 the W-V distribution is peaked at this frequency,and for a signal peaked at a time t0 the W-V distribution is also peaked at this time. The W-Vdistribution and the wavelet transform (4) are related by

(13) dtdfafa

tWVftWVaW gx

= ∫ ,),(),(2 τ

τ

For the “Mexican wavelet” we obtain

Page 7: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

7

(14) ( )442224222)2( 64324161232

),(22

ffttfteftWV tfg πππ

π π +++−−= −−

which attains maximum at t = f = 0, whence for a small a the r. h. s. of (13) approaches the W-Vdistribution. The W-V distribution is sometimes used to decide whether time-frequency or time-scalemethods should be used.

The figure above shows the W-V distribution (magnitude) of the EMG-signal from the isometric test.(The W-V distribution was calculated for 32 time points tk.)

Multi resolution analysis

Equation (5) above shows how a signal can be expressed in terms of a wavelet as an integral. Thequestion arises whether a general signal can be expressed as a sum of a discrete subset of the scaled“mother” wavelet, in analogy with the Fourier series. Usually one considers the “dyadic” subset

(15)( )

Ζ∈

−=

kn

ktt nnkn

,

22)( 2/, ψψ

defined by a wavelet ψ (we adhere to some of the common notations used in the field of MRA); i.e. a“dyadic” scaling. The interesting case is when the functions ψn,k form an orthonormal and complete setsuch that any signal x(t) may be expressed as sum

(16)

knknnk

knknknkn kn

nk

xdtttx

txttx

,*

,

,,,, ,

,)()(

)(,)()(

ψψβ

ψψψβ

≡=

==

∑∑

(As with the reconstruction formula (5) it also follows from (16) that ∫ = 0)( dttx ; thus, for a complete

reconstruction covering also functions with non-vanishing integral one has to add basis functions usingthe so-called “father wavelet” – see below.) The general idea is then: for a given class of signals, find awavelet such that the essential features of the signals can be captured with a minimum number ofcoefficients in the wavelet series expansion (16).

The simplest orthonormal wavelet is the Haar wavelet, which was studied already back in 1910 by AHaar as a novel way to expand continuous functions. The Haar wavelet can be defined by a scalingfunction φ (“father wavelet”) which is simply the characteristic function for the interval [0, 1]

Page 8: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

8

(17) [ ]

otherwise ;01,0;1)(

=∈= xxφ

The Haar wavelet is then defined by

(18) )12()2()( −−= xxx φφψ

Ψ Haar wavelet

1

Also the Haar scaling function satisfies a related scaling equation

(19) )12()2()( −+= xxx φφφ

The father wavelet coefficients of a function x(t) are defined by

(20) ( ) ( )∫∫ =−= dtttxdtkttx knnnn

k ,2/ )(22)( φφα

The relations, (18) and (19), are generalized later. For the Haar wavelet it is not difficult to see that theset (15) forms an orthonormal set. As pointed out above this is not a complete set but it can becompleted by adding the functions )( kx −φ , k = …,-2, -1, 0, 1, 2, … . Instead of (16) we then have

(16*) ∑∑ −+=k

kkn knnk kxattx )()()(

, , φψβ

Suppose we have numerical data x(tk) sampled at regular intervals tk = k /N for N = 2R and k = 0, …, N -1. We may think of x(t) as a function constant on the intervals (k/N, (k+1)/N ) with value xk = x(tk)there, and we may write

(21)( )

2/

120,

2)(

)( with

Rk

Rk

kkR

Rk

tx

ttxR

−≤≤

=

= ∑α

φα

Also, the wavelet coefficients βnk defined by (16) will vanish for n ≥ R , since x(t) in (21) will be

orthogonal to ψn,k for n ≥ R . Using the equations (18) and (19) one can show that the α, β-coefficientssatisfy

(22)112

12

112

12

21

21

21

21

++

+

++

+

−=

+=

nk

nk

nk

nk

nk

nk

ααβ

ααα

Page 9: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

9

Thus, if we know the α− coefficients for a certain level n we can calculate the coefficients for all sub-levels. All this is translated into the following algorithm (Fast Haar Transform) for calculating thecoefficients for the data xk, k = 0, … , 2R – 1. From it we produce two sub-sequences a1, b1 of lengthN/2 (N = 2R) by

(22*)

12

,...,0

21

21

21

21

1221

1221

−=

−=

+=

+

+

Nk

xxb

xxa

kkk

kkk

Thus, the sequence x is decomposed into (a1 | b1). Applying the same procedure to a1 we get (a2 | b2) oflength N/4 and N/4. Then continue with a3, etc, till finally x is decomposed into (aR | bR | bR-1 | … | b1).The wavelet coefficients are then given by

(23)12,...,0

) 0(2 if2/

−=

≥== −−

n

RnRk

nk

k

Rnbβ

For data with 2R points we therefore obtain 1 + 2 + 22 + … + 2R-1 = 2R - 1 wavelet coefficients. If oneadd to this the average (aR) of the data one gets in all 2R constants from which the signal can bereconstructed. The algorithm is easily implemented in computer code. Conversely, from thedecomposition (aR | bR | bR-1 | … | b1) we can reconstruct the data (a0) through successive steps

=

=

+=

−−

−−

ikijR

jRi

j

ikijR

jRi

j

jjj

tkb

tka

kbkaka

)()(

)()(

)()()(

,

,

1

ψβ

φα

From (22) and (16*) it is evident that the “energy” is conserved for the transformation

(24) ( )∑ ∑∑ += 222k

nkk ax β

Furthermore, (22*) implies that if the signal is constant the β−coefficients will vanish. If the signal islinear (as a function of time) the R-1 level β−coefficients are constant, whence the next level ofβ−coefficients will vanish. For a quadratic signal the R-3 level β−coefficients will vanish, and so on.Thus, the β−coefficients will be large where the signal changes abruptly. This can be viewed directly ifwe map the β−coefficients on the time axis such that βn

k will mapped to time 2-n k . The next figureshows the EMG-signal of the isometric test along with its Haar wavelet coefficients (the upper curvein the figure – it has been displaced vertically in order to distinguish the curves).

Page 10: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

10

We can also display the β−coefficients for the different scales in sort of a discrete version of thescalogram.

In this figure there are 12 levels. The 0th level corresponds to just one β−coefficient, on the next levelwe have two β−coefficients, and finally on the 11th level we have 211 = N/2 β−coefficients. Dark colormeans low (negative) value, white is for high value. The next figure shows the absolute values of theβ−coefficients of the same data and with more colors.

Page 11: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

11

In the diagram the region of muscle contraction is clearly enhanced, as the resting signal seems to besuppressed. The diagram can be read as a “musical transcription” of the EMG-signal. The 11th levelcorresponds to high pitch around 500 Hz, 10th level to 250 Hz, and so on. Apparently the signal for thecontraction seems to be concentrated around the 7th and 9th level (around 30 – 125 Hz).

The Haar transform is a special instance of a so-called sub-band coding filter bank, which can bepictured as follows

b1 b2

a0

a1 a2

H1

H0

H1

H0

The information flows from left to right. In the first step data (a0) is put through a high pass filter H1which produces the first set of “detail part” b1 of the signal, whereas the low pass produces a sort of“moving average” a1 of the data (compare (22*)). The next step repeats the procedure with a1 as inputdata, and so on. In equations this can be written

(25)

[ ] [ ] [ ] [ ] [ ]

[ ] [ ] [ ]∑

∑∑−

−−

−=

−=−=

j

nn

j

n

j

nn

jajkhka

jkajhjajkhkb

10

11

11

2

22

where h0[m] and h1[m] denote the low and high pass filter coefficients. In (25) r. h. s. we have includedthe effect of down-sampling (denoted by downward arrows in the diagram) by using 2k instead of k inthe argument of filter coefficients. Thus, down-sampling a sequence {rk } means we throw everysecond element obtaining a sequence {sk } with sk = r2k. Up-sampling on the other hand means that weenlarge a sequence {rk } by inserting zeros between consecutive elements obtaining a sequence {sk }with s2k = rk and s2k+1 = 0. Then the synthesis of the signal (a0) from its decomposition can be describedby the following diagram (showing the two final steps – up-sampling is denoted by an upward arrow).

b2 b1

a0

a2 a1

G1

G0

G1

G0

The synthesis low and high pass filters are denoted by G0 and G1 with filter coefficients g0[m] andg1[m]. For the synthesis equation we obtain

(26) [ ] [ ] [ ] [ ] [ ]∑∑ −+−=−

j

n

j

nn jbjkgjajkgka 22 101

Consider the two-step case consisting of analysis and synthesis.

Page 12: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

12

x xr

H1

H0

G1

G0

A signal x is analyzed and re-synthesized as a signal xr. The process can be conveniently describedusing z-transforms. Given a sequence {xk } then its z-transformation, denoted X(z), is defined as

(27) ∑ −=k

kk zxzX )(

for a complex number z. The convolution of two sequences {hk } and {xk } is defined by

(28) [ ] [ ] [ ]jxjkhkxhj

∑ −=∗

with the important property that its z-transform is the product H(z) X(z). In terms of z-transforms theup-sampling and down-sampling are described as

(28)( ) ( )( )

( )2)(21

)(

zXzX

zXzXzX

↑=

−+↓=

Using these properties the process of the above diagram can be written in the z-domain as

(29)

( )

( ) )()()()()(21

)()()()()(21

)(

1100

1100

zXzHzGzHzG

zXzHzGzHzGzXr

−−+−

++=

From this it follows that xr is a perfect reconstruction of x if we have

(30)0)()()()(

2)()()()(

1100

1100

=−+−

=+ −

zHzGzHzG

zzHzGzHzG K

This means that xr is identical with x except for a time delay, xr [n] = x [n-K].

In terms of these new concepts the Haar transform is represented by the following filters

(31)

21

)(2

1)(

21

)(2

1)(

10

1

1

1

0

zzH

zzH

zzG

zzG

−=

+=

−=

+=

−−

Page 13: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

13

(We observe that for the Haar filters we have )()( 10 zGzG −= and similarly for the analysis filter,

which is characteristic of the so-called Quadrature Mirror Filters, QMF.) If we set z = ei2πf in H(z) weobtain the discrete Fourier transformation H(f),

(32) [ ]∑ −=k

kfiekhfH π2)(

Using the relations (assuming real-valued filter coefficients in (33.b))

(33)

( )

( )fiez

fHzH

fHzH

π2

*1

21

)()(

)(

=

=

+=−−

and (30) one can show that the Haar filter function satisfies

(34) 2)()(2

21

02

0 =++ fGfG

This equality is in fact necessary for the corresponding wavelet to be orthogonal. If we can solve (30)for G we obtain

(35)

0)()()()()(

)()(

2)(

)()(

2)(

1010

01

10

if ≠−−−=

−−=

−=

zHzHzHzHzD

zHzD

zzG

zHzD

zzG

K

K

(we have for the Haar filter D(z) = 2z and K = -1). The so-called conjugate quadrature filters (CQF) areobtained by setting D(z) = 2z-K ; i.e.,

(36))()(

)()(

01

10

zHzGzHzG−−=

−=

plus postulating a special relation between high pass and low pass filter (the exponent in (37) must beodd since D(z) (35) is an odd function)

(37) )()( 10

121

−−− −−= zHzzH k

From (37), (36) and (30) we obtain

(38) ( ) ( ) ( ) ( ) KkzzHzHzHzH −+−− =−−+ 12100

100 2

which in term of the discrete Fourier transform becomes

(39)( ) ( )

( )fi

Kk

ez

zfHfHπ2

122

21

02

0 2

=

=++ −+

Since the l. h. s. of (39) is real-valued we must have K = 2k + 1 on the r. h. s . ; i.e., the CQF filterssatisfy the orthogonality condition (34). Equation (38) can now be written as

Page 14: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

14

(40))()()(

2)()(1

00−=

=−+

zHzHzP

zPzP

One approach to filter design is to find a polynomial P(z) satisfying (40.a) and then try to factorize it onthe form (40.b) obtaining the filter H. As an example, for the Haar filter we have

(41) ( ) 22

12

12

21

)(1

1

+

+

=++=−

− zzzzzP

which was generalized by Daubechies (1988) as

(42) )(2

12

1)(

1

zQzz

zP N

NN

+

+

=−

where QN is a “symmetrical” polynomial of degree N – 1; i.e., it satisfies

(43)( ) ( )( ) 1

102

21

1

1

...... −−

+−−

+−−

+++++=

=N

NN

NN

NN

NN

zqqzqzqzQ

zQzQ

The polynomial QN is uniquely determined by the equation (32). Indeed, this equation means that theeven terms in P(z) must vanish (except for the constant term), and since P(z) is “symmetrical” ofdegree 2N - 1 this leaves N conditions for the N coefficients qk. Having obtained QN one has yet tofactorize it according to (40.1). One possible factorization in case of N = 2 is the famous Daubechieswavelet (of 4th order and usually referred to as Daub4) with the low pass analysis filter

(44) ( ) ( ) ( ) ( ) ( ){ }320 31333331

241

zzzzH −+−++++=

The high pass filter is then given applying (37) as

(45)[ ] ( ) [ ]nhnh

zHzzHn −−=

−−= −−

31

)()(

01

10

31

Finally we can obtain the scaling function and the wavelet from the filters as follows. From (20) we seethat using a Dirac impulse δ(t – tm) as the input signal x(t) we obtain (assuming real-valued functions)

(46)[ ][ ] )2(2)()(

)2(2)()(2/

,

2/,

ktdttttkb

ktdttttka

mnn

knmnR

mnn

knmnR

−=−=

−=−=

∫∫

ψψδ

φφδ

Using R steps in the filtering we can determine the scaling functions at points m 2-R; thus, with anincreasing number of steps the scaling function (and similarly the wavelet) will be determined at adense set of points. From (25) and (46) we find that the functions φ and ψ must satisfy the followingscaling relations

(47)

[ ] ( )

[ ] ( )jtjht

jtjht

j

j

−−=

−−=

22)(

22)(

1

0

φψ

φφ

Page 15: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

15

The equations in (47) generalize the Haar case (18) and (19). Applying the Fourier transformations to(47) we can derive the following formal expression for the Fourier transform of the scaling function

(48)

( )

( ) ( )fHfM

Mfk

fk

−=

= ∏∞

=

00

120

21

)(φ̂

Similarly we obtain for the Fourier transform of the wavelet

(49)

( ) ( ) ( )( ) ( )fHfM

Mf ff

−=

=

11

221

21

ˆˆ φψ

One can also use the equations in (47) in order to implement an iteration procedure

(50)

( ) [ ] ( )( )

( )[ ]( )tt

jtjht i

j

i

1,00

01

)(

22)(

χφ

φφ

=

−−= ∑+

With the initial function taken as the characteristic function for the unit interval [0,1] it follows that thelimit function of (50) will be zero outside [0,3], which is also true of the corresponding wavelet definedby (47.b); the wavelet is said to have compact support.

Page 16: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

16

The first figure above shows the Daub4 scaling function computed using the iteration procedure in sixsteps (it is normalized so that its integral is equal to 1). The second figure shows the Daub4 wavelet

obtained by using (46) in the form of ( )mR t4220 ψβ =− employing as input signals the discrete

versions [ ] km

m kx δ= , m = 0, …, 2R – 1, of the Dirac impulse δ(t – tm). The wavelet coefficients were

calculated using the filters (44–45). Of course we could have obtained it also from the scaling functionthrough (47.b).

As the picture of the Daub4 wavelet shows, it is a bit more regular than the Haar wavelet but perhapsnot too similar to the myoelectric potentials we wish to match. Smoother version can be obtained bygoing to the higher order Daubechies wavelets. An interesting class of wavelets in this regard is theones using the so-called B-splines as the scaling function φ. The 0th case is the Haar wavelet using thecharacteristic function for the unit interval as the scaling function. The N:th order B-spline scalingfunction is obtained by convoluting the (N - 1):th order with the characteristic function for the unitinterval

(51) ( ) ( ) ( )( ) [ ]( )tt

duuutt NN

1,00

10

χφ

φφφ

=

−= ∫ −

If we take the Fourier transform of (51) we obtain

(52)

( )( ) ( )

−=

=

+

ff

ef fi

N

N

ππ

φ

φφ

π sinˆ

ˆˆ

0

1

0

Using (48) we can derive the relation

(53) ( ) ( ) ( )ffMf φφ ˆ2ˆ0=

That is, knowing the Fourier transform of the scaling function we can calculate the filter H0 (from M0).Applying this method to (52) we obtain

Page 17: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

17

(54)

( ) ( )( ) ( )( )

( ) 121

11

00

12

2

cos2

2

+

+

++

+

=

=−=

NfiN

NfNi

e

fe

fMfH

π

π π

This gives for the low pass filter coefficients in case of the N:th order B-spline

(55) [ ]

+=− + j

Njh N

12

210

From this we can calculate the high pass filter coefficients (cmp (45)) and finally the wavelet functionfrom (47.b). The quadratic case (N = 2) is graphed below.

Quadratic (N = 2) B-spline scaling and wavelet function.

As can be seen from the graph, the quadratic B-spline wavelet is much more like an “action pulse” thanthe Daubechies wavelet. Unlike the Haar and Daubechies wavelets the B-spline wavelets of order N >0 are not orthogonal. There is a mathematically straightforward way, however, to orthogonalize thewavelets. Define a new scaling function φorth by

(56) ( ) ( )( )∑ +

=

k

orth

kf

ff

ˆˆ

φ

φφ

which will automatically satisfy the orthogonality condition

(57) ( ) 1ˆ 2=+∑

k

kfφ

The drawback with the orthogonal B-spline wavelets obtained in this way is that they have infinitefilters. One way to circumvent this problem are the so-called bi-orthogonal wavelets, which usedifferent analysis and synthesis wavelets, called primary and dual wavelets. The dual and primarywavelets are orthogonal vis-a-vis each other but not within themselves (dual wavelet marked with atilde)

(58) kl

mnlmkn δδψψ =,,

~,

Page 18: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

18

Instead of (16) we get

(59) ( )∑≈kn

knkn txtx,

,,~,)( ψψ

Bi-orthogonal B-spline filters are obtained by assuming the relations

(60)( ) ( )( ) ( )zHzzG

zHzzG

−−=

−=−

01

1

11

0

between synthesis and analysis filters (this is a special case of (35)) The perfect reconstructioncondition (30.a) can thus be written as

(61)( ) ( )zHzGzP

zzPzP K

00)(2)()(

==−+ −

The bi-orthogonal B-spline wavelets consist of the solutions (see the Appendix for proof)

(62)

( )

( ) ( )

even. bemust ~

2

~

sin1

21

2

21

2

2

21

0

~

0

1

02

~

NNezNN

L

fj

jLzzG

zz

zH

fi

jL

j

N

NNN

+=+

=

+−

+

=

+=

∑−

=

−−

π

π

The analysis and synthesis high pass filters are then obtained using (60).

Appendix

A. The orthogonality condition

Assume the translates of the scaling function are orthogonal

(A.1) ( ) ( ) ndxxnx 0δφφ =−∫In the frequency domain this condition reads as

(A.2)

( )

( )∫ ∑

+

==1

0

22

22

0

ˆ

ˆ

dfkfe

dffe

k

nfi

nfin

φ

φδ

π

π

where in the last equality we used the periodicity of the exponential function. Condition (A.2) isequivalent with

Page 19: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

19

(A.3) ( ) 1ˆ 2=+∑

k

kfφ

which was referred to above in equ (57). Suppose we have

(A.4) ( ) ( ) ( )220ˆˆ ffMf φφ =

with

( ) ( )fMfM 00 1 =+

then (A.3) leads to the following form of the orthogonality condition

(A.5) ( ) ( ) 12

21

02

0 =++ fMfM

B. The B-spline solution

We prove that (62) satisfies (61.a) with K = 0. For P(z) we obtain the following expression (fiez π2= )

(B.1)

( ) ( )( )( )( ) j

L

jL

LNN

yj

jLyQ

fQfzP

∑−

=

+

+−=

=1

0

1

sincos2)( ππ

Equation (61.a) becomes using ( )( )2sin fy π=

(B.2) ( ) ( ) ( ) 111 =−+− yQyyQy LL

LL

Equation (B.2) can be proved by induction on L. It is obviously true for L = 1 when QL = 1. Using theproperty

(B.3)

+

=

+1

1k

nkn

kn

for the binomial coefficients we deduce, directly from the definition of Q, that

(B.4)

( ) ( ) ( )

( ) ( )yyLL

yQ

LL

yLL

yyQyQy

LL

LLL

21132

122

132

1

11

11

−−

+=

−−

−−

+=−

−−

−−

Using (B.4) we get (interchanging y and 1- y)

(B.5)( ) ( ) ( )( ) ( ) ( )yQyyQy

yQyyQy

LL

LL

LL

LL

−+−

=−+−

−−

−− 11

11

11

11

which completes the induction.

Page 20: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

20

C. Frames

For an admissible wavelet, like the Mexican wavelet (9) above, the signal can be reconstructed formthe wavelet transform of the signal via the inverse CWT (5). For special wavelets, like the Haarwavelets and the Daubechies wavelets, the signal can be reconstructed using a discrete subset of thedilated and scaled versions of the wavelet (equ (16*)). Does this work also e.g. for the Mexicanwavelet ? That question is addressed by the concept of frames. The square integrable functions on Rdefine an infinite dimensional vector space (a so-called Hilbert space), L2(R), with the inner product

(C.1)fff

dxxgxfgf

,

)()(, *

≡ ∫

A set of functions { ek } is called a frame if there are constants B > A > 0 such that

(C.2) fBeeffAk

kk ≤≤ ∑ ,

for every f in L2(R). The property (C.2) ensures that the function f can be reconstructed from its

“Fourier coefficients” kef , . Indeed, define the map T which sends functions f in L2(R) to

sequences { cn } in l2 (the space of square summable sequences) given by kefk

c ,= . The dual map

T* mapping sequences { cn } in l2 on functions f in L2(R) is defined by f = ∑k kekc . It follows then

from (C.2) that

(C.3) BITTAI ≤≤ *

(I denotes the identity map), which ensures that T*T has an inverse. It is therefore possible to define adual set of vectors through

(C.4) ( ) kk eTTe1*~ −

=

It follows that the function f can be represented as ∑k kekef ~, since

(C.5)( )

( ) ( ) ffTTTT

eTTefeefk

kkk

kk

==

=

−∑∑*1*

1*,~,

Daubechies (1992) has given criteria for the functions ( ) ( )nbtmamatnm −= ψψ 2/, to constitute a

frame for a given wavelet ψ . Especially, for the Mexican wavelet

(C.6) ( ) ( ) 22

41 21

32 x

exx −− −= πψ

(the constants in (C.6) make its square integral equal to 1) we have the frame bounds in case a = 2:

Page 21: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

21

b A B B/A0.25 13.091 14.183 1.0830.50 6.546 7.092 1.0830.75 4.364 4.728 1.0831.00 3.223 3.596 1.1161.25 2.001 3.454 1.7261.50 0.325 4.221 12.986

If A is close to B we can use the following formula (only a few terms are usually needed for a goodapproximation) to calculate the dual elements

(C.7) ( ) kj

j

BAk eTTIBA

e ∑∞

=+−

+=

0

*22~

Equation (C.7) follows from (C.4) and the operator equivalent of the formula L+++=−211

1 xxx .

D. The Morelet “wavelet”

The Morelet “wavelet”

(D.1) ( ) 2

20

41

0

2,

ttfif et απ

α παψ −

=

is widely used in signal processing, though it is not a proper wavelet. Its Fourier transform is given by

(D.2) ( ) ( )20

2241

02ˆ ,

fff ef −−

= α

π

απψ α

which does not vanish for f = 0, but for typical values of the constants it can still be quite small at thepoint f = 0. If we define the time and frequency resolution by

(D.3)( ) ( )

( ) dtttt

dfffff

f

f

∫=∆

−=∆

2

,2

2

,2

0

0

α

α

ψ

ψ

we get for the Morelet wavelet

(D.4)

α

πα

2142

=∆

=∆

t

f

Thus, the time and frequency resolutions are inversely related, π41=∆∆ tf and this is the best bound

that can be achieved for any distribution (Heisenberg relation). This is why the Morelet wavelet hasbeen considered as kind of an optimal tool for time-frequency analysis. Conventionally one defines the“quality factor” for the Morelet wavelet (D.1) by

Page 22: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

22

(D.5)α

π2

0fQ =

which is proportional to f0/∆f. A typical procedure is to calculate the transforms of a signal,

(D.6) ( )∫ −= duuxuttx ff )()( ,, αα ψ

for a sequence of a frequencies determined by

(D.7)

Q

Q

ss

q

fqf

21

21

0

1

1

+=

=

This means that the overlap between two adjacent frequency bands is of the order of e-2 if Q >> ½(i.e. about – 8.7 dB).

The above figure shows the (logarithmic) absolute value of (D.6) as a function of frequency (verticalaxis, ranging from 50 Hz to 300 Hz on a logarithmic scale) and time for the EMG-signal of theisometric test. The parameter values are α = 200, f0 = 50 Hz, q = 1.136 and Q = 7.85. Thesecorrespond, according to (D.4), to a time resolution ∆t of 0.05 s and a frequency resolution ∆f of 1.59Hz.

Literature(Hint: many valuable papers can be accessed on internet via ResearchIndex athttp://citeseer.nj.nec.com/ .)

1. Antenucci J: “Notes on spectral analysis”,http://www.cwr.uwa.edu.au/~antenucc/spectral_analysis/spectral_analysis.html – retrieved6.07.2000.

2. Bergh J et al.: Wavelets. Studentlitteratur 1999.3. Cohen A, Kovacevic J: “Wavelets – the mathematical background”, Proc. IEEE 84, 1996: 514 –

522.4. Couderc J-P, Zareba W: “Contributions of the wavelet analysis to the non-invasive

electrocardiology”, http://www.geocities.com/CollegePark/Library/1765/REF15.html – retrieved6.07.2000.

5. Daubechies I: Ten Lectures on Wavelets. SIAM 1992.

Page 23: EMG and Wavelet Analysis – Part Iborgbros/artiklar/emgwlet.pdf · Technical Report HUR – FB 07/16/00 1 EMG and Wavelet Analysis – Part I F Borg1, HUR Ltd EMG and Wavelet Analysis

Technical Report HUR – FB 07/16/00

23

6. Gasquet C, Wittowski P: Analyse de Fourier et Applications – Filtrage – Calcul Numerique –Ondelettes. Masson 1990.

7. Herzog W et al.: “EMG”, in Nigg M N, Herzog W (eds.): Biomechanics of the Musculo-skeletalSystem. Wiley 1995: 308 - 336.

8. Kaiser G: A Friendly Guide to Wavelets. Birkhäuser 1994.9. Kolev V et al.: “Time-frequency analysis reveals multiple functional components during oddball

P300”, http://cogprints.ac.uk/archives/neuro/papers/199806/199806013/doc.html/wavelet.htm -retrieved 27.6.2000.

10. Koornwinder T H (ed.): Wavelets – An Elementary Treatment of Theory and Applications. WorldScientific 1993.

11. Ngyuen T Q: “A tutorial on filter banks and wavelets” (Intern. Conf. on Digital Signal Processing,Cyprus, June 95). Retrieved 6.7.2000 via ResearchIndex (http://citeseer.nj.nec.com/).

12. Plett M: Ultrasonic Arterial Vibrometry with Wavelet Based Detection and Estimation. (Ph.D.diss., Dept. of Electrical Engineering, Univ. of Washington 2000). Retrieved 4.7.2000 fromhttp://www.spd.edu/~mplett.

13. Quian Quiroga R: “Obtaining single stimulus evoked potentials with wavelet denoising”,arXiv.nlin.CD/0006027 (http://xxx.lanl.gov) - retrieved 25.6.2000.

14. Rioul O, Vetterli M, “Wavelets and signal processing”, IEEE Signal Processing, October 1991: 14– 38.

15. Rossi J et al.: “Wavelet analysis of electrohysterography of women exhibiting clinical signs ofhigh-risk pregnancy”, http://funsan.biomed.mcgill.ca/~funnell/embc95_cd/texts/353.htm –retrieved 5.7.2000.

16. Sostaric A et al.:”Emg analysis using wavelet transform”, retrieved 6.7.2000 via ResearchIndex(http://citeseer.nj.nec.com/).

17. Unser M, Akram A: “A review of wavelets in biomedical applications”, Proc. IEEE, vol. 84. No.4. April 1996: 626 – 638.

18. Vetterli M, Kovacevic J: Wavelets and Subband Coding. Prentice Hall 1995.19. Walker J S: “Fourier analysis and wavelet analysis”, Notices of the American Mathematical

Society, Vol. 44. No. 6. June/July 1997: 658 – 670.20. Walker J S: A Primer on Wavelets and Their Scientific Applications. Chapman & Hall/CRC 1999.21. Zwick E B, Konrad P: The EMG Handbook. (Congress supplement for the Noraxon EMG Meeting

1994, Berlin).