Great alternate approaches ... Symmetrically padding appears to me a most valid direction, and fairly simple to implement. Difficult to apply "n/a" in a plot but zero values would be at least comprehensible to the viewer.
Bo's idea of shorter edge samples is also a nice touch. Thanks all; David On Thu, 2010-06-10 at 11:18 -0400, Raul Miller wrote: > Here's a moving average implementation which > uses shorter samples near the edges: > > mean=: +/ % # > noNaN=: #~ 1 - 128!:5 > avg=: m...@nonan > nanPad=: ] (],[,]) _. #~ <:@[ > movingAvg=: [ avg\ nanPad > > Example use: > > 5 movingAvg i.10 > > Note that this particular result is longer than the right, > but a different amount of padding would change that. > > For example > > nanPad2=: <....@-:@[ |. ] ,~ _. #~ <:@[ > movingAvg2=:[ avg\ nanPad2 > > FYI, > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
