Thanks Ric .... that was easy to implement (even if I don't totally
understand it).

David

On Fri, 2010-06-11 at 09:41 +1200, Sherlock, Ric wrote:
> You can just plot series of different lengths rather than padding with zero.
> 
>    load 'plot'
>    data=: 15 ?...@$ 50
> 
>    pd 'reset'
>    pd"1 ,.data ; 7(+/ % #)\ data
>    pd 'show'
> 
> Or to offset the start of the second series:
> 
>    series1=: (i.15) ; data               NB. raw data
>    series2=: (6+i.9) ; 7(+/ % #)\ data   NB. moving average
> 
>    pd 'reset'
>    pd"1 series1,:series2
>    pd 'show'
> 
> > From: David Vincent-Jones
> > Sent: Friday, 11 June 2010 09:19
> > 
> > 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
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to