Real-Time Filtering in BioExplorer

Similar documents
Transition Bandwidth Analysis of Infinite Impulse Response Filters

Design of Efficient Digital Interpolation Filters for Integer Upsampling. Daniel B. Turek

Em bedded DSP : I ntroduction to Digital Filters

Short-time FFT, Multi-taper analysis & Filtering in SPM12

Filter Comparison. Match #1: Analog vs. Digital Filters

AN-837 APPLICATION NOTE

First, we show how to use known design specifications to determine filter order and 3dB cut-off

Design of FIR Filters

ANALYZER BASICS WHAT IS AN FFT SPECTRUM ANALYZER? 2-1

Understanding CIC Compensation Filters

CTCSS REJECT HIGH PASS FILTERS IN FM RADIO COMMUNICATIONS AN EVALUATION. Virgil Leenerts WØINK 8 June 2008

SUMMARY. Additional Digital/Software filters are included in Chart and filter the data after it has been sampled and recorded by the PowerLab.

Digital Signal Processing IIR Filter Design via Impulse Invariance

TCOM 370 NOTES 99-4 BANDWIDTH, FREQUENCY RESPONSE, AND CAPACITY OF COMMUNICATION LINKS

HYBRID FIR-IIR FILTERS By John F. Ehlers

ELEN E4810: Digital Signal Processing Topic 8: Filter Design: IIR

Agilent AN 1316 Optimizing Spectrum Analyzer Amplitude Accuracy

How to Design 10 khz filter. (Using Butterworth filter design) Application notes. By Vadim Kim

LM833,LMF100,MF10. Application Note 779 A Basic Introduction to Filters - Active, Passive,and. Switched Capacitor. Literature Number: SNOA224A

PIEZO FILTERS INTRODUCTION

SECTION 6 DIGITAL FILTERS

Frequency Response of Filters

SWISS ARMY KNIFE INDICATOR John F. Ehlers

IIR Half-band Filter Design with TMS320VC33 DSP

A Basic Introduction to Filters Active Passive and Switched-Capacitor

Electronic Communications Committee (ECC) within the European Conference of Postal and Telecommunications Administrations (CEPT)

1995 Mixed-Signal Products SLAA013

NAPIER University School of Engineering. Electronic Systems Module : SE32102 Analogue Filters Design And Simulation. 4 th order Butterworth response

The front end of the receiver performs the frequency translation, channel selection and amplification of the signal.

Laboratory #5: RF Filter Design

Time Series Analysis: Introduction to Signal Processing Concepts. Liam Kilmartin Discipline of Electrical & Electronic Engineering, NUI, Galway

SR2000 FREQUENCY MONITOR

CHAPTER 8 ANALOG FILTERS

Analog and Digital Signals, Time and Frequency Representation of Signals

Lecture 9. Poles, Zeros & Filters (Lathi 4.10) Effects of Poles & Zeros on Frequency Response (1) Effects of Poles & Zeros on Frequency Response (3)

Appendix D Digital Modulation and GMSK

ADC and DAC. Quantization

Chapter 8 - Power Density Spectrum

Clutter Filter Design for Ultrasound Color Flow Imaging

See Horenstein 4.3 and 4.4

TESTS OF 1 MHZ SIGNAL SOURCE FOR SPECTRUM ANALYZER CALIBRATION 7/8/08 Sam Wetterlin

Sampling Theory For Digital Audio By Dan Lavry, Lavry Engineering, Inc.

Loop Bandwidth and Clock Data Recovery (CDR) in Oscilloscope Measurements. Application Note

The Calculation of G rms

Introduction to Digital Filters

Evaluating Oscilloscope Bandwidths for Your Application

Lock - in Amplifier and Applications

HITACHI INVERTER SJ/L100/300 SERIES PID CONTROL USERS GUIDE

Infinite Impulse Response Filter Structures in Xilinx FPGAs

(Refer Slide Time: 01:11-01:27)

isim ACTIVE FILTER DESIGNER NEW, VERY CAPABLE, MULTI-STAGE ACTIVE FILTER DESIGN TOOL

DSP-I DSP-I DSP-I DSP-I

Digital filter design for electrophysiological data a practical approach

8 Filtering. 8.1 Mathematical operation

73M2901CE Programming the Imprecise Call Progress Monitor Filter

Motorola Digital Signal Processors

Section 5.0 : Horn Physics. By Martin J. King, 6/29/08 Copyright 2008 by Martin J. King. All Rights Reserved.

Implementation of the LMS Algorithm for Noise Cancellation on Speech Using the ARM LPC2378 Processor.

Time series analysis Matlab tutorial. Joachim Gross

Network Analyzer Operation

AVR223: Digital Filters with AVR. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

chapter Introduction to Digital Signal Processing and Digital Filtering 1.1 Introduction 1.2 Historical Perspective

EE 508 Lecture 11. The Approximation Problem. Classical Approximations the Chebyschev and Elliptic Approximations

Lecture 6 - Design of Digital Filters

Simple SDR Receiver. Looking for some hardware to learn about SDR? This project may be just what you need to explore this hot topic!

Agilent Time Domain Analysis Using a Network Analyzer

Simulation of Frequency Response Masking Approach for FIR Filter design

T = 1 f. Phase. Measure of relative position in time within a single period of a signal For a periodic signal f(t), phase is fractional part t p

Anatech Electronics, Inc.

Nano Stepping Notch Filter Jim Hagerman

Clock Recovery in Serial-Data Systems Ransom Stephens, Ph.D.

Positive Feedback and Oscillators

The Effects of Start Prices on the Performance of the Certainty Equivalent Pricing Policy

More Filter Design on a Budget

PRACTICAL GUIDE TO DATA SMOOTHING AND FILTERING

Analog Filters. A common instrumentation filter application is the attenuation of high frequencies to avoid frequency aliasing in the sampled data.

Chapter 12: The Operational Amplifier

What you will do. Build a 3-band equalizer. Connect to a music source (mp3 player) Low pass filter High pass filter Band pass filter

TTT4110 Information and Signal Theory Solution to exam

Chapter 4: Passive Analog Signal Processing

TDA W Hi-Fi AUDIO POWER AMPLIFIER

Chebyshev Filter at MHz Frequency for Radar System

Applications of the DFT

A DESIGN OF DSPIC BASED SIGNAL MONITORING AND PROCESSING SYSTEM

DESIGN AND SIMULATION OF TWO CHANNEL QMF FILTER BANK FOR ALMOST PERFECT RECONSTRUCTION

Precision Diode Rectifiers

Dithering in Analog-to-digital Conversion

Experiment 3: Double Sideband Modulation (DSB)

Time-series filtering techniques in Stata

Department of Electrical and Computer Engineering Ben-Gurion University of the Negev. LAB 1 - Introduction to USRP

RF Network Analyzer Basics

Lecture 1-6: Noise and Filters

What the Nyquist Criterion Means to Your Sampled Data System Design. by Walt Kester

Implementation of Digital Signal Processing: Some Background on GFSK Modulation

Title : Analog Circuit for Sound Localization Applications

24 Butterworth Filters

RF Measurements Using a Modular Digitizer

Understand the effects of clock jitter and phase noise on sampled systems A s higher resolution data converters that can

Transmission Line and Back Loaded Horn Physics

Designing a Linear FIR filter

Transcription:

Real-Time 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) b k * x[n-k] In this differential equation b k 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 b k (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

FIR filter disadvantages A FIR filter is inefficient, it uses lots of input to calculate the output, therefore: A FIR filter has a large delay The use of a FIR filter is appropriate when the phase characteristic should be flat. When the demands on the filter are not very high, this is the easy solution to go for. In the context of EEG measurements this filter could be used as high pass or low pass filters. The EEG signal is not degraded by a variable phase characteristic and yet a sharp fall-off can be attained by picked a filter with a high order, since a large delay is allowed for the off-line application. These filters are especially well suited if the phase characteristic of the signal is very important and can thus be used for coherence and synchrony measures. IIR (Infinite Impulse Response) An IIR filter uses a different approach in calculating output. The IIR filter is recursive: it uses the current input sample together with previous output samples to calculate the current output sample. y[n] = (N\SUM\k=1) a k * y [n-k] + (M\SUM\k=0) b k * x[n-k], N>=0, M>0 The order of the filter is determined by the number of previous output samples used to calculate the current output sample. As was the case with FIR filters, increasing the order of the filter will improve the amplitude characteristics of the filter. Naturally, there is a drawback to increasing filter order. More samples are used to calculate output, therefore the filter is less efficient. This results in an degradation of the phase characteristic. The mechanisms underlying IIR filtering are beyond the scope of this discussion. IIR filter advantages An IIR filter is very efficient, it uses only a few previous output values to calculate the current output, therefore: An IIR filter has only a small delay IIR filter disadvantages An IIR filter can become unstable, if coefficients are not well chosen Because the requirement of causality and an infinite impulse response that converges to 0 for n => infinity, the impulse response cannot be symmetrical. This implies a phase characteristic that is not constant over frequencies. Therefore, different frequencies will appear at the output with a different shift in phase. The shape of the output signal will change as a consequence of different phase shifts. The use of an IIR filter is appropriate when, a small absolute delay is required or when strong requirements on amplitude characteristic are necessary. Where there is only one type of FIR filter, there are several types of IIR filters. Three of these will be discussed below: the Butterworth, the Chebyshev and the Elliptic IIR filters.

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. 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. 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. 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.

Filter setting possibilities in BioExplorer Band range: the range of frequencies at which the 3dB points can be placed, -3dB point meaning a gain of the input signal of 0.5 at that particular frequency. Order/length: the order of a filter is determined by the number of values (input in the case of FIR, input & output in the case of IIR) that are used to calculate the output sample. Ripple: a ripple is an oscillation on the stop- and passbands in the amplitude spectrum, ideally these would be flat. FIR Order/length: 5 400 Ripple: n.a. Attenuation: n.a. Butterworth IIR Order/length: 1 8 Ripple: n.a. Attenuation: n.a. Chebyshev IIR Order/length: 1 8 Ripple: min. 0.001 Attenuation: n.a. Elliptic IIR Order/length: 1 8 Ripple: min. 0.001 Attenuation: -200-10

Evaluation of filter spectra in BioExplorer In the following evaluations of filter spectra, the passband was set to [0.0 30.0] In BioExplorer the smallest possible 3dB point can be set to 0.0 Hz. This means that DC recording will always suffer from signal distortion, because the true DC level will exhibit a gain of 0.5. Thus, effectively, only half of the true DC level would remain at the output of the filter. The cut-off determines how much of the low frequency signal is attenuated. A very sharp cut-off will only attenuate the true DC level. A less sharp cut-off will attenuate low frequencies as well (with a gain of 0.5 1; the higher the frequency, the less attenuated). Theoretically, the attenuation of the true DC level should always be 3dB, when a low cut-off of 0.0 Hz is chosen. However, the gain of the DC level shows a dependence on filter order and describes a cycle of a gain of 0 to 1. The number of orders that comprise a cycle seems to be dependent on the passband that is chosen. FIR Magnitude The cut-off becomes sharper with increasing order. Theoretically, the attenuation of the true DC level should always be 3dB, when a low cut-off of 0.0 Hz is chosen. However, the gain of the DC level shows a dependence on filter order and describes a cycle of a gain of 0 to 1. The number of orders that comprise a cycle seems to be dependent on the passband that is chosen. There seems to be a small ripple on the passband, which according to theory is equal to the ripple in the stopband. This ripple is independent of filter order. The delay is constant over all frequencies and increases with increasing order. The choice of filter order is a matter of finding the right balance between fall-off and delay. Butterworth IIR Magnitude The cut-off becomes sharper with increasing order. At higher orders the amplitude spectrum flattens of nicely. Filters with an even order display bad behaviour at the lower frequencies (gain = 0 or gain = 1.4). The passband ripple (and stopband ripple???) becomes smaller at higher filter orders. Order 7 seems to yield the best amplitude spectrum. The delay (at orders > 1) is much larger in the vicinity of the cut-off frequencies, as it is at the middle frequencies. Order 5 seems a good option here: small delay at DC level, somewhat bigger (0.035) in the 3-20 Hz plateau, and ascending to 0.06 in the 20-30 Hz range.

Amplitude characteristics seems OK at order 5; order 5 would be my choice for DC measurements with a Butterworth filter. Chebyshev IIR Magnitude When a minimal ripple is set, fall-off increases with increasing filter order. The behaviour in the middle frequencies is really good at higher orders. Low frequencies, however, exhibit very bad behaviour; either gain is too high or too low. If a larger ripple is allowed, the behaviour in the middle frequencies deteriorates. On the other hand there is an improvement in the behaviour at lower frequencies: the very high or very low gain is only present at the very low frequencies close to DC level. Effectively, this also means that the cut-off is improved when a larger ripple is allowed. When the ripple is set to minimal, the phase spectrum is very bad. At some filter orders, very high plateaus comprising some frequency intervals rise up to a large delay. Actually, the delay is acceptable at no order, except order 1 & 2. At larger ripples, delay properties improve a lot. At higher orders the delay is much higher at the cut-off frequencies, but the fall-off to the middle frequencies (small delay plateau) is reasonably sharp. The absolute delay, however, is fairly large at orders higher than order 4. At a ripple of 1 (which actually seems too large) order 4 would be a good option. When a smaller ripple is required (e.g. 0.3), order 7 seems a good choice. Elliptic IIR Manitude At a minimal ripple and attenuation the behaviour at the middle frequencies is very acceptable and of course again the sharper cut-off at higher filter orders. The difference in gain, however, is very big between low and middle frequencies. If a larger ripple is allowed, the same result as with the chebyshev is attained: sharper fall-off at low and high cut-off frequencies. With a minimal ripple and maximal attenuation (-10, 0) the amplitude spectrum exhibits acceptable but worse behaviour at the middle frequencies (at higher filter orders). The fall-off is very sharp, but displays oscillations in the vicinity of the cut-off frequency. This leads to unacceptable behaviour at the lower frequencies. Furthermore, the stopband shows large oscillations. If a larger ripple is allowed, the behaviour in the passband is very good, especially at orders 3, 5 and 7 (ripple = 1, att. = -10). However, the stopband shows large ripples. (min. ripple, min. att.) The delay shows very bad phase spectra with big jumps in the spectra. Order 8 seems OK, but with a very large delay at the DC level. Order 5 and 6 are better, but without the flat spectra.

(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 4 th 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. An advisable setting would be: Order 8, ripple = 0.3, att. = -40