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, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
