0
$\begingroup$

Here is the part of the program I am having problems with:

 samples = sdr.read_samples(16*1024)
    power, _ = mlab.psd(samples, NFFT=1024, Fs=sdr.sample_rate /1e6)

NFFT is the data points iin each block of FFT and Fs is the sampling frequency. Now, here are my questions:

  1. What does 12*1024 signify
  2. why do we do sdr.sample_rate /1e6
$\endgroup$
1
  • 1
    $\begingroup$ Do have a look at the matplotlib PSD docs... which say "The power spectral density Pxx ... The vector x is divided into NFFT length segments. Each segment is detrended ... and windowed ... The |fft(i)|2 of each segment i are averaged to compute Pxx" $\endgroup$
    – tomnexus
    Mar 18 at 5:27
2
$\begingroup$

More than one block can be read into the psd if you want a result that is averaged (thus usually smoother) over several blocks.

A sample rate in Hz can be divided by 1e6 if you want a spectral plot labeled in MHz, instead Hz.

$\endgroup$
2
  • $\begingroup$ ok , but what do you mean exactly by writing it as 16*1024, why not write it as 16384 $\endgroup$
    – RasenRhino
    Mar 18 at 14:27
  • $\begingroup$ You can write 16384 if you (and everybody reading it) knows how to divide by 1024 in their head quickly. $\endgroup$
    – hotpaw2
    Mar 18 at 17:45
1
$\begingroup$
  1. The number of samples to read.

  2. Probably because whoever wrote it wants the graph to read in MHz rather than Hz.

$\endgroup$
2
  • $\begingroup$ I get that it means the number of samples to read, but why write it as 16*1024 rather than 16384 samples $\endgroup$
    – RasenRhino
    Mar 18 at 14:25
  • $\begingroup$ @RasenRhino readability. $\endgroup$ Mar 19 at 16:53

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.