Reputation: 157
I am doing a task which involves taking two signals from a phase doppler anemometry system and calculating the phase shift and the frequency which will further help in finding the velocity and diameter of the droplet. Before getting into the actual task, I am now taking two sine signals from a function generator and producing a phase shift and then calculating the phase and frequency via a program in python with FFT to verify if both are the same. In that process, I am now getting the frequency value same as what I have set in the function generator. So frequency problem is solved. I am currently stuck up in a state where I need to find the bin number where my frequency belongs and using that I can calculate the exact phase shift. Also, I would like to know how to find the number of bins used in the FFT. My signal is 40MHz, my sampling frequency is 125MHz.
Thank you!
Upvotes: 1
Views: 345
Reputation: 88
It might be slightly overkilling but you can use numpy.where to find the index of a specific value in an array
>>> import numpy as np
>>> np.where(np.linspace(1,10,10)==4)
(array([3]),)
Upvotes: 1