Re: [Discuss-gnuradio] Moving average

2019-01-23 Thread CEL
Basics of python types: Phase * (float(SampleRate)/360) (your own parentheses are actually mathematically irrelevant, and numerically make the result less stable, so I' omit them, i.e. Phase * float(SampleRate)/360) Best regards, Marcus On Tue, 2019-01-22 at 06:30 -0700, david vanhorn wrote: >

Re: [Discuss-gnuradio] Moving average

2019-01-23 Thread Phil Frost
from __future__ import division ...in the script at the top or as a GRC block will also do the trick. On Tue, Jan 22, 2019, 17:42 Cinaed Simson On 1/22/19 4:59 AM, david vanhorn wrote: > > Nope. > > > > 1/Averaging evaluates to zero. > > 1/Averaging. (trailing period) does not evaluate, either

Re: [Discuss-gnuradio] Moving average

2019-01-22 Thread Cinaed Simson
On 1/22/19 4:59 AM, david vanhorn wrote: > Nope. > > 1/Averaging evaluates to zero. > 1/Averaging. (trailing period) does not evaluate, either in the Moving > Average parameters, or as a separate variable. You can't put a "." after a variable. Use 1/float(Averaging) or 1./Averaging --

Re: [Discuss-gnuradio] Moving average

2019-01-22 Thread david vanhorn
So how would you represent this expression so that it evaluates as floating point: As the "Delay" variable in a delay block: Phase * (SampleRate/360) On Tue, Jan 22, 2019 at 5:59 AM david vanhorn wrote: > Nope. > > 1/Averaging evaluates to zero. > 1/Averaging. (trailing period) does not

Re: [Discuss-gnuradio] Moving average

2019-01-22 Thread david vanhorn
Nope. 1/Averaging evaluates to zero. 1/Averaging. (trailing period) does not evaluate, either in the Moving Average parameters, or as a separate variable. On Mon, Jan 21, 2019 at 11:00 PM Cinaed Simson wrote: > 1/5 is zero using integer division in python. > > Try using float division > >

Re: [Discuss-gnuradio] Moving average

2019-01-21 Thread Cinaed Simson
1/5 is zero using integer division in python. Try using float division 1/4000. 1/5. -- Cinaed On 1/21/19 4:41 PM, david vanhorn wrote: > The docs say that I need to set Scale to the inverse of the Length. > Ok, I interpret that as Length = 4000 and Scale = 1/4000 > The docs here: >

Re: [Discuss-gnuradio] Moving Average Block

2016-01-12 Thread Pedro Gabriel Adami
Dear all, In addition to my previous response, I'm attaching an image that shows the formula I'm trying to build in gnuradio (using blocks). But instead of n = 0 and N-1, I need n = 1 and 100 (100 samples). The second picture shows how I tried to do in Gnuradio, but the moving average block does

Re: [Discuss-gnuradio] Moving Average Block

2016-01-12 Thread Marcus Müller
Hi Pedro, $y[n]=\sum\limits_{i=n-N+1}^n {\left|x[i]\right|^2}$ is nothing but the moving average over the squared magnitude. Sadly, your formula $T=\sum\limits_{n=0}^{N-1} {\left|Y[n]\right|^2}$ doesn't specify what T signifies; is T used as a single sum over N samples' squared magnitudes, or is

Re: [Discuss-gnuradio] Moving Average Block

2016-01-08 Thread Timothée COCAULT
Whoops, just noticed I didn't reply to all when I answered so my message and Pedro's response were not forwarded to the mailing list : Le jeu. 7 janv. 2016 à 20:28, Pedro Gabriel Adami < pedrogabriel.ad...@gmail.com> a écrit : Dear, Timothée, Thank you so much. I am doing some tests and I've

Re: [Discuss-gnuradio] Moving Average Block

2016-01-07 Thread West, Nathan
Chiming in that this is also a great opportunity to contribute improved documentation after you've figured out your answer. In addition to Marcus' comment, looking at the code helps (and in this case is pretty easy): set_history(d_length); // skipping some stuff @I_TYPE@ sum =

Re: [Discuss-gnuradio] Moving average and history

2009-02-10 Thread Martin Braun
On Mon, Feb 09, 2009 at 01:43:41PM +0100, Martin Braun wrote: [code] Here's what I don't understand: the state for the MA (as for all filters) is saved implicitly in the history. However, in this special case, the state is simply one scalar value (saved in 'sum'). The way this is

Re: [Discuss-gnuradio] Moving average and history

2009-02-10 Thread Matt Ettus
Whoops, forget about skipping the history(), of course it couldn't work. However, by adding a state buffer to the class, the first for() loop can be skipped. For long MAs, this would save some multiplications and only increase memory usage by one item_size. The reason we don't do that is that