user6281035
user6281035

Reputation:

How to specify a certain number of fft points in a frequency

I apologize in advance, if my question doesn't make any sense. I am confused myself, because I have trouble understanding it. Its a general question, which i need to be answered for my code i am currently working on.

I have a sample rate of 44.1 kHz, for a audio file (wav), on which i want use a FFT. If i am right, it means,there are 44100 points in 1 second. I have fulfiled the rules of the nyquist-shannon-theorem, which says that my fs/2 > fmax. I have a frequency resolution of 4096. I have defined a variable, that is 300 Hz. I want know, how many points are in there.

Upvotes: 0

Views: 733

Answers (1)

Paul R
Paul R

Reputation: 212939

If you mean that your FFT size is 4096 and your sample rate is 44.1 kHz, then each bin has a resolution of 44100/4096 = 10.7666015625 Hz, and a 300 Hz sine wave will have a peak at the bin with index 4096*300/44100 = 27.863945578231293, so in practice it will have a maximum at bin index 28, with some energy in adjacent bins. (Note this is using the common convention of indices starting at 0 - if you are using MATLAB then the indices will most likely be 1-based and you will need to compensate for this.)

See this useful answer for a more detailed explanation of how bin indices relate to frequency.

Upvotes: 4

Related Questions