The Filter Wizard issue 34: How linear phase filters can still cause phase distortion Kendall Castor-Perry

Similar documents
The Filter Wizard issue 35: Turn linear phase into truly linear phase Kendall Castor-Perry

In this column, the Filter Wizard discusses a practical application of the time realignment filtering technique described in an earlier article.

The Filter Wizard issue 13: Buenos Notches! The Filter Wizard versus the vuvuzela Kendall Castor-Perry

Yet More On Decoupling, Part 2: ring the changes, change the rings Kendall Castor-Perry

Experiment 2 Effects of Filtering

System Identification and CDMA Communication

The Filter Wizard issue 21: A Fast-Settling Bias Voltage Filter with High Ripple Rejection Kendall Castor-Perry

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

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

The Fundamentals of Mixed Signal Testing

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

EE 422G - Signals and Systems Laboratory

Signal Processing for Digitizers

EECE 301 Signals & Systems Prof. Mark Fowler

The Filter Wizard issue 36: AC Voltage gain using just resistors and capacitors? Kendall Castor-Perry

Experiment 4- Finite Impulse Response Filters

A Finite Impulse Response (FIR) Filtering Technique for Enhancement of Electroencephalographic (EEG) Signal

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

4. Design of Discrete-Time Filters

9 Feedback and Control

Some key functions implemented in the transmitter are modulation, filtering, encoding, and signal transmitting (to be elaborated)

DISCRETE DIFFERENTIAL AMPLIFIER

REFLECTIONS AND STANDING WAVE RATIO

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

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

ZERO LAG DATA SMOOTHERS By John Ehlers

Communication Engineering Prof. Surendra Prasad Department of Electrical Engineering Indian Institute of Technology, Delhi

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

College of information Technology Department of Information Networks Telecommunication & Networking I Chapter DATA AND SIGNALS 1 من 42

The Filter Wizard issue 22: Active filters that still work even when their amplifiers don t Kendall Castor-Perry

Lab 3-mod: Diode Circuits

Lecture 3, Multirate Signal Processing

Lab 8: Frequency Response and Filtering

Digital Filters FIR and IIR Systems

Part One. Efficient Digital Filters COPYRIGHTED MATERIAL

Advanced electromagnetism and electromagnetic induction

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

ESE531 Spring University of Pennsylvania Department of Electrical and System Engineering Digital Signal Processing

Piecewise Linear Circuits

Fourier Transform. Any signal can be expressed as a linear combination of a bunch of sine gratings of different frequency Amplitude Phase

Question 1 Draw a block diagram to illustrate how the data was acquired. Be sure to include important parameter values

Linear Systems. Claudia Feregrino-Uribe & Alicia Morales-Reyes Original material: Rene Cumplido. Autumn 2015, CCC-INAOE

Excuse Me Sir, Will That Be One Millisecond Or Two??

EFFECT OF INTEGRATION ERROR ON PARTIAL DISCHARGE MEASUREMENTS ON CAST RESIN TRANSFORMERS. C. Ceretta, R. Gobbo, G. Pesavento

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

Department of Electronic Engineering NED University of Engineering & Technology. LABORATORY WORKBOOK For the Course SIGNALS & SYSTEMS (TC-202)

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

DAPL IIR Filter Module Manual

Reducing comb filtering on different musical instruments using time delay estimation

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

The Discrete Fourier Transform. Claudia Feregrino-Uribe, Alicia Morales-Reyes Original material: Dr. René Cumplido

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

ME scope Application Note 02 Waveform Integration & Differentiation

Filter Banks I. Prof. Dr. Gerald Schuller. Fraunhofer IDMT & Ilmenau University of Technology Ilmenau, Germany. Fraunhofer IDMT

EXPERIMENTAL RESULTS FOR PCM/FM, TIER 1 SOQPSK, AND TIER II MULTI-H CPM WITH CMA EQUALIZATION

EEO 401 Digital Signal Processing Prof. Mark Fowler

Objectives. Abstract. This PRO Lesson will examine the Fast Fourier Transformation (FFT) as follows:

EEE508 GÜÇ SİSTEMLERİNDE SİNYAL İŞLEME

Structure of Speech. Physical acoustics Time-domain representation Frequency domain representation Sound shaping

The Stop Worrying Today Course. Week 5: The Paralyzing Worry of What Others May Think or Say

Neurophysiology. The action potential. Why should we care? AP is the elemental until of nervous system communication

Pre- and Post Ringing Of Impulse Response

Design of FIR Filters

Time Series/Data Processing and Analysis (MATH 587/GEOP 505)

This article is an excerpt from MPC Samples new ebook release, Conquering EQ, by Eddie Bazil.

ECEN 325 Lab 5: Operational Amplifiers Part III

PROBLEM SET 6. Note: This version is preliminary in that it does not yet have instructions for uploading the MATLAB problems.

MITOCW MITRES_6-007S11lec18_300k.mp4

St. Marks Arrays. <coeff sets 1 & 2, excel doc w/ steering values, array program, > 1. System Setup Wiring & Connection diagram...

Physics 262. Lab #1: Lock-In Amplifier. John Yamrick

Operational Amplifiers

Digital Filters - A Basic Primer

Notes on Fourier transforms

R10. {r5} R8 {r4} C3. {c} vminus. vplus LT1057. vplus {R} vplus LT1057 {R} LT1057. R7 {rd4} {c}

Validation & Analysis of Complex Serial Bus Link Models

Digital Filtering: Realization

Last Lecture. photomatix.com

Laboratory 1: Uncertainty Analysis

EE 233 Circuit Theory Lab 3: First-Order Filters

Experiment 2: Electronic Enhancement of S/N and Boxcar Filtering

SAR AUTOFOCUS AND PHASE CORRECTION TECHNIQUES

Figure AC circuit to be analyzed.

A.C. FILTER NETWORKS. Learning Objectives

Specifying A D and D A Converters

Flatten DAC frequency response EQUALIZING TECHNIQUES CAN COPE WITH THE NONFLAT FREQUENCY RESPONSE OF A DAC.

F I R Filter (Finite Impulse Response)

note application Measurement of Frequency Stability and Phase Noise by David Owen

STAB22 section 2.4. Figure 2: Data set 2. Figure 1: Data set 1

Electrical Engineer. Lab2. Dr. Lars Hansen

Last Lecture. photomatix.com

DSP First Lab 08: Frequency Response: Bandpass and Nulling Filters

Copyright S. K. Mitra

Extra Class License Manual Supplemental Information and Errata

Lab S-5: DLTI GUI and Nulling Filters. Please read through the information below prior to attending your lab.

E Final Exam Solutions page 1/ gain / db Imaginary Part

Digital Signal Processing 2/ Advanced Digital Signal Processing Lecture 11, Complex Signals and Filters, Hilbert Transform Gerald Schuller, TU Ilmenau

MESA 1. INTRODUCTION

MUS421/EE367B Applications Lecture 9C: Time Scale Modification (TSM) and Frequency Scaling/Shifting

Predictive Indicators for Effective Trading Strategies By John Ehlers

A NOTE ON DFT FILTERS: CYCLE EXTRACTION AND GIBBS EFFECT CONSIDERATIONS

Transcription:

The Filter Wizard issue 34: How linear phase filters can still cause phase distortion Kendall Castor-Perry This week the Filter Wizard looks at cases where linear phase response doesn t give you quite the behaviour you might have expected, and where under-filtering can actually be worse than either heavy filtering or no filtering at all. People often ask me to talk about the waveform distortion that can be introduced by filtering. Each time I sit down to write a Filter Wizard piece on this topic, I either get overwhelmed by the amount of writing effort needed to encapsulate it at reasonable length, or I get sidetracked by an interesting nugget found lurking, metaphorically speaking, behind the cushions of the sofa (the couch, to y all in North America). So, this column covers just the latest nugget, not the essay on what happens to signals when you pass them through filters. For the moment, on the matter of filters and waveform distortion in general, I ll just leave it at well, what did you expect? Filters inevitably change the phase and amplitude balance of frequency components in a signal. We saw in my recent waveform synthesis articles that this must surely hurt the shape of the signal. To use filters effectively while not affecting the information in your signal, the trick to quote Peter O Toole in Lawrence of Arabia,...William Potter, is not minding that it hurts. One day I ll find the time to talk at length about this. For now, back to that nugget. I m sure many of you will have had an encounter with an FIR filter, either practical or theoretical. It s widely written that FIR filters with symmetrical impulse responses are valuable because they delay all frequency components in the input signal by the same time value, and preserve phase relationships whether or not they change the amplitude of some of those components. This is partly true, but there s an ugly little catch that rarely gets discussed. So let s discuss it now. As well as giving you coefficients for many kinds of useful digital filters that will run on the Digital Filter Block inside PSoC 3 and PSoC 5, the most recent version of the Filter component in Cypress s PSoC Creator design environment is a fascinating what-if tool for checking out the behaviour of filters. In particular, you can plot the phase response of a filter, either wrapped so that it fits into the range of -pi to +pi radians (or -180 to +180 degrees if you want to go all Babylonian on me) or unwrapped so that the derivative of the curve is smooth, reflecting the generally smooth nature of the group delay of a realizable filter circuit. Except, even when you choose the unwrapped presentation, sometimes you still get these jaggies in the phase response plot in the customizer graphs. At a training session, an attendee asked me if these were caused by errors in the algorithms used to create the curves. It s never good when a customer finds a fault in your product before you do, but fortunately in this case, I was able to explain, at least partly, why they were really there. Boy, you do need to be quick on your feet in these sessions, though.

Look at figure 1. It shows the magnitude, unwrapped phase and group delay of a pretty normal kind of lowpass FIR filter. It s a 15 tap filter with a -6 db point at 0.15 times the sample rate, using a Hamming window. Now, we don t cheat in the software just because we know that it s a symmetrical FIR filter; the group delay really is calculated point by point. You can see that it s constant, and this might lead you to infer that the phase shift should be proportional to frequency. But the phase plot tells a different story; every time the frequency passes through one of the stopband zeroes, the phase response jumps up by pi radians. The phase response is made up of a number of straight line segments; all have a constant slope, but the phase is definitely not proportional to frequency in the stopband segments. This is a real effect, not a consequence of sloppy programming. However, I must admit that the presentation isn t perfect, and I ll explain what the unwrapped graph should perhaps look like later. Figure 1: An example FIR filter, showing phase response jaggies. Now, the problem is that pi radians represents an inversion of the signal passing through the filter. If you take away the phase shift corresponding to the static time delay of (in this case) seven samples, you ll see that as you move into the stopband, the filter s signal polarity flips abruptly between non-inverting and inverting as you pass through each of the null frequencies. To be honest, when we plot this kind of behaviour on an unwrapped presentation, we should really see the phase response jump up by pi radians and then jump back to where it would have been. The trouble is, we can t say where it would have been without referring to prior values on the plot. The current plotting routines don t look back ; at the time we defined the plotting routines, I wasn t sure that forcing a particular interpretation of the data was the right way to go. But I might get it changed in a future version. Anyway, mea culpas aside, this phase behaviour is sometimes pointed out in

textbooks, but the usual line of reasoning is: Why bother about this? The signal level is so low in the stopband that we really don t care if that tiny residual comes out upside down or not. But here s the next factor to consider: sometimes that stopband rejection might not be so high. Consider the common box-car averaging filter, which is nothing other than a FIR filter all of whose coefficients are the same. It s rather generous to refer to those regions between the nulls as stopbands at all, since they hardly stop those frequencies, but merely hinder them a little. Figure 2 shows a response plots for a seven sample averager. Figure 2: Amplitude, phase and group delay plots for a seven sample averager. Averaging filters are often used to smooth data sets to suppress random noise and reveal underlying trends in the data. They are commonly used in the financial world, for instance. A seven sample moving averager can be applied to daily data to remove both noise and weekly fluctuations in, say, a commodity price. This filter will have nulls at 0.1428 price wobbles per day and its multiples (in other words, once every 3.5 days, once every 1.75 days, and so on). But let s suppose that this price has a consumption-driven pattern with a periodicity of six days, for some reason. Expressed as a frequency, this is 0.1666 price wobbles per day. We can see from figure 2 that this frequency lies in a jumped up region, and yet the magnitude of the response is only about 13 db down. Building up a spreadsheet to analyze the output of such a process is easy. Figure 3 shows the six day fluctuation on a daily scale (the higher-amplitude trace) and the output of the seven day averager. It confirms the hypothesis: in the filtered data, the six day trend is inverted. If you don t take that into account when reading the smoothed data, you will totally misinterpret any underlying causality in the six day cycle.

Figure 3: A six day fluctuation, and the seven day moving averager s response. The thing that misleads us so often with these frequency response plots is that we conventionally plot only the magnitude of the response, whether expressed in linear or db form. Now, the frequency response is nothing other than the Fourier transform of the time response, and if we plot the amplitude of the Fourier transform of one of these offending filters, we find that it goes negative in these regions, as seen in figure 4. Figure 4: The FFT of a seven sample averager goes negative.

That makes sense, when you think about it; an amplifier with a negative gain is an inverting amplifier, and those little bits of rogue stopband are no different they are regions within which the filter is inverting. Such processing can cause problems with electrical signals too. The problem is at its worst for very simple filters that don t have high attenuation in the regions where the phase is wrong. It can particularly be a problem with some simple FIR notch filters, as well as the boxcar averager. It s particularly significant when the shape of a waveform is subjectively evaluated for clues as to what processes are occurring. Interpretation of signals acquired from physiological activity can be affected by the changes wrought by filtering. Figure 5 shows a synthesized neural potential signal (the one that peaks first), and the somewhat different responses through a normal seven sample averager, with a width of 1.43 ms (the darkest, slowest trace), and the same filter but with the phase jump synthetically removed so that all components stay in phase. The difference is subtle but significant for nerve conduction experiments. 30V V(inv) V(noninv) V(del) 25V 20V 15V 10V 5V 0V -5V -10V -15V -20V 0ms 1ms 2ms 3ms 4ms 5ms 6ms 7ms Figure 5: Stopband phase shift from an averager does affect the signal. The moral of this part of the story is that under-filtering, either through laziness, lack of processing power or a desire to have minimal impact on the signal, may be a misplaced belief. You should use either a filter whose stopbands are deep enough that your signal can t be corrupted by unexpected phase jumps in stopband signals, or a filter that doesn t have those phase jumps in the first place. Can we make those phase jumps go away by design? We ll see next time. Meanwhile, keep an eye out for that FIRry phase flipping! best / Kendall