The basics of DSP for use in intelligent sensor applications: Part 2

Creed Huddleston

July 6, 2010

Creed Huddleston

Digital Filter Implementations
To this point, our exploration of filters has been strictly along conceptual lines; we turn now to the actual mathematical implementation of these filters.

In general, digital filters are created by applying weighting factors to one or more values of the sampled data and then summing the weighted values. For instance, if we have a sampled input signal xi for i = 0, 1, …, N – 1, we can generate a filtered output yi that is given by:

where the ai terms are constant weighting values that are applied to the corresponding xi sampled input signal value. An example of a low-pass filter is an averaging filter, whose output is simply the average of a given number of samples.

This smooths out the signal because noise is averaged over the entire group of samples. If we choose to average four samples to get our filtered output, the corresponding equation would be:

By adjusting the weights of the individual taps of the filter (the sampled data values), we can adjust the filter’s response. To make things easier for designers, a number of companies make digital filter design and analysis software, and free versions are available on the Internet as well.

The preceding example illustrates what is known as a finite impulse response or FIR filter structure. Filters constructed using this approach always have a fixed number of taps, and thus their output response depends only upon a limited number of input samples.

If we pass the impulse signal through a filter of length N taps, we know that the filter’s output to the input will die out after N samples, since all subsequent input values will be zero.

Another filter structure is the infinite impulse response or IIR filter. IIR filters use both weighted input signal samples and weighted output signal samples to create the final output signal:

where the bi terms are constant weighting terms that are applied to the corresponding yi-1 terms.

At first glance, it would appear that we’ve made the filter much more complex, but that’s not necessarily the case. Looking at the four-tap averaging filter that we examined for the FIR filter, we could implement the same function as:

While reducing the computational requirements by a single tap may not seem particularly important, more complicated filters can see a significant reduction in computational and memory requirements using an IIR implementation.

This reduction comes at a cost, however; unlike FIR filters, IIR filters can theoretically respond to inputs forever (hence the name of the structure), which may not be at all desirable. Designers also have to be careful to ensure that errors don’t accumulate or else performance can degrade to the point where the filter is unusable.

Median Filters
All of the filters that we’ve discussed so far are based on simple mathematical equations, so their behavior is easily analyzed using well-known and well-understood techniques.

These filters tend to work best with noise that is contained to specific spectra, which is often an appropriate design model. Sometimes, however, systems are susceptible to what is called shot or burst noise, in which the measured signal has bursts of noise rather than a continuous noise signal.

To counteract this, systems may employ another form of filtering known as median filtering that is somewhat more heuristic but does an excellent job of reducing shot noise.

In a median filter, the signal is sampled as in the other forms of filtering, but rather than performing a simple mathematical operation on the samples, the samples are ordered highest to lowest (or vice versa, it doesn’t really matter which), and then the middle or median sample is selected.

Figure 2.15a. Sample “True” Signal

If the length of the median filter is greater than the length of the noise burst, the noisy signals should be completely eliminated. An example of a length-7 median filter and its effect upon a signal corrupted with shot noise whose burst is a maximum of three samples is shown in Figures 2.15a above, as well as in Figure 2.15b, Figure 2.15c and Figure 2.15d.

To read Part 1 in this series, go to “Foundational DSP Concepts for Sensors”
Next in Part 3: The effect of digitization on the sampled signal.

Creed Huddleston is President of Real-Time by Design, LLC, specializing in the design of intelligent sensors, located in Raleigh-Durham, North Carolina.

This series of articles is based on material from ”Intelligent Sensor Design” by Creed Huddleston, used with permission from Newnes, a division of Elsevier. Copyright 2007. For more information about this title and other similar books, please visit www.elsevierdirect.com.

< Previous
Page 4 of 4
Next >

Loading comments...

Most Commented

  • Currently no items

Parts Search Datasheets.com

KNOWLEDGE CENTER