MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Moving average type process

  • To: mathgroup at
  • Subject: [mg18240] Re: Moving average type process
  • From: "David Keith" <dkeith at>
  • Date: Thu, 24 Jun 1999 14:24:21 -0400
  • Organization: Hevanet Communications
  • References: <7kpbdq$>
  • Sender: owner-wri-mathgroup at

Hi Virgil,

In 4.0 they put this in the kernel:

ListCorrelate[{w1, w2, w3}, {a, b, c, d, e, f}]

{a w1 + b w2 + c w3, b w1 + c w2 + d w3, c w1 + d w2 + e w3,
  d w1 + e w2 + f w3}

-- Dave

Virgil Stokes wrote in message <7kpbdq$4at at>...
>I wish to perform the following "moving average" type process on
>a list to generate a new list:
>  wtlist = {w1,w2,w3}     -- weight list
>  inlist = {a,b,c,d,e,f}  -- any other list (>= 3 elements)
>  outlist = {w1*a+w2*b+w3*c, w1*b+w2*c+w3*d, w1*c+w2*d+w3*e,
>Note, outlist will always contain 2 less (Length[wtlist]/2) elements
>than in the input list (inlist).
>If w1=w2=w3=x, then
>the following works fine:
>outlist = x*Drop[Plus@@NestList[RotateRight,inlist,2],2]
>This is a weighted (from wtlist) sum over another list of arbitrary
>length (inlist). I would like to get a "fast" function for doing this when
>the weights are not equal.
>-- Virgil

  • Prev by Date: Re: Forcing Re[]'s to be Real
  • Next by Date: Re: quartiles
  • Previous by thread: Re: Moving average type process
  • Next by thread: Re: Moving average type process