discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: Fwd: How to print a list of the frequencies that are in the spectrum


From: Marcus D. Leech
Subject: Re: Fwd: How to print a list of the frequencies that are in the spectrum?
Date: Tue, 31 May 2022 13:26:17 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 2022-05-31 12:20, Dor Ratz wrote:


Hey All,

Marcus really helped me.

I will be thankful if anyone can advise me - my question is how to convert the FFT bin number with the maximal power to the freq[Hz].

I've looked in this link about it.
In my example, Fs = 32000[Hz], N = 1024.
The maximal FFT  bin number with the maximal power is bin number 832.
832*Fs/N = 832 *(32000Hz/1024) = 26000[Hz]

But my sigal source has a frequency of 10000[Hz], so what I've done wrong here?

Appendix with the explanation:

The first bin in the FFT is DC (0 Hz), the second bin is Fs / N, where Fs is the sample rate and N is the size of the FFT. The next bin is 2 * Fs / N. To express this in general terms, the nth bin is n * Fs / N.


YOu've selected the "shift" option, which shifts the FFT output so that it's more "natural":

-fs/2--DC--fs/2


This places DC at the middle bin.

And if you don't understand what negative frequencies are, you need to review complex baseband signal representation.





This is my setup:
image.png

And this is the graph:
image.png




Best,

Dor



Virus-free. www.avg.com

‫בתאריך יום ג׳, 17 במאי 2022 ב-23:20 מאת ‪Marcus Müller‬‏ <‪mueller@kit.edu‬‏>:‬
Hi Dor,
Re: 2. : That's … the input items! The actual samples that your block's signal processing
works on.
I think I couldn't explain this better in an email than our GNU Radio tutorials on
https://tutorials.gnuradio.org already do. There's not much magic here. If you understand
what a discrete-time signal is: a compact sub-sequence of the discrete-time signal flowing
through your block!

 > I try to understand what input carries the power vs frequency information in a list?  Is
 > there anything like that?

There's no such input. But: you can "package" your discrete-time signal into vectors of
some length N, and then feed that into GNU Radio's FFT block. The output then is vectors
of discrete-frequency samples. Put these vectors through a "complex to mag²" block, to
convert them to power.
To explain
The frequency information in the output of the FFT is implicit, as the DFT (which is what
an FFT computes) simply maps N samples to N equally spaced subcarriers that divide the
sample rate evenly. So, the position within the vector *is* giving you exactly the
frequency. The Power is the magnitude square of the complex samples!

Best regards,
Marcus

On 17.05.22 21:19, Dor Ratz wrote:
> Hey,
>
> Thanks a lot.
>
>
> First of all, I use GNURADIO version 3.8.2 , this is the picture of the setup :
> image.png
>
> For example here the frequency of the signal source is 10khz and it can be seen here:
>
> image.png
>
> *_My questions are:_*
>
> *1.How can I find the frequencies with relative gain higher than some threshold ?*
> *
> *
> *2. What is exactly the input "input_items"? is it a list of gain vs what? What are the
> indexes? *
>
> image.png
>
>
> I try to understand what input carries the power vs frequency information in a list?  Is
> there anything like that?
>
> I try to solve it without scipy, just with lists or numpy.
>
>
>
>
> This is my code:
>
> image.png
>
> Thanks a lot
>
> Dor
>
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>       Virus-free. www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> ‫בתאריך יום ג׳, 17 במאי 2022 ב-19:28 מאת ‪Marcus Müller‬‏ <‪mueller@kit.edu
> <mailto:mueller@kit.edu>‬‏>:‬
>
>     Hi Dor,
>
>     just a quick reminder: you're still using WX gui, which has been
>     deprecated for roughly a decade, and GNU Radio 3.7, which is end of life.
>     This could be relatively easily be solved using a Python block of your
>     own design. Sadly, GNU Radio 3.7's support for these is relatively
>     limited. It would be, on very many levels, be a good idea to use a more
>     modern version of GNU Radio (e.g., 3.10).
>
>     Best regards,
>     Marcus
>
>     On 16/05/2022 09.11, Dor Ratz wrote:
>      > Hey,
>      >
>      > How can I print a list of the maximal frequencies that are in the spectrum?
>      >
>      > For example, I connect this signal source with frequency of 1KHz, so I
>      > want to print 1KHz:
>      >
>      > image.png
>      > There is the input_items[0], but if I try to print (max.input_items[0])
>      > I get the power of incoming signal and not the frequency, so I'm not how
>      > to do it.
>      >
>      >
>      > Thanks,
>      >
>      > Dor
>


reply via email to

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