4
$\begingroup$

System is debian 10 with gnuradio 3.7.

untitled.grc create simple flow graph as below:
enter image description here

The only difference between 2 flows is bandwidth of gui sink,cause 2 different signal frequency as below:

enter image description here

Why Gnuradio bandwidth of sink cause signal frequency changed?

$\endgroup$
1
  • 1
    $\begingroup$ Hello and welcome to ham.stackexchange.com! $\endgroup$
    – rclocher3
    Aug 26 at 20:01
3
$\begingroup$

Gnu Radio doesn't really know anything about frequency in cycles per second (Hz), only cycles per sample. The left of the chart is -0.5 cycles per sample, the middle is 0 cycles per sample, and the right is +0.5 cycles per sample. It's up to you to enter the correct numbers for "bandwidth" and "center frequency" if you want the scale on the bottom to correctly map the frequency back to cycles per second.

For example, your two signal source blocks are configured with a sample rate of 32k and a frequency of 10k (Hz). This means they will output a signal at a frequency of:

$$ \require{cancel} {10\mathrm k\ \text {cycles} \over \cancel{\text{second}}} \times {\cancel{\text{second}} \over 32\mathrm k\ \text {samples}} = {0.3125\ \text{cycles} \over \text {sample}} $$

Try configuring these signal sources to output 20 kHz at a sample rate of 64 ksps: you'll find they output the same thing, because 20/64 is also equal to 0.3125.

If you know the sample rate, then you can divide a frequency in Hz by the sample rate to get frequency in cycles per second.

Or you can multiply by the sample rate to convert cycles per sample to frequency in Hz.

None of the blocks know the sample rate except what you configure in the block's parameters. Any block that asks for or provides any number in Hz is implicitly making this conversion between cycles per sample and cycles per second. If you enter incorrect information in these parameters, you will get incorrect results.

The default GRC project has a variable sample_rate, and the "Bandwidth" parameter defaults to that. You might want to change that if you are decimating or interpolating the sample stream, but in the example provided you'd want to leave it at the default so the GUI sink's "bandwidth" is equal to the signal source's "sample rate".

$\endgroup$
17
  • $\begingroup$ In the untitled.grc,I set bandwidth of GUI SINK to samp_rate*10,why the peak of frequency move to 100khz? $\endgroup$
    – kittygirl
    Aug 27 at 8:58
  • $\begingroup$ @kittygirl I expanded the answer more. The signal didn't move: you just configured the block to perform a different conversion between cycles per sample and cycles per second. $\endgroup$ Aug 27 at 13:29
  • $\begingroup$ I guess the formula result should be 0.3125 cycles/sample? $\endgroup$
    – kittygirl
    Aug 27 at 18:49
  • $\begingroup$ in the example provided you'd want to leave it at the default,that's not true. I set bandwidth to samp_rate*10 $\endgroup$
    – kittygirl
    Aug 27 at 18:54
  • 1
    $\begingroup$ good catch, thanks $\endgroup$ Aug 27 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.