moving_average takes two arguments: an array A of numeric values representing the sampled signal and a positive integer n. It returns an array B obtained by applying a moving average filter of length n to A. The elements of B are defined by
B[i]= |
|
| A[i+j] |
for i=0,1,…,L−n, where L is the length of A.
Moving average filters are fast and useful for smoothing time-encoded signals. For example, input :
Output :
Input :
Output :