summaryrefslogtreecommitdiff
path: root/plot.py
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2018-03-09 16:42:17 +0200
committerYuval Adam <_@yuv.al>2018-03-09 16:42:17 +0200
commit9a5622e58b3176737dafb8a839c501472157759a (patch)
tree4b5c6395d0c6db4d55e82af6a25a7fe73da7e4ca /plot.py
parentd708dce8d40d7308cdf6bfa62043f2f0cc661397 (diff)
Add samples from pyrtlsdr
Diffstat (limited to 'plot.py')
-rw-r--r--plot.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/plot.py b/plot.py
new file mode 100644
index 0000000..7adf9f0
--- /dev/null
+++ b/plot.py
@@ -0,0 +1,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()