On Thu, May 22, 2008 at 04:43:23PM +0200, Wolfgang Buesser wrote: > Hi, > > what is the simplest way to caluclate the average of a stream? > > I generate a stream of fixed length using head(). I would like to > calculate the linear average (i.e. > sum_of_all_samples/number_of_samples). > > Thanks > Wolfgang >
Depending on your exact needs, an IIR filter will do a reasonable job of computing a running approximation to the average value of a stream. See gr_single_pole_iir_filter_* http://gnuradio.org/doc/doxygen/classgr__single__pole__avg__filter__ff.html http://gnuradio.org/doc/doxygen/classgr__single__pole__iir__filter__cc.html Absent a better idea, start with alpha == 0.001 Eric _______________________________________________ Discuss-gnuradio mailing list [email protected] http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
