hackrf OOK算法简单数据分析(傅里叶计算)

import numpy as np



def savedata():
    data = []
    i = 0
    c = 0
    while c < 100:
        if c == 50:
            data.append((127.5*np.sin(2*np.pi/(32000/1000))))  # 当数据为 1 时
            data.append((127.5*np.cos(2*np.pi/(32000/1000))))
        data.append((i*127.5*np.sin(2*np.pi/(32000/1000))))   # 当数据为 0 时
        data.append((i*127.5*np.cos(2*np.pi/(32000/1000))))
        i += 1
        c += 1
        i /= (32000/1000)
    np.save("1",data)
    return 

def loaddata():
    data = np.load("1.npy")
    print(data)

savedata()
loaddata()
[  0.           0.           0.777313     3.90781635   0.80160403
   4.02993561   0.80236313   4.03375184   0.80238685   4.0338711
   0.80238759   4.03387482   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
  24.87401606 125.05012325   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494   0.80238761   4.03387494   0.80238761
   4.03387494   0.80238761   4.03387494   0.80238761   4.03387494
   0.80238761   4.03387494]

4.03387494 为虚拟信号  也就是在gnuradio里需要虚拟信号加上数据信号   

当 c = 50 时  我们让信号竖起   在没有数据时 信号是平的 

你可能感兴趣的:(算法)