Jump to content
  • 0

How to measure frequency of analog signal using python APIs provided ?


Mina Sameh

Question

5 answers to this question

Recommended Posts

  • 0

Hi @Mina Sameh @abia

See the updated example: AnalogIn_FFT.py

iPeak1 = 0
vMax = float('-inf')
for i in range(5, nBins): # skip DC
    if rgBins1[i] < vMax: continue
    vMax = rgBins1[i]
    iPeak1 = i

print("C1 peak: ", hzTop*iPeak1/(nBins-1)/1000,"MHz")

if iPeak1 < nBins: # weighted average
    s = 0
    m = 0
    for i in range(-2,3):
        t = pow(10,rgBins1[iPeak1+i])
        s += (iPeak1+i)*t
        m += t
    iPeak1 = s/m
    print("C1 peak weighted: ",hzTop*iPeak1/(nBins-1)/1000,"MHz")

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...