I know this is a rather common and a rather simple problem, but somehow I can't find a solution that is equally simple to understand (and implement).
I have a signal that closely resembles a noisy sine wave (sample signal graph below). What I actually need for the practical problem I'm solving is to find the phase of that signal, more specifically - one of the extremum points for each period. I want to know at which sample the new period starts, either from the min or from the max point (doesn't matter which as long as I know which one it is). A real-time solution is preferable (i. e. with as little a delay as possible).
What are good general approaches to this problem? Do I need to find the fundamental frequency? If I do, I have found two algorithms for that: DFT/FFT (overkill because I only need the base frequency), and auto-correlation which would be my choice. Is there any simpler way than auto-correlation?
Of course, if there is a more direct way to get the "starting" point of each period, that would be even better.
Thanks in advance.
P. S. The naive solution I see as an engineer with no training in DSP is to apply a smoothing (low-pass) filter to the signal and calculate something resembling a derivative - s(t) - s(t-1)
. Where this value changes sign is an extremum - but only with sufficient filtering and sufficiently stable signal. This approach does not seem robust.