程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

Having trouble with rtl-sdr-v4 frequency scanner

发布于2024-12-08 09:49     阅读(338)     评论(0)     点赞(5)     收藏(0)


I am attempting to make a frequency scanner that outputs an array of frequencies but I do not know how to do anything with any of these libs as I'm not an advanced Python programmer anymore, main problem is the array is outputting from -400 to 400 and even when I get it to do 0 - a positive number the positive max number is higher than the amount of samples in passing through, how is this possible?

import numpy as np
import matplotlib.pyplot as plt
from rtlsdr import RtlSdr
from scipy.signal import find_peaks
import time

SDR = RtlSdr()
StepSize = 10
Start = 1000
Stop = 1250

# CONFIGURATION
SDR.sample_rate = 1.024e6
SDR.gain = 'auto'

Frequencies = np.arange(Start, Stop, StepSize)
plt.figure(figsize=(10, 6))

for Frequency in Frequencies:
  print(Frequency)
  SDR.center_freq = Frequency
  Samples = SDR.read_samples(256*1024)
  Spectrum = np.abs(np.fft.fftshift(np.fft.fft(Samples)))
  MoreFrequencies = np.fft.fftfreq(len(Spectrum), 1/SDR.sample_rate)
  plt.plot(MoreFrequencies / Start + (Frequency / Start), Spectrum)

plt.title('Frequency Scan from 0Hz to 1KHz')
plt.xlabel('Frequency (KHz)')
plt.ylabel('Power')
plt.grid(True)
plt.show()

I tried to use numpy and matplot.


解决方案


暂无回答



所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接:https://www.pythonheidong.com/blog/article/2046417/b5a52b24cdf57cf555e4/

来源:python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

5 0
收藏该文
已收藏

评论内容:(最多支持255个字符)