I'm reading a book about dsp and doing some exercises. Here is question that confused me:

A peak appears at index number 19 when a 256 point DFT is taken of a signal

1) What is the frequency of the peak expressed as a fraction of the sampling rate? Do we need to know the actual sampling rate to answer this question?

2) What is the sampling rate if the peak corresponds to 21.5 kHz in analog signal?

My answers:

1) 19/256; no we don't need to know actual sampling rate

2) I think that we can't answer this question without additional info. Or maybe it is ((21.5/19)*256)*2 kHz?

Thanks in advance


The actual frequency in Hertz corresponding to DFT index $i$ with a DFT length of $N$ is

$$f=\frac{i}{N}f_s,\quad i=0,1,\ldots N-1\tag{1}$$

where $f_s$ is the sampling frequency. So if indices are numbered starting from $0$ (and index number $19$ is indeed the $20^{th}$ frequency bin, as assumed in (1)), then your answer is correct.

As for part 2 of the question, the answer is also given by (1), so


which gives $f_s=289.7\text{ kHz}$ for the given values of $i$, $N$, and $f$.

  • $\begingroup$ Thank you! One more question: I think that 289.7 kHz is the max frequency, but sampling rate should be 2* 289.7. Am I right? $\endgroup$ – Sharov Jul 9 '14 at 10:53
  • $\begingroup$ @Sharov: No, we do not know anything about the maximum frequency of the analog signal. The sampling frequency is simply given by the fact that for $N=256$ we have a frequency of 21.5 kHz at bin 19. $\endgroup$ – Matt L. Jul 9 '14 at 10:58
  • $\begingroup$ Matt, you might need to consider the latter half of the $N$ bins in the DFT. for $i>\frac{N}{2}$, is the frequency (of a real signal) at index $i$ equal to $f=\frac{i}{N} f_s$? or is it at$f=\frac{i-N}{N} f_s$? $\endgroup$ – robert bristow-johnson Jul 9 '14 at 22:42
  • $\begingroup$ @robertbristow-johnson: Thanks for you comment. Let me first say - to avoid confusion of the OP -, that this has no bearing on the given solution because the index we're interested in is of course $<N/2$. Furthermore, the question boils down to what we mean by $f$. Do we mean the frequency of a continuous-time signal before sampling? In this case 'your' $f$ and 'my' $f$ are indistinguishable due to aliasing. So we're both right :) Also note that your point would be as relevant for complex signals, because also they must satisfy the sampling theorem. $\endgroup$ – Matt L. Jul 10 '14 at 9: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.