I don't think that the average calculation produces the zeros.

   a=.?20#100
   a
89 65 84 30 49 30 60 87 69 28 31 81 7 42 23 45 95 20 23 87
   7(+/%#)\a
58.1429 57.8571 58.4286 50.4286 50.5714 55.1429 51.8571 49.2857 40.1429 36.7143 
46.2857 44.7143 36.4286 47.8571

but the shorter row of data is padded in order to fit to the longer row of data

   a,:7(+/%#)\a
     89      65      84      30      49      30      60      87      69      28 
     31      81       7      42 23 45 95 20 23 87
58.1429 57.8571 58.4286 50.4286 50.5714 55.1429 51.8571 49.2857 40.1429 36.7143 
46.2857 44.7143 36.4286 47.8571  0  0  0  0  0  0


--- Den tors 10/6/10 skrev David Vincent-Jones <[email protected]>:

> Fra: David Vincent-Jones <[email protected]>
> Emne: [Jprogramming] Moving Average
> Til: "JSoftware" <[email protected]>
> Dato: torsdag 10. juni 2010 02.16
> I am plotting daily data over a 6
> month period and also providing (on
> the same chart) a 7 day moving average. Using Infix and a
> simple
> arithmetic average appeared to be the correct solution,
> however the
> shape of the moving average using Infix is truncated with
> reference to
> the raw data giving me a series of zeros at the end.
> 
> I can 'pad' the raw data with the last value and then chop
> the padding
> off after the calculation ..... or is there a better
> solution?
> 
> David
> 
> ----------------------------------------------------------------------
> 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