Re: iterative algorithm for calculating the moving average



Ron, thanks for your suggestion...this is what I am doing now.
The problem with this is that I still need to keep an array of the old
values. The array becomes
very big when I need to evaluate a 6hr moving average every minute (360
elements take up a lot of valuable resources on
an old real time system). That is why I need a recursive estimation
technique that does not require any indexing or reference to
the old values. Online, I only have an array of 20 elements available for
calculations and 50 steps to do the calculation.

Thanks!
Yannis


"Ron Shepard" <ron-shepard@xxxxxxxxxxxxxxxxxx> wrote in message
news:ron-shepard-A15862.23174428042005@xxxxxxxxxxxxxxxxxxxxxxxxxxx
> In article <xkhce.1151947$8l.1071914@pd7tw1no>, "me" <me@xxxxxx>
> wrote:
>
> > Any ideas? Does anyone have any algorithms or references on the above
> > subject?
>
> Why not try the obvious solution, from the running total value
> subtract off the old "first" element, and add on the new "last"
> element? This might involve some accumulation of roundoff errors
> for very long strings of values, so you might want to reset
> everything every Nth step for some suitable value of N. This
> involves two adds and a multiplication for each time step,
> regardless of the number of elements in the running average.
>
> $.02 -Ron Shepard


.



Relevant Pages

  • Re: VB-101: Passing Arrays ByVal vs ByRef
    ... changed if an array is passed by Val. ... ' new reference ... As each function creates a new array object, ... 'secondArray' and 'secondArrayCopy'. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Need help with textboxes
    ... The JavaScript 1.5 Reference already states: ... All forms and their children are stored in an array ... use dot notation or object literals. ... No. Bracket property accessors allow their argument to be any string value. ...
    (comp.lang.javascript)
  • Re: Garbage Collection Issues in long-standing services
    ... the pinned array should get unpinned or ... The receive case is done quite well, I do create a 4K buffer and reuse it ... and remove the reference to my wrapper socket class, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to give selective access to the methods in a class?
    ... different memory locations at different times. ... The reference still leads to the ... So array resizing ... program pushes certain objects into the circular buffer, ...
    (comp.lang.java.programmer)
  • Re: Perlish map() function
    ... the reference material, the Array constructor was introduced in JavaScript ... evaluation would result in a ReferenceError. ... identifier shows that it is true. ...
    (comp.lang.javascript)