discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] sampling rate of a customized signal source


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] sampling rate of a customized signal source
Date: Sat, 31 May 2014 11:44:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

Hi Pengyu, Activecat!

These are very good considerations!
I just wanted to add, since this comes up rather frequently, that in digital signal processing like GNU Radio,
there is no "factual" sampling rate. So if you "calculate" a signal, it's frequency can only be measured by the number of samples a period of that signal takes.

So I'm a little confused about your customized module, either it is pure software, in which case you, Pengyu, set the sampling rate,
calculate how many samples equal 1ms etc (like Activecat explained), or it is a hardware source, in which case there should be some driver etc to tell you about
your sampling rate. Samples do not carry any "additional" information such as sampling rate, they are just numbers.

Greetings,
Marcus

On 31.05.2014 06:15, Activecat wrote:
Hi Pengyu,
There are few considerations:

 On Sat, May 31, 2014 at 4:19 AM, Pengyu Zhang <address@hidden> wrote:

Hi All,
How to determine the sampling rate of a customized signal source?

I designed a customized signal source which should output two 1ms pulses
every 10ms. If I do not know the sampling rate of the customized module, I
do not know how many elements I should put into the out* buffer for
generating the two 1ms pulses.


To make the discussion easy, let's assume there is rate-limiting block (eg.
throttle, USRP etc) in your flowgraph.

1).  When your parameters above are described in time (example 1ms, 10ms
etc), it is very likely that you will need to configure "Sample Rate"
(which is samp_rate) as one of the variables of your custom block setting.

2).  If you need 1ms pulses, this means your samp_rate must not be lower
than 1kHz.
      In fact your samp_rate must be multiple of 1kHz.
      You may want to put a runtime check on this.

3).  When you say "should output two 1ms pulses every 10ms", does it mean
it output one 1ms pulse every 5ms ?
      Let me assume yes to proceed with the discussion.

Says, the amplitude of the pulse is 1V.

4).  When samp_rate=1kHz, then your custom block will output one 1V and
four 0V in every five outputs.
     This means you need to "set_output_multiple(5)"

5).  When samp_rate=10kHz, then your custom block will output ten 1V and
forty 0V in every fifty outputs.
      This means you need to "set_output_multiple(50)".

6).  To generalize item 4 and 5 above, you need to
      "set_output_multiple( samp_rate / 200 );"

.... (many more)

This gives you some idea to start with, the rest is up to you to figure out.
Good luck.



_______________________________________________
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]