How do I obtain the frequencies of each value in an FFT?

前端 未结 5 1262
轮回少年
轮回少年 2020-11-21 07:48

I have an FFT result. These are stored in two double arrays: a real part array and an imaginary part array. How do I determine the frequencies that correspond t

5条回答
  •  盖世英雄少女心
    2020-11-21 08:23

    I have used the following:

    public static double Index2Freq(int i, double samples, int nFFT) {
      return (double) i * (samples / nFFT / 2.);
    }
    
    public static int Freq2Index(double freq, double samples, int nFFT) {
      return (int) (freq / (samples / nFFT / 2.0));
    }
    

    The inputs are:

    • i: Bin to access
    • samples: Sampling rate in Hertz (i.e. 8000 Hz, 44100Hz, etc.)
    • nFFT: Size of the FFT vector

提交回复
热议问题