mavg function

Smoothing by moving average