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

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

On Thu, May 22, 2008 at 04:43:23PM +0200, Wolfgang Buesser wrote:

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

Eric B. wrote:

Thanks

Hmm,

I would prefer to have the same weight for all samples. So I guess

I am looking for an FIR with N-taps 1/N each, collapsing the whole

stream

to just a single value. But I guess really setting up this filter and

picking out the

last output-value would be a rather inefficient way of performing the

task.

View this message in context:

http://www.nabble.com/how-to-average-a-steam-tp17405882p17409568.html

Sent from the GnuRadio mailing list archive at Nabble.com.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs