[Top][All Lists]

 From: CEL Subject: Re: [Discuss-gnuradio] Moving average Date: Wed, 23 Jan 2019 17:04:46 +0000

```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:
> 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 <address@hidden> 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.
> >
> >
> > On Mon, Jan 21, 2019 at 11:00 PM Cinaed Simson <address@hidden> wrote:
> > > 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:
> > > > says that Scale is a float.
> > > >
> > > > The discussion here clearly shows Scale working for values <1 and >0
> > > >
> > > > If I enter a scale value by hand, like 0.2, then I see 200m which is
> > > > what I expect.
> > > > If I enter a scale value as (1/5) then I see 0.
> > > > If I set a variable called "Scale" = (1/) and enter "Scale" in the Scale
> > > > field of the moving average, it evaluates to 0.
> > > >
> > > >
> > > > When I enter the values in the block, it looks like scale is an int,
> > > > which makes 1/4000 or indeed 1/(>1) problematic in that it always
> > > > evaluates to zero, which kinda breaks things.
> > > > When I enter 1/2 I get "0"
> > > >
> > > > When I hover over the field to enter Scale, I get Type Real.
> > > >
> > > > I have the input and output of my integrator connected to a QT GUI Time
> > > > Sink, and while the input waveform is what I expect, if I have any <1
> > > > Scale parameter, the output is 0.
> > > >
> > > >
> > > > Is something broken here, or is it me?
> > > > I've not had any problems using simple math in any of the other fields
> > > > where appropriate.
> > > >
> > > >
> > > > --
> > > > K1FZY (WA4TPW) SK  9/29/37-4/13/15
> > > >
> > > > _______________________________________________
> > > > Discuss-gnuradio mailing list
> > > >
> > >
> > >
> > > _______________________________________________
> > > Discuss-gnuradio mailing list
> >
> >
> > --
> > K1FZY (WA4TPW) SK  9/29/37-4/13/15
>
>
> _______________________________________________