optic.dsp.core.movingAverage

movingAverage(x, N)

Calculate the sliding window moving average of a 2D NumPy array along each column.

Parameters:
  • x (np.array) – Input 2D array with shape (M, N), where M is the number of samples and N is the number of columns.

  • N (int) – Size of the sliding window.

Returns:

2D array containing the sliding window moving averages along each column.

Return type:

np.array

Notes

The function pads the signal with zeros at both ends to compensate for the lag between the output of the moving average and the original signal.