I have a (rough) known period sine wave coming in, held in an array, with superimposed noise. I need to find and count the maxima and minima (in C). Any suggestions or algorithms? The signal has already been received and buffered, so not real time.
If you have the entire signal, you can then run a Lowess smoothing. This algorithm is statistically robust and provides locally acceptable smoothing. Outliers will be tolerated as well. After smoothing your signal in that way, you might apply a derivative based (or even derivative free) peak detection in order to obtain the signal peaks. These will be your local minima/maxima.
You could use MATLAB or R and port smoothing algorithms to C, they are pretty straightforward and open source:
And here are your options in C:
1) https://code.google.com/p/variationtoolkit/ for Lowess/Loess. 2) For peak detection, there are many tools available in C, one of them being: