Python Forum
pyrtlsdr and matplotlib's psd
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pyrtlsdr and matplotlib's psd
#1
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.
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,162 Mar-11-2021, 10:52 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020