mag...@rubidium.dyndns.org said:
> Exponential averger takes much less memory. Consider this code:
> x_avg = x_avg + (x - x_avg) * a_avg;
> Where a_avg is the time-constant control parameter. 

Also note that if a_avg is a power of 2, you can do it all with shifts rather 
than multiplies.

Note that the shift is to the right which drops bits.  That suggests that you 
might want to work with x scaled relative to the raw data samples.  Consider 
a_avg to be 1/8, or a shift right 3 bits.  Suppose x_avg is 0 and you get a 
string of x samples of 2.  The shift throws away the 2 so x_avg never changes.

-- 
These are my opinions.  I hate spam.



_______________________________________________
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Reply via email to