On Tue, 9 May 2000, Robert A. LaBudde wrote: > At 12:24 PM 5/9/00 -0400, Andy wrote: > >I think what you want is a median filter. Take multiple samples, sort them, > >then pick the one in the middle of the list. Your spurious readings are > >extrema, right? > > A more efficient, but just as stable, filter is a 10% or 20% trimmed mean: > > E.g., collect a set of fixed size (e.g., 6-10), drop the high and low > result and average the remainder. With a set of size 8-10, you could also > drop the next highest and next lowest measurements. > > The effective loss of information is only about 1/2 the number of points > dropped. > > Obviously filtering of this type will cut the bandwidth by an equivalent > amount. Here's an implementation that I put on my web page for Bob Blick: http://www.dattalo.com/technical/software/pic/medfilt.html It does the sorting, median filtering, and averaging. It works with 12-bit data samples and conserves memory by packing two samples into three bytes. Scott