This question already has an answer here:
I have a plot of the fourier transform of a signal. The fourier transform of the signal is plotted vs. its index numbers. I am given the sampling frequency (Fs) and the total number of samples (N), as well as the indices for the two largest peaks in the sample. I am looking to find the beats per minute of the signal with this information. My first guess would be that it is the total number of samples divided by the index of the largest peak (N/(largest index). However, I feel as though something should be done with the second maximum peak. I am confused on where the indices come into play. Any help would be appreciated.
The Discrete Fourier Transform for real input data has some symmetry:
X_{N-k} = X*_{k}
. I assume your peaks obey this relationship. So, only the firstN/2
points are relevant and you are only able to detect frequencies lower thenFs/2
, because if you sample at a frequency ofFs
a sinus with frequency ofFs/2
, you can not see the difference between this sinus and a constant.Note that
-1
is need because the first element corresponds with a zero frequency (i.e. constant value).You can always check your code by manually determining the peak between two heartbeats are by validating your method with a generated signal with known frequency.