[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] how to average a steam
From: |
Eric Blossom |
Subject: |
Re: [Discuss-gnuradio] how to average a steam |
Date: |
Thu, 22 May 2008 09:46:14 -0700 |
User-agent: |
Mutt/1.5.17 (2007-11-01) |
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