简体   繁体   English

如何使用快速傅立叶变换计算每分钟的位数

[英]how can i calculate bits perminute using Fast Fourier transform

i am getting signals as given bellow this data capture for just 10 second (due to limited space here) now i want to write a code which shows bits per minute and im considering the value 3.00 as a bit 我在下面给出了捕获数据的信号,仅捕获了10秒钟(由于此处空间有限),现在我想编写一个代码,该代码显示每分钟的位数,我将值3.00视为一点

What i did: 我做了什么:

I just used a threshold value to print data to count bits per minute 我只是使用一个阈值来打印数据以计算每分钟的位数

as

threshold  = 2.8     # Threshold to do something if value is more than to that. 
if signal >= 2.8:
    print signal              
    counter  = counter +1 # to count how many times we get value more than 2.8 or (near by 3)
    bits_per_mint = counterx6 # captured for 10 second so converted it to minute 
print bits_per_mint   

data out put in 10 second  

1.7646050347
1.6970572917
1.6774392361
0
3.486762153
1.6310026042
1.6582465278
1.6384114583
1.6501171875
1.6769661458
3.9909898997
0
1.6688020833
1.6627473958
1.6689800347
1.6756423611
1.6579513889
0
1.6809592014
1.6504774306
3.7684857685
1.6463671875
1.67640625
0
1.6509635417
1.6736501736
3.5653423434
1.6581206597
1.6516666667
0
1.6449348958
1.6630338542
1.6605772569
1.6500824653
3.4554564564
0
1.6839409722
1.6495399306
1.6393663194
1.6684244792
------------
--------- so on 

How can i do this using Fast Fourier transform 如何使用快速傅立叶变换做到这一点

thanks 谢谢

Try this and let me know if it helped you. 试试这个,让我知道它是否对您有帮助。 You can use time module to introduce the delay in seconds in an outer while loop and then check for the condition if the signal is greater than the threshold if yes then print it and also append it to a list bits_per_min . 您可以使用time模块在外部while循环中引入以秒为单位的延迟,然后检查信号是否大于阈值(如果是),然后检查条件,然后将其打印出来,并将其附加到列表bits_per_min Example code shown below. 示例代码如下所示。

import time
threshold  = 2.8     # Threshold to do something if value is more than to that. 
seconds = 0
counter = 0

while seconds != 60:
    bits_per_min = []    # this part of code runs for one min duration
    if signal >= threshold:   # to compare if signal is greater than the threshold value
        print signal
        bits_per_min.append(signal)
        counter += 1
    time.sleep(1)
    seconds += 1
print bits_per_min

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM