Wavelet Analysis Of Signals For Diagnosing Epilepsy Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Epilepsy is a chronic neurological disorder that occurs due to hyper synchronous activity of neurons in the brain which produces spikes in EEG signals. Anything that disturbs the normal pattern of activity in brain can trigger epilepsy. The diagnosis of this disease becomes complicated when the EEG signals are treated as a whole. In this project, the frequency bands in the EEG signals are separated efficiently to increase the accuracy of disease diagnosis. The noise in raw EEG signals is eliminated by applying optimal FIR filter. These signals can then be finely separated into different frequency bands and analyzed instead of taking as a whole for efficient diagnosis of diseases. A novel approach for the sub band separation of EEG signals for analysis is done using wavelet transforms. Wavelet transforms are done to obtain time frequency localization of the signal. The signal is separated into its alpha, beta, gamma, theta and delta sub bands. This gives good temporal resolution than Fourier transforms. The scaling and wavelet functions are applied on the input signal. This is mainly useful in clinical applications to view fine tuned results. The results are analyzed using MATLAB and SIMULINK.

Keywords: Epilepsy, Park mc-clellan filter, Wavelet packet transforms, Matlab, SIMULINK.


Electroencephalogram signals are basically measurements of time varying potential differences in the brain. Epilepsy occurs in these signals due to hyper synchronous neuronal activity in brain. Epilepsy is a common chronic neurological disorder characterized by recurrent unprovoked seizures [3]. The normal rate of EEG signals would be 80 times/second whereas of the epileptic patients it would be 500 times/second. Anything that disturbs the normal pattern of activity in the brain can trigger epilepsy. The major causes of epilepsy are Brain chemistry, hereditary causes, Brain tumors, Alzheimer's disease, Stroke, heart attacks, and other conditions that affect the blood supply to the brain, Infectious diseases such as meningitis, viral encephalitis, AIDS, Cerebral palsy, autism, Head injuries, exposure to lead, carbon monoxide, and certain chemicals ,use of drugs and alcohol.

The signal conditioning of EEG signals are done using FIR filters. Since the IIR filters have the drawbacks of non linear phase response, more susceptible to problems of finite-length arithmetic, such as noise generated by calculations, and limit cycles. They are harder (slower) to implement using fixed-point arithmetic. They don't offer the computational advantages of FIR filters. The FIR filters can be implemented using optimal method, Windowing method, Frequency sampling method. In the Window design method and the frequency sampling method for an FIR filter, there are drawbacks such as Lack of flexibility, Poor amplitude response, Pass band and stop band frequencies cannot be precise, and the filter is non-causal [2]. The order of the filter is infinitely large. The resulting filter has a frequency response that exactly interpolates the given samples, but there is no explicit control of the behavior between the samples.

Hence in this paper, the optimal Parks-McClellan algorithm is used. The Parks-McClellan algorithm, published by James McClellan and Thomas Parks in 1972, is an iterative algorithm for finding the optimal Chebyshev finite impulse response (FIR) filter [1]. The Parks-McClellan algorithm is utilized to design and implement efficient and optimal FIR filters. It uses an indirect method for finding the optimal filter coefficients. In the design of a low pass filter using the Parks-McClellan algorithm, there are three parameters to be determined, the pass band edge the stop band edge and filter order. The advantages of this method are Efficient to calculate filter coefficients, Good amplitude response characteristics. The present work after FIR filtering is carried over to sub band separation of EEG signals. The EEG taken as a whole is less informative for the diagnosis of diseases which cause small variations in the signal. This will often lead to inaccurate diagnosis. The wavelet transforms is a time-frequency localization of a signal which gives all the hidden information regarding frequency in Fourier transforms. There are several families of wavelets and we have to choose the one that best fits our application. Here the Daubechies Wavelet transforms is used to analyze the signal. An overview of the proposed methodology is presented schematically in Fig.1.


Park Mc-Clellan FIR

EEG sample


Wavelet Packet Transforms




Fig.1.Schematic diagram of the wavelet methodology


The EEG databases are taken from [2]. The EEG samples are taken as three categories: normal, ictal and inter-ictal patients. Five sets denoted A-E each containing 100 single channel EEG segments of 23.6-sec duration, were obtained [8]. Volunteers were relaxed in an awake state with eyes open A and eyes closed B respectively. Sets C, D, and E originated from our EEG archive of presurgical diagnosis. The signals are taken from a 128-channel EEG system and After 12 bit analog-to-digital conversion, the data were written continuously onto the disk of a data acquisition computer system at a sampling rate of 173.61 Hz. Band-pass filter settings were 0.53-40 Hz. The plot of the input signals is done in MATLAB.

Fig.2. Signals from normal, ictal and inter-ictal subjects


The optimal FIR filtering approach is by using the Parks-McClellan algorithm. The goal of the algorithm is to minimize the error in the pass and stop bands by utilizing the Chebyshev approximation. The Parks-McClellan algorithm is a variation of the Remez algorithm or Remez exchange algorithm, with the change that it is specifically designed for FIR filters and has become a standard method for FIR filter design. the algorithm above in a simpler form has the following steps: Guess the positions of the extrema are evenly spaced in the pass and stop band, Perform polynomial interpolation and re-estimate positions of the local extrema, Move extrema to new positions and iterate until the extrema stop shifting.

Apass = 20 log (1+δp)

Astop = -20 log δs


a=0.22+0.0366SBR, where SBR is Stop Band Attenuation.

The values of the Pass band attenuation, Stop band attenuation, Filter order (N), Filter coefficient are computed using the formulas above.


Fourier transforms which computes only the time response of the signal. The Fourier analysis brings only global information which is not sufficient to detect compact patterns. Also the Fourier transforms are not applicable for non-stationary signals [4]. Hence to overcome these drawbacks of Fourier transforms the wavelet analysis is done. A wavelet series is a representation of a square-integral (real- or complex-valued) function by a certain orthonormal series generated by a wavelet. This method gives the response in both time and frequency domain. It gives better response for non-stationary biological signals. No information is lost, however, and the result of the wavelet transform can be perfectly reconstructed into the original data.


The Discrete Wavelet Transform is applied to the filtered data and it splits the signal to series of low and high frequencies [2]. Then the signals are down sampled since the data points will be doubled when applied to filter banks. It splits the frequencies as

1st level decomposition: 1/ (2*dt)

2nd level decomposition: 1/ (4*dt)

3rd level decomposition: 1/ (8*dt)

4th level decomposition: 1/ (16*dt) and so on.

Wavelets are defined by the wavelet function ψ (t) (i.e. the mother wavelet) and scaling function φ(t) (also called father wavelet) in the time domain. The wavelet function is in effect a band-pass filter and scaling it for each level halves its bandwidth.

Wavelet packet decomposition

Wavelet packet decomposition is a wavelet transform where the signal is passed through more filters than the discrete wavelet transform. In the DWT, each level is calculated by passing only the approximation coefficients (cAj) through low and high pass filters. However in the WPD, both the approximation and detail coefficients are decomposed. The Daubechies wavelets are a family of orthogonal wavelets defining a discrete wavelet transform and characterized by a maximal number of vanishing moments for some given support. With each wavelet type of this class, there is a scaling function (also called father wavelet) which generates an orthogonal multiresolution analysis. The frequency splitting is done using 4th order "db4" family of wavelets.


Using FDATool

The Filter Design and Analysis Tool (FDATool) is a powerful graphical user interface (GUI) in the Signal Processing Toolbox™ for designing and analyzing filters. FDATool enables you to quickly design digital FIR or IIR filters by setting filter performance specifications, by importing filters from your MATLAB® workspace or by adding, moving or deleting poles and zeros. FDATool also provides tools for analyzing filters, such as magnitude and phase response plots and pole-zero plots. In section (), the formulas for computing the specifications of optimal FIR filter is given and the values are computed and tabulated in Table (1).

TABLE (1) Specifications for FIR filter



Sampling frequency

173.61 Hz

Pass band frequency

60 Hz

Stop band frequency

70 Hz

Pass band attenuation

1 db

Stop band attenuation

40 db

Filter order


Fig.3. Magnitude response of FIR filter using Park-McClellan algorithm

Fig.4. FIR filter response in time domain

Fig.5. FFT of input with noise

Fig.6. FFT of optimal FIR filter output

Wavelet packet analysis

The Daubechies wavelet transforms is used with fourth order and fourth level so that frequencies are split into finer parts. We can do any further computations by operating on those frequencies. The frequencies at various nodes of the tree can be viewed using wavelet packet transforms. The sampling frequency is double the cut off frequency, and then your first level wavelet detail coefficients will represent features in the input signal in the approximate octave band [43.4025, 86.8050]. The second level detail coefficients in the approximate octave band [21.7013, 43.4025] and so on. We can further fine tune the frequencies by using suitable filters for post processing. The band limited EEG in the range 0-60 Hz from the optimal FIR filter is given as input to the wavelet filters banks. W = dbaux (N, SUMW) is the order N Daubechies scaling filter such that sum (W) = SUMW. Possible values for N are 1, 2… The band separation is as follows: Gamma: 30-60 Hz, Beta: 13-30 Hz, Alpha: 8-12 Hz.

Fig.7. separation of sub bands

Fig.8. Frequency domain of output from wavelet filter


Simulink is an environment for multidomain simulation and Model-Based Design for dynamic and embedded systems. It provides an interactive graphical environment and a customizable set of block libraries that let you design, simulate, implement, and test a variety of time-varying systems, including communications, controls, signal processing, video processing, and image processing. Here the data is loaded in Simulink from workspace and appropriate outputs are obtained.

Fig.9. Simulink model for FIR and Wavelet filter

Fig.10. Scope output of FIR filter

Fig.11. output of gamma band

Fig.12. output of beta band

Fig.13. output of alpha band


Thus in this paper, we have analyzed the EEG signals with suitable optimal filters for eliminating noise and separated the frequency bands using MATLAB. We have modeled a system for separation of sub bands of EEG signals after optimal preprocessing using SIMULINK.