Git Product home page Git Product logo

ewma's People

Contributors

jonniezg avatar rudex-it avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ewma's Issues

Template version EWMAT

The argument of non-using float is false.
When you look at the code, there're at least 3 divisions, which are very slow !

example doesn't compile on Arduino Nano

Arduino Nano compile does not have Serial.printf and even sprintf() does not have %f

FilteredADC:29:12: error: 'class HardwareSerial' has no member named 'printf'; did you mean 'print'?
Serial.printf("Raw=%d, Filter1=%.3f, Filter2=%.3f", raw, filtered1, filtered2);
^~~~~~
print

EwmaT only handles unsigned?

This breaks (returns high numbers instead of negatives when the "average" goes negative) when fed negative values.

EwmaT <long int> diff_ewmat(3, 10, 500); 
...
filtered = diff_ewmat.filter(value); 

This works (add/subtract an offset to keep everything positive):

EwmaT <long int> diff_ewmat(3, 10, 1000500); 
...
filtered = diff_ewmat.filter(value+1000000)-1000000; 

Sorry, C++ isn't nearly my day job, so maybe I'm expecting too much, but there's nothing to indicate this shouldn't work with signed numbers.

Something must be wrong in the template...

As far as I've understood the doc, all these lines should be equivalent:
EwmaT<int32_t> ewmat_sliding_Average(1, 125, 0); => result is ok !
EwmaT<int32_t> ewmat_sliding_Average(4, 500, 0); => result is KO !
EwmaT<int32_t> ewmat_sliding_Average(8, 1000, 0); => result is KO !

But it looks like, at some time in the calculation, there's an overflow (I add only values between 0 and 30000).

Some compile-time validation or so should be implemented to know what is the limit, .... or at least documented !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.