Sunday, February 16, 2025

Re: frequency scaling in QT GUI Frequency Sink under limited bandwidth

Hi Markus,

Thanks for the reply. The explanation is clear. I signed up to the GRC Wiki and I'll try to suggest something. Unfortunately, this may take a long time, as I'm just getting to know GRC.

Best regards,
Maciej


czw., 30 sty 2025 o 16:51 Marcus Müller <mmueller@gnuradio.org> napisał(a):
Hi Maciej,

yes, you're right that the frequency sink conflates "sampling rate" and "bandwidth". It
always shows the full Nyquist bandwidth, and only scales the axis labels to fit your
bandwidth setting.

(Internally, what happens is simply that
10·log_10(|DFT(Input[N*num_point…(N+1)*num_point])) are taken and plotted. The DFT doesn't
actually care about any frequencies; it tells you something about "something repeats every
so and so many samples", and what that means in "real-world" time or frequency is only
defined by sampling rate.)

This is "slightly" documented (read: probably not good enough) on
https://wiki.gnuradio.org/index.php/QT_GUI_Frequency_Sink, where it says

 > Bandwidth (Hz)
 >    bandwidth of signal (used to set x-axis labels)
 >    default: samp_rate

The implication "used for nothing *but* to set the x-axis labels as fraction of the
overall width" is not done well.

Generally, that page could use some love: it's mostly a listing of the parameters without
explanations, the example is outdated (and also a bad choice, because it uses a "PSK Mod"
block, first of all, a deprecated block, and a block choice which to the unsuspecting
reader would imply that PSK has a spectral shape, but that's of course wrong, what has a
spectral shape is the pulse shaping done "hidden" in the "PSK Mod" block!)

Would you think you could make a wiki account and help us improve that?

Best regards,
Marcus

On 1/25/25 8:06 PM, Maciej Zemło wrote:
> Hello,
>
> I recently encountered an issue while using the QT GUI Frequency Sink in GNU Radio, which
> caused incorrect frequency readings when the displayed bandwidth was set to a value
> smaller than the sampling rate (\(fs\)).
>
> My signal source was set to generate a cosine wave at 1000 Hz, with the sampling rate
> 32k. The QT GUI Frequency Sink was configured with a displayed bandwidth of samp_rate / 8
> = 4 kHz. The frequency of the signal was displayed incorrectly on the plot, showing around
> 120 Hz instead of the expected 1 kHz.
>
> After investigating, I think that this behavior was caused by how the QT GUI Frequency
> Sink rescales and interprets the frequency axis when the displayed bandwidth is set to a
> smaller range. When I increased the bandwidth in the frequency sink to match the full
> samp_rate, the signal frequency was displayed correctly. Is this a correct assessment and
> does it work like that for you too?
>
> Best regards,
> yabool2001
>

No comments:

Post a Comment