!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! Subroutine for smoothing of a time-series data ....... !!! !!! Input to the subroutine is 1-d array and output is also the same !!! !!! Input: !!! !!! x = one dimensional array; x(n) !!! !!! n = no. of elements in input array !!! !!! m = no. of points smoothing (should be odd no.) !!! !!! Output: !!! !!! y = one dimensional array; y(n) !!! !!! Version: March 24, 2010 (ATJ/DBS) !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Subroutine moving_average (x, n, m, y) Dimension x(n), y(n) If (mod(m,2) == 0) m = m + 1 Do i = 1, n k2 = (m/2) 151 Continue iflag = 0 i1 = i - k2 i2 = i + k2 If ((i1 <= 0).or.(i2 > n)) iflag = 1 If ((i1 <= 0).or.(i2 > n)) k2 = k2 -1 If (iflag == 1) Go to 151 sumx = 0.0 Do j = i1, i2 sumx = sumx + x(j) Enddo nd = (i2 - i1) + 1 y(i) = sumx/float(nd) Enddo Return End