aspcore.fouriertransform.dft_vector

aspcore.fouriertransform.dft_vector(freq_idx: int, dft_len: int)

All exponential values to calculate the DFT for a specific frequency bin

Returns exp(i 2pi k n / N) / N for all time steps n = 0, 1, …, N-1

Parameters:
  • freq_idx (int) – the index of the frequency bin. Symbol k in the formula above.

  • dft_len (int) – the number of frequency bins. Symbol N in the formula above.

Returns:

exp_vector

Return type:

ndarray of shape (dft_len,)

Notes

The values corresponds to the DFT definition used here which is u(k) = sum_n u[n] exp(i 2pi k n / N). See documentation for the fft function.

Although inefficient, the DFT can be calculated by multiplying the input signal with this vector and summing. Preferably, use the fft and ifft functions.