Digital Filters - A Basic Primer

Similar documents
Design of FIR Filters

Digital Filters IIR (& Their Corresponding Analog Filters) Week Date Lecture Title

(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters


Corso di DATI e SEGNALI BIOMEDICI 1. Carmelina Ruggiero Laboratorio MedInfo

4. Design of Discrete-Time Filters

Understanding Digital Signal Processing

Chapter 5 Window Functions. periodic with a period of N (number of samples). This is observed in table (3.1).

Digital Filters FIR and IIR Systems

Appendix B. Design Implementation Description For The Digital Frequency Demodulator

The University of Texas at Austin Dept. of Electrical and Computer Engineering Final Exam

Digital Filtering: Realization

EE 470 Signals and Systems

DSP Filter Design for Flexible Alternating Current Transmission Systems

Advanced Digital Signal Processing Part 5: Digital Filters

Digital Signal Processing. VO Embedded Systems Engineering Armin Wasicek WS 2009/10

EE 422G - Signals and Systems Laboratory

Electrical & Computer Engineering Technology

6 Sampling. Sampling. The principles of sampling, especially the benefits of coherent sampling

DSP Laboratory (EELE 4110) Lab#10 Finite Impulse Response (FIR) Filters

FFT Analyzer. Gianfranco Miele, Ph.D

ELEC-C5230 Digitaalisen signaalinkäsittelyn perusteet

Window Method. designates the window function. Commonly used window functions in FIR filters. are: 1. Rectangular Window:

Design of FIR Filter for Efficient Utilization of Speech Signal Akanksha. Raj 1 Arshiyanaz. Khateeb 2 Fakrunnisa.Balaganur 3

Team proposals are due tomorrow at 6PM Homework 4 is due next thur. Proposal presentations are next mon in 1311EECS.

Digital Signal Processing

Signal Processing. Naureen Ghani. December 9, 2017

Experiment 4- Finite Impulse Response Filters

DIGITAL FILTERS. !! Finite Impulse Response (FIR) !! Infinite Impulse Response (IIR) !! Background. !! Matlab functions AGC DSP AGC DSP

Experiment 2 Effects of Filtering

DIGITAL SIGNAL PROCESSING WITH VHDL

Signal processing preliminaries

Biomedical Instrumentation B2. Dealing with noise

Biosignal filtering and artifact rejection. Biosignal processing I, S Autumn 2017

Analog Design-filters

Enhanced Sample Rate Mode Measurement Precision

CHAPTER 2 FIR ARCHITECTURE FOR THE FILTER BANK OF SPEECH PROCESSOR

Signals. Continuous valued or discrete valued Can the signal take any value or only discrete values?

THE NEXT GENERATION AIRBORNE DATA ACQUISITION SYSTEMS. PART 1 - ANTI-ALIASING FILTERS: CHOICES AND SOME LESSONS LEARNED

SIGMA-DELTA CONVERTER

Fourier Theory & Practice, Part I: Theory (HP Product Note )

Contents. Introduction 1 1 Suggested Reading 2 2 Equipment and Software Tools 2 3 Experiment 2

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY DIGITAL SIGNAL PROCESSING UNIT 3

Outline. Introduction to Biosignal Processing. Overview of Signals. Measurement Systems. -Filtering -Acquisition Systems (Quantisation and Sampling)

Outline. Discrete time signals. Impulse sampling z-transform Frequency response Stability INF4420. Jørgen Andreas Michaelsen Spring / 37 2 / 37

Noise removal example. Today s topic. Digital Signal Processing. Lecture 3. Application Specific Integrated Circuits for

Michael F. Toner, et. al.. "Distortion Measurement." Copyright 2000 CRC Press LLC. <

CS3291: Digital Signal Processing

Keywords FIR lowpass filter, transition bandwidth, sampling frequency, window length, filter order, and stopband attenuation.

F I R Filter (Finite Impulse Response)

Digital Signal Processing

LIMITATIONS IN MAKING AUDIO BANDWIDTH MEASUREMENTS IN THE PRESENCE OF SIGNIFICANT OUT-OF-BAND NOISE

This tutorial describes the principles of 24-bit recording systems and clarifies some common mis-conceptions regarding these systems.

Advanced Digital Signal Processing Part 2: Digital Processing of Continuous-Time Signals

SCUBA-2. Low Pass Filtering

UNIT-3. Electronic Measurements & Instrumentation

Keysight Technologies Pulsed Antenna Measurements Using PNA Network Analyzers

Bibliography. Practical Signal Processing and Its Applications Downloaded from

DIGITAL FILTERING OF MULTIPLE ANALOG CHANNELS

Narrow-Band Low-Pass Digital Differentiator Design. Ivan Selesnick Polytechnic University Brooklyn, New York

Performance Analysis on frequency response of Finite Impulse Response Filter

Agilent Time Domain Analysis Using a Network Analyzer

UNIVERSITY OF SWAZILAND

Biosignal filtering and artifact rejection. Biosignal processing, S Autumn 2012

Design Digital Non-Recursive FIR Filter by Using Exponential Window

2) How fast can we implement these in a system

EEM478-DSPHARDWARE. WEEK12:FIR & IIR Filter Design

HARDWARE IMPLEMENTATION OF LOCK-IN AMPLIFIER FOR NOISY SIGNALS

y(n)= Aa n u(n)+bu(n) b m sin(2πmt)= b 1 sin(2πt)+b 2 sin(4πt)+b 3 sin(6πt)+ m=1 x(t)= x = 2 ( b b b b

Signal Processing for Digitizers

Characterizing High-Speed Oscilloscope Distortion A comparison of Agilent and Tektronix high-speed, real-time oscilloscopes

Signals and Filtering

Infinite Impulse Response Filters

Fundamentals of Time- and Frequency-Domain Analysis of Signal-Averaged Electrocardiograms R. Martin Arthur, PhD

ECE 5650/4650 Exam II November 20, 2018 Name:

INTRODUCTION DIGITAL SIGNAL PROCESSING

Understanding the Behavior of Band-Pass Filter with Windows for Speech Signal

Performance Analysis of FIR Filter Design Using Reconfigurable Mac Unit

Part One. Efficient Digital Filters COPYRIGHTED MATERIAL

Designing Filters Using the NI LabVIEW Digital Filter Design Toolkit

Fig 1 describes the proposed system. Keywords IIR, FIR, inverse Chebyshev, Elliptic, LMS, RLS.

Brief Introduction to Signals & Systems. Phani Chavali

ELEC3104: Digital Signal Processing Session 1, 2013

Biomedical Signals. Signals and Images in Medicine Dr Nabeel Anwar

FIR Filter Design using Different Window Techniques

Interpolated Lowpass FIR Filters

6.555 Lab1: The Electrocardiogram

II Year (04 Semester) EE6403 Discrete Time Systems and Signal Processing

B.Tech III Year II Semester (R13) Regular & Supplementary Examinations May/June 2017 DIGITAL SIGNAL PROCESSING (Common to ECE and EIE)

Class D audio-power amplifiers: Interactive simulations assess device and filter performance

Instruction Manual DFP2 Digital Filter Package

ECE438 - Laboratory 7a: Digital Filter Design (Week 1) By Prof. Charles Bouman and Prof. Mireille Boutin Fall 2015

EC6502 PRINCIPLES OF DIGITAL SIGNAL PROCESSING

GUJARAT TECHNOLOGICAL UNIVERSITY

Electric Circuit Theory

Problem Point Value Your score Topic 1 28 Discrete-Time Filter Analysis 2 24 Improving Signal Quality 3 24 Filter Bank Design 4 24 Potpourri Total 100

Real-time digital signal recovery for a multi-pole low-pass transfer function system

AC : FIR FILTERS FOR TECHNOLOGISTS, SCIENTISTS, AND OTHER NON-PH.D.S

A Closer Look at 2-Stage Digital Filtering in the. Proposed WIDAR Correlator for the EVLA

Transcription:

Digital Filters A Basic Primer Input b 0 b 1 b 2 b n t Output t a n a 2 a 1 Written By: Robert L. Kay President/CEO Elite Engineering Corp Notice! This paper is copyrighted material by Elite Engineering Corporation. You are free to copy and/or distribute in part or in whole on two conditions: any and all recipients will receive this work at no cost to any one and that credit be given to the author and the company exactly as shown above under Written By:. 8Copyright 1996, Elite Engineering Corp, Thousand Oaks, CA

Introduction Since the advent of inexpensive processing power, the general engineering community has had opportunity to apply digital filtering techniques to signal processing applications. Filter functions that were not realizable in analog implementations came into practicality. Filters with very steep cutoffs or very narrow notches could be realized by software implementations. An amazing amount of signal to noise improvement became attainable with systems having spectrally separated and unique signal components. As digital filtering became more and more popular, unique integrated circuit chipsets and processors were developed to provide high speed, compact implementations. Complementary design tools were developed to speed development time and simplify the necessary software coding requirements. However, this new tool still requires an understanding and some expertise in mathematics, most notably of Fourier and Laplace transforms. The progress in personal computer software tools has reduced the need to manipulate the mathematics symbolically. This makes application of software driven digital filters a straightforward number crunching task in most cases. Yet it is still crucial for the designer to understand the principles at work. The designer should know the basic principles behind filters, FFT=s and numerical processes. Medical products require a broad range of signal processing requirements. Generally speaking, medical analyzers present some of the most interesting and rigorous design challenges in the signal processing arena. Most diagnostic devices are based upon instrumentation of one form or another. In the development of the majority of that type of instrumentation, the goal is to maximize signal to noise ratio. Interference from AC power, motors, and such can dramatically reduce the ability of low cost equipment to achieve its best performance. Digital filtering can provide a low cost solution to reducing noise beyond what can be achieved with typical analog solutions. This article provides the reader with a basic introduction to digital filters and provides a simple tool to allow the reader to explore these fascinating tools in greater detail. Basics In general, the need for filtering arises when the signal of interest is mixed with interfering signals or noise. Almost all noise or sources of interference can be analyzed from the frequency domain perspective. In order to determine which filter type and characteristics are required for any particular application, the spectral characteristics of the signal and its noise (or interfering components) is necessary. The designer must then define the required output SNR (signal to noise ratio), response time, overshoot and other parameters as may be Elite Engineering Corp Page 2

deemed significant to the application. When that is complete, the filtering requirements can be established and a detailed design can commence. In the past, analog filters were the primary means to performing the necessary filtering to separate the signal from the noise components. In some cases, the design of multipole analog filters required a number of relatively large components to achieve the required degree of filtering. The resulting filter was susceptible to minor variations in component values and often required additional amplifiers to perform buffering. The stability of these amplifiers required a reasonable degree of analysis which might be offset using cookbook designs and simulation software. Sharp filter functions were expensive and time consuming to implement. Predicting the response of these filters to all variations and scenarios was difficult and time consuming. Amplifiers saturated, inductors saturated, and capacitors exhibited dielectric absorption to name a few of the ill=s that analog designers had to deal with. The reader must be fully aware that with digital filters, the basic concepts behind these problems have not changed and they now plague the digital engineer too. Digital Filters General Form Figure 1 shows the basic structure for a general purpose digital filter. The structure is composed of Zdomain delay blocks, gain stages and summing junctions. Observation of this structure shows how the filter processing each input sample as well as the output. Each time the system samples the input, the top half of the system takes previous input samples and shifts them down the chain of blocks. Thus the system Aremembers@ a fixed series of past input values. Each past value and the present input value is multiplied by a fixed coefficient. These terms are summed up to create the filter output. The lower half of the diagram shows how the filter can also use the current output value as well as Aremember@ past output values. These values are also multiplied by fixed coefficients and summed to add into the current output value. In general, each element in the filter structure creates a pole in the response. As noted in the figure, an FIR (Finite Impulse Response) filter will have some or all Ab@ terms but will not use any Aa@ terms. An IIR (Infinite Impulse Response) filter will have Aa@ terms but may not have some of the Ab@ terms (it must have at least one, usually b 0 ). There can be much debate regarding the appropriateness of each type of filter. For the purposes of this article, it is more important to notice that an FIR filter uses memory to recall past inputs and integrate them with a specific weighting function (i.e. the Ab@ terms). Thus an FIR uses no feedback, is inherently Elite Engineering Corp Page 3

stable and will not oscillate. On the other hand, an IIR filter provides feedback via nonzero values for the Aa@ terms (b terms may or may not be present). This allows the potential for oscillation and thus such filters are not inherently stable. General Purpose Digital Filter Configuration Input b 0 b 1 b 2 b n Output a n a 2 a 1 = Unit Time delay (sampling delay) a x, b x = simple gain blocks For an FIR filter, all a x terms are zero. For an IIR filter, some or all b x terms may be zero. The choice of an FIR design versus an IIR can spark much debate among designers. It is the opinion of the author that new users of digital filters should start out with FIR type filters. This is recommend for the following reasons: $ FIR filters can easily be designed for constant phase delay and/or constant group delay (which affects the distortion of pass band signals with broadband characteristics) $ Stability is inherent and limit cycling is not a problem as it is with IIR designs (This is provided the User implements the filter with nonrecursive techniques). $ Round off errors can be controlled in a straightforward fashion in order to keep their effects insignificant. Elite Engineering Corp Page 4

The drawbacks of using an FIR are: $ An FIR generally requires more stages than an IIR to obtain sharp filter bands. $ Additional stages add to memory requirements and slow processing speed. Designs that demand high performance usually justify an effort to tradeoff FIR vs IIR filter implementations. But for first time application it is recommended that aggressive filter design be avoided until one has the experience to avoid the various pitfalls that await you. Mathematically, the equation representing the general filter in Figure 1 is: m m y i = 3 b n * x n 3 a n * y n Equation #1 n=0 n=1 Where: x 0 = current input value y 0 = current output value m = number of filter stages or taps ( sections) Equation #1 is straightforward to implement in software or even a speadsheet. As an example, an FIR filter (lowpass, high pass or bandpass) would be constructed as follows: 1. Determine how many poles are needed and how much ripple in the pass band is allowed and how much attenuation in the stop band(s) is required. 2. From this information, compute the coefficients necessary. 3. Setup your software as follows: a. Create an array to hold the incoming input values as a sequence of inputs. Create a matching array to hold the coefficients. b. Set up a software mechanism to add incoming input values to the Ax@ array. A circular buffer works well for this purpose. c. Set up a function to multiply the current input array by the matching array of coefficients and to then sum the result. That result is the output of your filter. Elite Engineering Corp Page 5

Whether you are performing realtime processing or off line processing, the process is essentially the same. Using a circular buffer is an important means to saving computational time. Without some sort of circular buffer, you must shift the array of input values on each input or you must shift the coefficients. This shifting can be time consuming and may be time reduced dramatically by a circular buffer technique. Figure 2 shows an example lowpass filter. The filter was designed using the Remez Exchange Algorithm to generate the coefficients (explanation of this algorithm is given the following paragraphs). The input signal to the filter was created by combining two sine waves (one near the edge of the passband and one just outside the pass band). Random noise was added to the sine waves. The noise added is uniform in spectrum and thus a portion of the noise power overlaps the passband signals. Thus the filter output still shows some low frequency components riding on the sine wave. This noise could be further reduced by use of a bandpass configuration as would be appropriate in a strictly analog implementation. Lowpass Filter Example Input Signal To Filter Output Signal From Filter 4 4 2 2 Amplitude 0 Amplitude 0 2 2 4 50 100 150 200 250 300 Sample Count 4 50 100 150 200 250 300 Sample Count Input Signal Composition Filter Characteristics 1 Sinewave at 0.04 Fs (Fs = Sample Frequency) 1 Sinewave at 0.15 Fs Random noise, uniform distribution, (rms amplitude = 1) Passband Ends at = 0.05 Fs Stopband Starts at = 0.15 Fs Stopband Attenuation = 30bD (min) Passband Ripple = 0.1dB (max) 17 Terms or taps It should be apparent at this point that the whole key to these filters is understanding how to generate the coefficients. Implementing the filter itself becomes a small task compared to the Elite Engineering Corp Page 6

mathematics to generate the coefficients. Computing The Coefficients Generating the coefficients for these filters is far and away the toughest part of filter design from a mathematical standpoint. The complexity of generating these coefficients is driven by the criteria for obtaining specific pass band, stop band and ripple requirements. While a number of software programs are available to reduce this process to cookbook level, it is important to understand the principles and processes at work. A general observation of the filter structure shown in Figure 1 should bring to mind the basic convolution process. If one views the filter coefficients as a reverse ordering of the filters impulse response, then it becomes obvious that these filters are simply a discrete embodiment of the convolution of the filters impulse response against the incoming time domain signal. Thus one can view the algorithms for generating the coefficients simply as tools that generate an array of impulse response values whose Fourier Transform represents the desired filter function. A derivation or detailed explanation of the mathematics for the various approaches will not be presented here. The reader is encouraged to review the text in reference [2] for specific detail and description of the mathematics for the described approaches. Three popular basic approaches for coefficient generation are employed by filter designers: the Fourier Series Method, the Frequency Sampling Method, and the Remez Exchange Method. The Fourier Series Method is based upon direct computation of Fourier series coefficients given a selection of the desired start and stop frequencies. These coefficients are computed using the following equation: b n = (1/(2p) I K(f)[ cos(mf) j sin(mf)] df Equation #2 Where: 2p n = index of coefficient being computed f = the frequency currently being computed K(f) = filter gain at frequency f m = n (N1)/2 N = number of filter stages or taps Note that m is setup to compute only half the number of coefficients as there are taps. This is because the coefficients will be symmetric and will generate a symmetrical impulse response. For example, a 10 tap system will have the following arrangement: Elite Engineering Corp Page 7

b 0 = b 9 b 1 = b 8 b 2 = b 7 b 3 = b 6 b 4 = b 5 If an odd number of taps are specified then the system will be symmetric around the center most tap. For an 11 tap system this would mean b 0 = b 10, and b 5 would be the only uniquely assigned value. The basic steps to compute the coefficients, b n, are as follows: 1. Specify the desired filter attenuation at each frequency, i.e. the K(f) coefficients. 2. Specify the number of taps or stages, N. 3. Compute each coefficient per equation #1. Some iteration may be required to determine the appropriate number of taps based upon the resulting filter step response and/or its frequency response (obtained via an FFT or its impulse response). Filters designed using Fourier Series Method tend to have linear phase characteristics. As with almost all filter implementations, the filter will exhibit undershoot and overshoot due to the Gibbs phenomena. This arises due to the finite structure of the digital computations as opposed to a continuous system. The impact of this effect may be reduced by a technique called Awindowing@. This involves multiplying the coefficients by a series of coefficients designed to modify the frequency response in order to adjust for the finite aspect of the transforms taking place. While it is beyond the scope of this article to detail out these functions, it is recommended that the reference material be reviewed for information relating to the various window types: rectangular, triangle, Hanning, and Hamming. The primary tradeoff between each windowing technique is whether or not the application requires smoother frequency response for phase or magnitude. Elite Engineering Corp Page 8

Another technique used to generate coefficients is to utilize a discrete Fourier Transform. In this technique, the designer generates points that represent the desired frequency domain magnitude and phase response desired. The resulting data set is processed via a standard inverse discrete Fourier Transform. This produces impulse response values similar to the Series Method. These values are utilized in the same manner. The primary difference is that the designer must (or can) specify magnitude and phase in this technique. This technique is not recommended for those not familiar with Fourier Transforms and the effects of magnitude and phase point placement on the resulting transform. The choice of point placement can be quite important in this method and is one that can produce significant changes in results from subtle changes on the inputs. The third technique is called the Remez Exchange Method. This algorithm utilizes inputs from the designer for start/stop frequency, allowed passband ripple, and minimum required stop band attenuation. The algorithm then attempts to find an optimal solution of coefficients to meet the given criteria. The mathematics of this algorithm are explained in a reasonably clear fashion in reference [2] and will not be covered here. A number of software packages are available that perform the necessary computations which make this approach attractive as an almost Acookbook@ solution to generation of coefficients. Depending upon the specific implementation of this algorithm, the usual criteria coded into the algorithm produces Chebyshev filter approximations. Additional Functions That Affect The Digital Filter A digital filter is only one part of a system composed of a digitizer (A/D), processing device (e.g. microprocessor) and algorithm. The digitizer has a profound effect on the filtering function via three primary characteristics: quantizing error, sample rate and bandwidth limiting. Quantizing error is simply the number of bits the A/D uses for quantization. Determining the required number of bits is usually governed by the system resolution requirements (i.e. a 2.4mV change in the signal is required to be detectable). With regard to the digital filter, it is difficult to remove quantization noise without undue effort or a priori and fixed frequency characteristics of the signal and noise. Thus quantization size must be chosen to be compatible with the desired filter output SNR. The sample rate of the A/D is a key parameter for a digital filter. The basis of setting the coefficients for almost all digital filters is an assumption of the sample rate. Changing the sample rate will directly scale the coefficients. A filter you thought filtered at 60Hz will not do so if the sample rate changes. This is a one to one relationship. Thus, you can determine the effects of varying sample rate by the ratio of change from the design specification frequency Elite Engineering Corp Page 9

to the actual rate. The resulting filter frequency is scaled by the same ratio. Jitter or short term variation of the sample frequency can create very undesirable effects on the filter performance. Simply think of it as the filter breakpoint frequencies shifting around in real time. This can be a significant problem for narrowband or sharp cutoff filters where the signal of interest lies very close if not within these filter bands. The antialias filter is perhaps the most crucial addition to the input of the A/D and to the digital filter. Without an analog filter to perform this function, high frequency interference can show up in the digitized data as a low frequency signal. Those familiar with sampling theory will know this as frequency folding or aliasing. Once aliasing occurs, it is very difficult if not impossible to remove the high frequency components that folded back into the sampled bandwidth. By adding an analog filter that limits the A/D input bandwidth to one half the sample rate, aliasing can be reduced or prevented. Most applications use a simple analog RC filter to perform this function. The reader should be aware that this filter does not roll off very quickly and thus large amplitude interference above the cutoff frequency can and will still enter the system and be folded back into the sampling bandwidth. Higher order analog filters are still required where this situation is possible to occur. The processor chosen for the task plays an important role in a number of ways. The most obvious is the processor=s math function capabilities. Digital filters inherently are composed of repetitive multiplication and addition operations. More over, round off errors can accumulate quickly. Hence, most software applications utilize floating point variables to reduce round off error accumulation (some require double precision for high accuracy applications). Floating point multiplication s generally consume large quantities of processor time unless a math coprocessor is present. This can prevent the processor from performing realtime processing if it interferes with maintaining a uniform sample rate. Thus processor speed and capability are important parameters in the implementation of a digital filter. Summary Digital filters can be a valuable tool in an engineer=s tool box. Properly applied, SNR improvements can be achieved that surpass those attained by analog techniques. Yet one can not simply throw a digital solution in place without understanding the underlying principles and concepts. Thus if digital engineers are to utilize these techniques, they had better be prepared to become versed in the mathematics that used to be reserved for analog engineers. As a courtesy to those readers interested, a Acookbook@ software package to compute filter Elite Engineering Corp Page 10

coefficients using the Remez Exchange Algorithm is available, free of charge from the author. References [1] Digital Filter Designers Handbook, C. Britton Rorabaugh, McGraw Hill, 1993 [2] C Language Algorithms For Digital Signal Processing, Paul Embree, Bruce Kimble, Prentice Hall, 1991 Elite Engineering Corp Page 11