Filtering in BioExplorer
Filtering in BioExplorer
Filtering theory
Every signal can be thought of as built up from a large number of sine and cosine waves
with different frequencies. A digital filter is a digital signal processor that attenuates a
signal for each of its frequencies differentially. Ideally, the passband frequencies of the
signal will be passed unchanged from input to output. The stopband frequencies,
however, will be completely attenuated at the output of the filter. This implies an infinitely
sharp fall-off of gain at the cut-off frequencies and a flat amplitude characteristic in both
the passband and the stopband.
Unfortunately, such ideal filters do not exist. Two categories of filters are used to
approximate the ideal behaviour, each with advantages and disadvantages: the Finite
Impulse Response (FIR) filters and the Infinite Impulse Response (IIR) filters. The
impulse response of a filter is the waveform that appears at the output of a filter when
a Dirac-pulse (infinitely short unity pulse) is presented at the input.
FIR (Finite Impulse Response)
The FIR filter is a non-recursive filter: a filter that uses the current input sample of the
signal together with previous input samples to calculate the current output sample.
y[n] = (M\SUM\k=0) bk * x[n-k]
In this differential equation bk are the impulse response coefficients. Because the output
has to be calculated from a limited number of input samples, the impulse response is
multiplied by a window of finite length (e.g. Hamming, von Hann and Kaiser). This yields
the finite number of coefficients bk (the order of the filter) that is necessary to calculate
the output. However, applying this window has several disadvantages. The finite number
of coefficients will not yield ideal filter characteristics. The fall-off will not be infinitely
sharp, but some frequency bands around the cut-off frequencies will be partly
attenuated, that is: some frequencies in the passband will exhibit a gain smaller than 1
and some frequencies in the stopband will exhibit a gain larger than 0. The fall-off will
increase with increasing number of coefficients or, equivalent, order or window length.
Furthermore, the behaviour in pass- and stopbands is influenced by the type of window
used. The amplitude characteristic will not be flat in these bands, but will show a ripple.
In the passband, the gain will not be 1 for every frequency, but each frequency will
exhibit a sligthly different gain. The larger the ripple, the larger the gain differences will
be and the more the signal will degrade at the output. In the stopband, most frequencies
that are supposed to be completely attenuated, will in some amount still be present in
the output signal.
The length of the window will also determine the delay. When a signal is fed into a
FIR filter, the ouput will have shifted its phase compared to the input. The phase shift
is equal to half the length of the window, multiplied by the sample time; and each
frequency in the signal will be shifted with the same constant phase shift.
FIR filter advantages
A FIR filter will always give a stable output, because it is non-recursive
A FIR filter has a delay that is constant over all frequencies; the signal shape
will not be influenced by phase shifts
Brainquiry B.V.
Brainquiry B.V.
Butterworth IIR
A Butterworth filter is a filter which has a maximally flat characteristic in the passband:
the gain decreases gradually from the center of the passband towards the 3 dB point.
No ripple is present in the stopband either.
Practical implications
The use of a Butterworth IIR filter is appropriate when a maximally flat pass- and
stopbands are important, when less stringent restrictions on fall-off and phase
characteristics are allowed. Choice to put emphasis on fall-off or phase characteristics
can be tuned by choosing an appropriate filter order. The phase characteristic of a
Butterworth filter is poor, therefore synchrony or other phase related analysis are not
recommended with this filter.
An example of the use of Butterworth filters in EEG would be an on-line EEG frequency
band analysis (theta, gamma, alpha, etc). The pass- and stopbands are maximally flat,
thus resulting in a quality output signal for the different frequency bands. Furthermore, a
reasonably sharp fall-off can be reached. Care has to be taken in selecting the correct
trade-off between fall-off and phase characteristic.
Chebyshev IIR
A Chebyshev filter has a constant ripple in the passband which oscillates between 1 and
(1+2)-1/2 ; can be tuned. The number of ripples in the passband increases with filter
order. There is a trade-off between the behaviour in passband and stopband. In
comparison with a Butterworth filter, the stopband behaviour and fall-off of a Chebyshev
are better.
Practical implications
The use of a Chebyshev IIR filter is appropriate when some ripple in the passband is
allowed and more emphasis is placed on good stopband behaviour and fall-off. The
phase characteristic of a Chebyshev filter is poor. The use of this filter is recommended
with intermediate frequency ranges e.g. alpha 1 vs. alpha 2.
Elliptic IIR
An elliptic IIR filter has a ripple of constant height in both passband and stopband, the
number increasing with filter order. In comparison with the Butterworth as well as the
Chebyshev, at a given order, the fall-off is better for an elliptic filter.
Practical implications
The use of an elliptic IIR filter is appropriate when the fall-off is the very critical design
criterion.
The sensori-motor rythm (SMR) is a good example of such a critical design criterion.
The SMR is a very specific rhythm of ~12-14 Hz. For a quantification of the SMR and
only the SMR a very narrow frequency band has to remain at the filter output, thus
implying a very steep fall-off. Some waveform degradation has to be accepted (ripple,
phase characteristic) to attain this sharp fall-off, but this is a small price to pay knowing
that you analyze a true sensorimotor rhythm.
Brainquiry B.V.
0.0 60.0 Hz
5 400
n.a.
n.a.
Butterworth IIR
Band range:
Order/length:
Ripple:
Attenuation:
0.0 60.0 Hz
18
n.a.
n.a.
Chebyshev IIR
Band range:
Order/length:
Ripple:
Attenuation:
0.0 60.0 Hz
18
min. 0.001
n.a.
Elliptic IIR
Band range:
Order/length:
Ripple:
Attenuation:
0.0 60.0 Hz
18
min. 0.001
-200 -10
Brainquiry B.V.
Brainquiry B.V.
Brainquiry B.V.
(ripple = 1.0, min. att.) Phase spectra improve when ripple is allowed larger.
At higher orders, there is a plateau of low delay at the middle frequencies, with
a fairly sharp fall-off at low and high cut-off frequencies. The 4th order has an
acceptable phase spectrum, which is flat for lower and middle frequencies
(reasonable amplitude spectrum too).
(min. ripple, max. att.) Higher order filter have large jumps in the phase spectrum
in different frequency bands (larger delay in bands closer to DC when filter order
is higher, bands become smaller with increasing order).
(ripple = 1.0, att. = -10) At higher orders very good phase spectra are obtained,
with a very steep fall-off at low and high cut-off frequencies. The absolute value of
the delay is hard to estimate, due to the large scale, but seems to be fairly small.
Brainquiry B.V.