Hi Hal, In the moving averages I'm doing, I'm saving the last bit to be shifted out and if it's a 1 (i.e. 0.5) I increase the result by 1.
Bob >________________________________ > From: Hal Murray <hmur...@megapathdsl.net> >To: Discussion of precise time and frequency measurement <time-nuts@febo.com> >Cc: hmur...@megapathdsl.net >Sent: Wednesday, March 12, 2014 2:25 PM >Subject: Re: [time-nuts] PLL Math Question > > > >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. > > > _______________________________________________ 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.