无线电 计算分贝值 扫描每个频率的分贝值 和 列出最高分贝值的程序

import rtlsdr as rsdr
import numpy as np
import matplotlib.pyplot as plt



def BB(data,len):
    sum = None
    bb = None
    for i in range(0,len):
        sum = data[i]*data[i]
    bb = np.sqrt(sum/len)
    bb = 20*np.log10(bb)

    return bb



s = rsdr.RtlSdr()


for i in range(75000000,107700000,10000):
    s.center_freq = i
    data = s.read_samples(256)

    data = np.array(data).view(np.float64)

    b = BB(data,len(data))
    print(i)
    print(int(b))
import rtlsdr as rsdr
import numpy as np
import matplotlib.pyplot as plt



def BB(data,len):
    sum = None
    bb = None
    for i in range(0,len):
        sum = data[i]*data[i]
    bb = np.sqrt(sum/len)
    bb = 20*np.log10(bb)

    return bb



s = rsdr.RtlSdr()
blist = []

for i in range(75000000,107700000,100000):
    s.center_freq = i
    data = s.read_samples(256)

    data = np.array(data).view(np.float64)

    b = BB(data,len(data))
    if int(b) > -40:
        print(str(i) + "  " + str(int(b)))

你可能感兴趣的:(numpy,linux,python,学习,算法)