I am working on a project which, at some point, relies on the computation of the average of discrete signals, which typically look like this:
The project generates hundreds of such signals, and:
- the signals are generated "on-the-fly", meaning I can monitor the signal while it's being produced, and stop it once I have obtained an accurate estimate of the average value of the periodic part (the sooner being the better)
- the duration of the transient part is unknown
- the amplitudes can vary a lot
- I have no control on the final frequency of the signal
- I have no control on the sampling ratio, however it is assumed to be high enough
- on rare occasions, the periodic part can degenerate into a constant signal
My question is the following: is there a proper way (involving fourier transform, moving averages, moving averages of moving averages...) to automatically determine the average value of the periodic part of each signal ?
I came up with something weird that involves computing a moving average of moving average, then computing the derivative of the latter, and waiting until its amplitude becomes close enough to zero. Although it seems to provide decent results, it really sounds weird, and it requires a large amount of samples to provide a decent estimate of the average.
Thanks in advance
Testing the solution of @Dan Boschen, chaining multiple exponential moving averages works like a charm (here 3 EMA, each with alpha = 0.01):