0
$\begingroup$

I am familiar with the continuous Fourier transform yet the more I try to understand FFT, the more I'm confused. If we've got a discrete N sample signal, FFT is a faster way to calculate DFT. If calculating the DFT is independent of frequency bins why do they prop up? For example in the code below that I took from webpage, we're clearly filtering frequencies, in this case the daily temperature, but again I do not understand how can you partition an already discrete sequence in further frequencies called bins. Is there a practical purpose for bins and their interpretability?

from numpy.fft import rfft, irfft, rfftfreq

def low_pass(s, threshold=2e4):
    fourier = rfft(s)
    frequencies = rfftfreq(s.size, d=2e-3 / s.size)
    display(1/frequencies)
    fourier[frequencies > threshold] = 0
    return irfft(fourier)
$\endgroup$
3
  • $\begingroup$ Welcome to SE.SP! I'm not sure what you mean by how can you partition an already discrete sequence in further frequencies called bins ? If the original time-domain signal is $x[n]$ then its DFT is $X[k]$. The value $X[k]$ is the frequency-domain value at the $k^{\rm th}$ bin. The term bin is just used to indicate the frequency domain index $k$. $\endgroup$
    – Peter K.
    Jul 6, 2022 at 16:21
  • 2
    $\begingroup$ This is a really bad way to do a lowpass filter. I suggest not using it or trying to draw any conclusions from it $\endgroup$
    – Hilmar
    Jul 6, 2022 at 17:26
  • $\begingroup$ @Hilmar Yes. This seems to be the trap that everyone falls into when they first come across the FFT and decide they need to filter using it. $\endgroup$
    – Peter K.
    Jul 6, 2022 at 18:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.