Sep-22-2018, 01:27 AM
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.
this is the code I am running, its a light modification from the one found on github.
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()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?