Shop OBEX P1 Docs P2 Docs Learn Events
Another algorithm question — Parallax Forums

Another algorithm question

ArchiverArchiver Posts: 46,084
edited 2001-02-15 17:16 in General Discussion
Are there any algorithms available to compute moving averages of sampled
data? Can this be done in RAM, or is Write/Read to the EEPROM required?

Thanks,

Rob
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-02-15 17:16
    >Are there any algorithms available to compute moving averages of sampled
    >data? Can this be done in RAM, or is Write/Read to the EEPROM required?

    Hi Rob,
    Depends. It is better to do it in RAM if the data rate it high,
    because of the danger of wearing out the EEPROM from too much
    activity. EEPROM is slow. On the other hand, the Stamp does not
    have much RAM available. Maybe your moving average only requires a
    short data set?

    The algorithm itself is not much of a problem. Set up a circular
    buffer with a pointer to the the location to put the newest entry,
    which will replace the oldest entry. Init the whole array with the
    first reading taken. Then at each step, subtract the oldest entry,
    add in the new entry, and advance the pointer.

    regards,
    -- Tracy
    electronically monitored ecosystems
    http://www.emesys.com/BS2math5.htm <--- more examples of digital filtering
Sign In or Register to comment.