summaryrefslogtreecommitdiff
path: root/plot.py
blob: 7adf9f030f054f7bad3f8613a50b3673652c1659 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from pylab import *
from rtlsdr import *

sdr = RtlSdr()

# configure device
sdr.sample_rate = 2.4e6
sdr.center_freq = 95e6
sdr.gain = 4

samples = sdr.read_samples(256*1024)

# use matplotlib to estimate and plot the PSD
psd(samples, NFFT=1024, Fs=sdr.sample_rate/1e6, Fc=sdr.center_freq/1e6)
xlabel('Frequency (MHz)')
ylabel('Relative power (dB)')

show()