[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being ze
From: |
CEL |
Subject: |
Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero. |
Date: |
Fri, 30 Mar 2018 20:57:15 +0000 |
Hi Anshul,
you shouldn't have to have your own buffer for a running sum – can you
explain why you're doing that?
A running sum can trivially be implemented with the IIR filter block
with Feed-Forward taps (1,) and Feed-back taps (1,0)!
Where does in a running sum does a division take place?
> (a) Why am I getting the initial zero samples from the file block in
> gnuradio_companion and non-zero values when using a vector_source in
> unit tests?
If these zeros are not in the file you're reading, your block has a
bug!
> (b) What can I do about it (here specifically as a fix to the
> situation, and a general guideline to always remember)?
good question, but we'd need to know your code, your motivation for a
circular buffer, and why you're implementing a running sum yourself!
Best regards,
Marcus
On Fri, 2018-03-30 at 23:19 +0530, Anshul Thakur wrote:
> Hi,
>
> I used a circular buffer of finite size to keep the past 'N' power
> values of the sample stream in my block as a part of creating a
> running sum. This buffer is initialized to 0 in the constructor.
> The running sum of powers is used to compute the average power used
> in computing signal correlation.
>
> I have a capture stream (cfile) to test the operation of the block.
> The test case uses a vector_source_c block to read the contents of
> the file into memory. The unit tests pass without error.
>
> However, when I use the block in a flowgraph in that reads the same
> file from a file source block gnuradio_companion, I am getting the
> first few sample values as 0 which cause a divide by zero
> problem. This messes up the rest of the running sum. I don't want to
> put an 'if' block that checks for the zero condition as it is not
> expected that a device/stream would ever spit out zero values.
>
> (a) Why am I getting the initial zero samples from the file block in
> gnuradio_companion and non-zero values when using a vector_source in
> unit tests?
>
> (b) What can I do about it (here specifically as a fix to the
> situation, and a general guideline to always remember)?
>
> I am using GNURadio version 3.7.12.
>
> Regards,
> Anshul
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
smime.p7s
Description: S/MIME cryptographic signature
- [Discuss-gnuradio] Avoiding divide by zero in case of input being zero., Anshul Thakur, 2018/03/30
- Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero., Michael Dickens, 2018/03/30
- Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero.,
CEL <=
- Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero., Anshul Thakur, 2018/03/30
- Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero., Gilad Beeri (ApolloShield), 2018/03/31
- Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero., Marcus D. Leech, 2018/03/31
- Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero., Anshul Thakur, 2018/03/31
- Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero., Marcus D. Leech, 2018/03/31
- Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero., Gilad Beeri (ApolloShield), 2018/03/31
- Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero., Gilad Beeri (ApolloShield), 2018/03/31
- Re: [Discuss-gnuradio] Avoiding divide by zero in case of input being zero., Marcus D. Leech, 2018/03/31