discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Moving average


From: Phil Frost
Subject: Re: [Discuss-gnuradio] Moving average
Date: Wed, 23 Jan 2019 07:40:06 -0500

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 <address@hidden wrote:
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

-- Cinaed


>
>
> On Mon, Jan 21, 2019 at 11:00 PM Cinaed Simson <address@hidden
> <mailto: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:
>     >
>     https://www.gnuradio.org/doc/doxygen/classgr_1_1blocks_1_1moving__average__ff.html
>     > says that Scale is a float.
>     >
>     > The discussion here clearly shows Scale working for values <1 and >0
>     >
>     https://lists.gnu.org/archive/html/discuss-gnuradio/2016-01/msg00084.html
>     >
>     > 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
>     > address@hidden <mailto:address@hidden>
>     > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>     >
>
>
>     _______________________________________________
>     Discuss-gnuradio mailing list
>     address@hidden <mailto:address@hidden>
>     https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
>
> --
> K1FZY (WA4TPW) SK  9/29/37-4/13/15


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

reply via email to

[Prev in Thread] Current Thread [Next in Thread]