0
$\begingroup$

A 23 kHz sine wave sampled at 48 kHz with 100 samples. Then do a 64 point FFT of the sampled signal. Why is the FFT of the signal not a delta function at 23 kHz. Or why does the FFT also have values at other frequency?

I think it has something to do with 23kHz / 48 kHz * 64 samples not being an integer. I just couldn’t think the logic through. Please help me! Thank you!!

Edited: sorry guys, i meant 23 kHz

$\endgroup$
  • 1
    $\begingroup$ FFT is the DFT done with a fast computation. the DFT periodically extends your data. so if this extension places a discontinuity in your waveform, you won't get a pure sine wave out of that. $\endgroup$ – robert bristow-johnson Jan 31 '18 at 7:01
  • $\begingroup$ You have to window (rectangular by default) data to fit it in a finite length FFT. Nothing to do with making up fake extensions that don’t match the real data. The windowed FFT produces convolution artifacts on any data that is not exactly integer periodic within the window of the FFT aperture. $\endgroup$ – hotpaw2 Jan 31 '18 at 7:45
  • $\begingroup$ Is it as 23-kHz sine wave or a 2.3 kHz sine wave? $\endgroup$ – Ben Jan 31 '18 at 14:27
  • $\begingroup$ It doesn't change the nature of my answer any. The frequency becomes 30.7 cycles per frame which is still not an integer. The peaks will be at bin 31 and bin 33. You're still below the Nyquist frequency so your tone will still not be interpreted as an alias. Because you are so close to the Nyquist frequency, the signal will look close to an alternating sequence with the envelope occurring 1.3 times per frame. Because the envelope is two sided, it'll look like 2.7 bumps. $\endgroup$ – Cedron Dawg Jan 31 '18 at 18:17
  • $\begingroup$ Thank you so much Ced, so it seems like i am on the right track luckily. $\endgroup$ – Yihan Hu Jan 31 '18 at 19:44
3
$\begingroup$

Since you used 2.3k twice, I am assuming you meant that with the original 23k value.

Converting your frequency:

$$ 2.3k \frac{cycles}{second} \cdot \frac{ 64 \frac{samples}{frame} }{ 48k \frac{samples}{second} } \approx 3.07 \frac{cycles}{frame}$$

Because this is not an integer value, the peak DFT value will be at bin 3 and there will be values in all the other bins, which is commonly called "leakage". Being a real valued signal, the upper half of the DFT will be a mirror image with complex congjugate values, so there will also be a peak at bin 61 (64-3).

Your 100 sample figure is irrelevant if you are only using 64 of them for the DFT.

Signals have to be a whole number of cycles per frame in order for the DFT not to have leakage. The other answers presume you understand that the DFT is a dirac delta, windowed, convolved version of the continuous FT. This is not an easy way to understand it, but it is how it is usually taught. It also leads to the misconception that the leakage is described by what is known as the sinc function $ \frac{\sin(d)}{d} $. That is not true. The fall off for a complex valued signal is described by what is known as the aliased sinc function $ \frac{\sin(Nd)}{N\sin(d)} $. Another name is "Dirichlet function". A real valued signal is actually the sum of two complex signals, so that function doesn't apply either.

You can find the exact formula for the bin values, the peak and "leakage", in my blog article "DFT Bin Value Formulas for Pure Real Tones".

You can also find a much more intuitive explanation of why leakage occurs in another one of my blog articles "DFT Graphical Interpretation: Centroids of Weighted Roots of Unity".

Hope this helps,

Ced

$\endgroup$
  • $\begingroup$ Ur way of understanding is really helpful. From what I found online, all the explanation look at this problem from a perspective of windowing, convolving, etc, which is really complicated since I only learned about them not long ago. Thank you so much!!! $\endgroup$ – Yihan Hu Jan 31 '18 at 19:52
  • $\begingroup$ @Yihan Hu, I'm glad I could help. I wish you well in your studies. $\endgroup$ – Cedron Dawg Jan 31 '18 at 20:43
-1
$\begingroup$

Short windows require a much higher sample rate. Sample rates only slightly above the Nyquist rate only work for near infinitely long FFTs. Also, there will be windowing artifacts for any data waveforms that are not exactly integer periodic within the FFT aperture.

$\endgroup$
  • 1
    $\begingroup$ Even with the 23k figure, the frame is plenty long enough. Also, it is slightly below the Nyquist frequency. Even slightly above it would still be a long enough frame. How do expect an obvious newbie to understand what "windowing artifacts" mean? $\endgroup$ – Cedron Dawg Jan 31 '18 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.