Smooth Series Data
I need to smooth this plot better, I already used a moving average (10 points) to get this plot, but it is not perfect yet. I want to remove all those small peaks that are drowned out by noise, I only need to consider the larger ones because I am calculating the number of hits from the sensor. (i.e .: in the first 30 seconds I should have only one peak instead of several successive small peaks)
I was thinking to use a cubic spline but not easy to implement in C and it will take almost 1-2 weeks of work.
Is there an easier method / algorithm to achieve this? I am working on this project for iOS (iPhone).
busy cat http://img15.imageshack.us/img15/1929/schermata022455973alle1o.png
source to share
The answer to your question depends a lot on the underlying data. Is the jagged data really "noise" or is it really jagged data.
Strategies you could try:
- end the data and take the mean / average in each window - so each window is 50 (off your x-axis)
- sample data
- A non-linear least squares curve is fine (you probably have to use a C ++ library for this, here is the open source version, you can port http://www.ics.forth.gr/~lourakis/levmar/ )
- Some kind of naive bezier anti-aliasing should be pretty simple.
All of these methods have ramifications and none of them have problems. Good luck.
source to share