matlab - Octave time series Moving average - Stack Overflow : Image credit: GNU Ovtave t = ( 0 :. 001 : 1 ) '; %#' vector = sin ( 2 * pi * t ) + 0.2 * randn ( size ( t )); %# time series wndw = 10 ; %# sliding window size output1 = filter ( ones ( wndw , 1 )/ wndw , 1 , vector ); %# moving average