|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Data Smoothing
Here is a bit of code to use the Exponential moving average (EMA) function for data smoothing. I find it much superior to that of a straight average because it favors newer samples, making it more responsive. Also it requires one to save only one value between calculations.
To use, call the EMAweight function with the number of samples that you want to smoothing over, it will calculate a weight factor for the EMA function. call EMA with the oldvalue, newsample and the weight here is a reference for EMA: http://www.esignal.com/futuresource/...tudies/emi.htm Quote:
|
|
#2
|
||||
|
||||
|
Re: Data Smoothing
Nice. We've stuck with arithmetic moving averages in the past since they are fast and can be implemented in pure integer math, but it's nice to see someone using this and posting sample code.
|
|
#3
|
|||
|
|||
|
Re: Data Smoothing
You can use this with integer math with changes to the math lib.... or use scaling on the weight ratio and final EMA
|
|
#4
|
|||||
|
|||||
|
Re: Data Smoothing
Second (and higher) order IIR low pass filters have responses similar to this one.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Historical data | Andrew Schuetze | General Forum | 0 | 15-05-2006 07:42 |
| Data Communication | coreyk | IT / Communications | 4 | 02-05-2005 19:09 |
| Team Data | Katy | Scouting | 3 | 02-04-2003 15:17 |
| Match Data | Jack | Scouting | 0 | 08-03-2003 16:49 |