Wow, this is an IDEAL application for any type of median filter, and I am not surprised that an averaging filter flunked. Folks, try this mental test of averages versus medians: What is the average income for this year of all people who have written papers on sorting algorithm? Answer: Several hundred million dollars. What is the MEDIAN income of the same group? Answer: several thousands of dollars. Hint: Most of the group consists of graduate students, but the group also includes Bill Gates. Good luck, and let us know what you come up with finally! Lawrence ----- Original Message ----- From: "Andy Shaw" To: Sent: Monday, April 29, 2002 4:46 PM Subject: Re: [PIC]: Space efficient moving/rolling median filter > Hi Lawrence/Folks, > Thanks for the input. I think you are correct if you can either increase the > sample rate or lower the rate at which you need results then things get a > lot simpler! > > Just a bit more background. The input data stream comes from a radio control > receiver each channel gets an approx 2ms long pulse every 20ms or so. I > can't really change the sample rate since this is fixed by the receiver. I > can drop the rate at which I need to actually get a result but not by too > much otherwise the response to stick movement gets notchy. > > I'm using the pic to read several channels and control a number of electric > motors. I get two types of noise in the system when the transmitter is moved > a distance from the receiver. The first type is a jitter on the pulse train > that is normally about 5% or so (and I think some of this may come from all > of the electronic gear on my bench it seems worse here then in the field). > The second is an occasional much bigger spike that basically comes from some > of the drive motors. I can get rid of some of this stuff by conditioning the > power supply adding suppression to the motors etc. However the unit is going > to be used by other people not just me and unfortunately for many R/C > modellers all of this stuff is black magic and they tend not to be quite so > thorough about this kind of thing. So I'm trying to make the basic unit as > robust against noise as I can. One unfortunate side effect of this is that > if the spike is incorrectly interpreted as good data, it can cause a big > swing in one or more drive motors which can cause a spike which...... Well > you see what may happen. > > Anyway I've modelled the data and a median filter seems to do a good job of > cleaning things up (much better than the various average type of filters). I > was just hoping that it would be possible to get a low memory fast output > routine. Still I guess you can't have everything! If anyone has any other > suggestions on cleaning up this kind of signal then let me know. > > Once again thanks everyone for the comments > > Andy > > ----- Original Message ----- > From: "Lawrence Lile" > To: > Sent: Monday, April 29, 2002 3:27 PM > Subject: Re: [PIC]: Space efficient moving/rolling median filter > > > > Is there any advantage to keeping the old readings in a FIFO median > scheme? > > In the flush-em-all scheme, you never have any data older than N readings, > > and median readings are updated every N readings. In a FIFO median > scheme, > > you never have any data older then N readings, but you get a median > redaing > > on every single sample. This seems better on the face, because you are > > updating your median number faster. But why do you take a median in the > > first place? Because you *don't* want the result to change too fast, > > Because you are trying to find a stable result! So the FIFO mmedian > scheme > > actually works against the purposes of readiong medians in the first > place! > > > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.