Calculating moving average in C++
问题 I am trying to calculate the moving average of a signal. The signal value ( a double ) is updated at random times. I am looking for an efficient way to calculate it's time weighted average over a time window, in real time. I could do it my self, but it is more challenging than I thought. Most of the resources I've found over the internet are calculating moving average of periodical signal, but mine updates at random time. Does anyone know good resources for that ? Thanks 回答1: The trick is the