WizenedEE:
ardnut:
and more to the point what is supposed to be the use of running median??
here is an plot of the frequency response of the ever popular data distorter called running-mean and that of a clean filter : gaussian.
http://oi41.tinypic.com/nevxon.jpg
Here is the the result of those two filters on the same data (though you would not know it)
http://i44.tinypic.com/351v6a1.png
Now what the result of the running median is or what the hell use it is I can't imagine.
RUNNING MEAN MUST DIE.
You seem to be using mean and median interchangeably. Also, those pictures don't make any sense.
I've used a running median to filter out bad data while using one of those RC transmitters that outputs a servo pulse.
No, your are simply not reading what I wrote.
I showed the distortion produced by running mean , then stated that I did not know what the effect of running median would be.
It will not even be definable in such terms because it is determined by order and not magnitude. In short it will be an awful filter of unstable and unpredictable qualities. That's probably why no one has ever heard of it !
I've used a running median to filter out bad data while using one of those RC transmitters that outputs a servo pulse.
Well, you could use a median to eliminate glitches but what running-median would do to the rest of the data is anyone's guess.
If you can read the frequency filter I posted for running mean you will realise how bad it is as a filter with all those huge stop band lobes letting what you thought you filtered out get through.
The other plot shows you how running mean can distort peaks left and right , even invert them, depending on how the variations compare to width of the running mean window. Running median will be all of that plus other non predictable distortions that will likely be as big or bigger.
Sure the results are "smoother" . Don't confuse that with thinking you have correctly filtered you data.
Most people use R-Mean through ignorance. A few know the problems but ignore them because it's easy to calculate.
That is why I say RUNNING MEAN MUST DIE.
Once I get up to speed on programming Ard' I will post a code example for a proper filter like gaussian that does something like what most people imagine running mean does.
For you RC example, if you have known glitches in the data it may be better to eliminate them directly then filter the remaining data.
Gaussian and binomial filters are efficient and calculated just like a weighted running mean. You pre-calculate a weight for each point in the window in setup(). Since Ard' has fast on chip multiplier this will probably be quicker that the sorting algo for median.