如何使用快速傅立叶变换计算位电容

2024-03-28 12:26:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我得到的信号如下所示,这个数据捕捉只有10秒(由于这里的空间有限),现在我想写一个显示每分钟位数的代码,我考虑3.00作为一个位

我所做的:

我只是用一个阈值来打印数据来计算每分钟的位数

作为

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 

如何使用快速傅立叶变换

谢谢


Tags: to数据signalifsovaluemorecounter
1条回答
网友
1楼 · 发布于 2024-03-28 12:26:05

试试这个,告诉我是否对你有帮助。您可以使用time模块在外部while循环中引入以秒为单位的延迟,然后检查信号是否大于阈值(如果是),然后打印它并将其附加到列表bits_per_min。示例代码如下所示。在

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

相关问题 更多 >