DSP Tricks: Smoothing impulsive noise - Embedded.com

DSP Tricks: Smoothing impulsive noise

In many electronic systems designs we may be required to make precisemeasurements in the presence of high noise or interference. Withoutsome sort of analog signal conditioning, or digital signal processing,it can be difficult to obtain stable and repeatable, measurements.

This impulsive-noise smoothing trick, originally developed to detectmicroampere changes in milliampere signals, describes a smoothingalgorithm that improves the stability of precision measurements in thepresence of impulsive noise.

Practical noise reduction methods often involve multiple-sampleaveraging (block averaging) of a sequence of measured values, x(n) , to compute a sequence ofN-sample arithmetic means, M(q) .As such, the block averaged sequence M(q) is defined by:

where the time index of the averaging process is q = 0, 1, 2, 3, etc. When N = 10for example, for the first block of data (q = 0), time samples x(0) through x(9) are averaged to compute M(0). For the second block of data (q = 1), time samples x(10) through x(19) are averaged to compute M(1) , and so on.

The following impulsive-noise smoothing algorithm processes a blockof time-domain samples, obtained through periodic sampling, and thenumber of samples, N, may be varied according to individual needs andprocessing resources.

The processing of a single block of N time samples proceeds asfollows: collect N+2 samples of x(n) ,discard the maximum (most positive) and minimum (most negative) samplesto obtain an N-sample block of data, and compute the arithmetic mean, M(q) , of the N samples. Each samplein the block is then compared to the mean.

The direction of each sample relative to the mean (greater than, orless than) is accumulated, as well as the cumulative magnitude of thedeviation of the samples in one direction (which, by definition of themean, equals that of the other direction). This data is used to computea correction term that is added to the mean according to the followingformula:

where A(q) is thecorrected mean, M(q) is thearithmetic mean (average) from Eq. (13-123), Pos is the number ofsamples greater than M(q), and Neg is the number of samples less thanM(q), and Dtotal is the sum of deviations from the mean (absolutevalues and one direction only). Dtotal, then, is the sum of thedifferences between the Pos samples and M(q).

For an example, consider a system acquiring 10 measured samples of10, 10, 11, 9, 10, 10, 13, 10, 10, and 10. The mean is M = 10.3, the total number ofsamples positive is Pos = 2, and the total number of samplesnegative is Neg = 8 (so Pos”Neg = “6).

The total deviation in either direction from the mean is 3.4 [usingthe eight samples less than the mean, (10.3″10) times 7 plus (10.3″9);or using the two samples greater than the mean, (13″10.3) plus(11″10.3)]. With D total = 3.4, Eq. (13-124) yields animproved result of A = 10.096.

The smoothing algorithm's performance, relative to traditional blockaveraging, can be illustrated by example. Figure 13-71(a) below shows ameasured 300-sample x(n) signal sequence comprising a step signal of amplitude one contaminatedwith random noise (with a variance of 0.1) and two largeimpulsive-noise spike samples.

Figure13-71. Noise smoothing for N = 10: (a) input x(n) signal; (b) blockaverage output (white) and impulsive-noise smoothing algorithm output(solid).

A few meaningful issues regarding this noise smoothing process are:

1) The block size (N) usedin the smoothing algorithm can be any integer, but for real-time fixedbinary-point implementations it's beneficial to set N equal to aninteger power of two.

In that case the compute-intensive division operations in Eq.(13-123) and Eq. (13-124) can be accomplished by binary arithmeticright shifts to reduce the computational workload.

2) If there's a possibilitythat more than two large noise spikes are contained in a block of inputsamples, then we collect more than N+2 samples of x(n) and discardthe appropriate number of maximum and minimum samples to eliminate thelarge impulsive noise samples.

3) We could forego the Eq.(13-124) processing and merely perform Eq. (13-123) to compute the meanM(q). In that case, for agiven N, the standard deviation of M(q) would be roughly 15-20% greater than A(q) .

Usedwith the permission of the publisher, Prentice Hall, this on-goingseries of articles on Embedded.com is based on copyrighted materialfrom “UnderstandingDigital Signal Processing, Second Edition” by Richard G. Lyons. Thebook can be purchased on line.

Richard Lyons is a consultingsystems engineer and lecturer with Besser Associates. As alecturer with Besser and an instructor for the University of CaliforniaSanta Cruz Extension, Lyons has delivered digitasl signal processingseminars and training course at technical conferences as well atcompanies such as Motorola, Freescale, Lockheed Martin, TexasInstruments, Conexant, Northrop Grumman, Lucent, Nokia, Qualcomm,Honeywell, National Semiconductor, General Dynamics and Infinion.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.