Hi, I'm trying to read data and integrate the results for a given bandwidth, something that I thought was going to be easy. the problem is that I cannot control the badwidth.
this is the code I am running, its a light modification from the one found on github.
when I run this code I get a sequence of images like this that gives me only a small region. How can I make the region wider? and how can i extract the average relative power like shown in the graph?
this is the code I am running, its a light modification from the one found on github.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from pylab import * from rtlsdr import * import matplotlib matplotlib.rcdefaults() for i in range ( 50 ): sdr = RtlSdr() # configure device sdr.sample_rate = 2.4e6 sdr.center_freq = 1.6e9 sdr.bandwidth = 10e9 # I added to set the bandwith sdr.gain = 1 samples = sdr.read_samples( 256 * 1024 ) sdr.close() # use matplotlib to estimate and plot the PSD fig = psd(samples, NFFT = 1024 , Fs = sdr.sample_rate / 1e6 , Fc = sdr.center_freq / 1e6 ) xlabel( 'Frequency (MHz)' ) ylabel( 'Relative power (dB)' ) matplotlib.use( 'Agg' ) name = str (i) savefig(name) plt.clf() |