0

Consider some signal in frequency domain: enter image description here

the maximum length of which corresponds to the half of the original signal ($N/2$), here $N=32$. It is known that the bandwidth of each sample is $2/N$, so in this case I'll have the bandwidth of $1/16=0.0625$ for all samples except first and the last for which the bandwidth is $1/32 = 0.03125$.

I'm a bit confused about such definition of bandwidth, because if I plot it (for example for the second sample): enter image description here

I get some strange visualization. For me it is clear that the total bandwidth should be equal to the sum of all the badwidths for all the samples.

What's wrong in my interpretation of bandwidth on the second plot or maybe I found incorrect definition of bandwidth?

Curious
  • 355
  • 1
  • 11

2 Answers2

1

The length of the DFT is equal to the length of the time samples used ($N$ samples in time results in $N$ samples in frequency), and this frequency corresponds the the frequency range from $f=0$ to $f=f_s$ where $f_s$ is the sampling rate (specifically one sample less than what would land exactly on $f_s$, or equivalently due to the periodicity in the frequency domain, the frequency range from $-f_s/2$ to $+f_s/2$. Thus the bandwidth of each bin in a DFT (that hasn't been further windowed) is $f_s/N$ which is one bin wide. This bandwidth applies to each bin equally.

frequency periodicity

When the time domain waveform is real, then the frequency spectrum is complex conjugate symmetric about $f=0$, and therefore we can choose to show only half the number of samples-- for example we can just show the samples corresponding to the frequency range from $f=0$ to $f=f_s/2$.

The actual frequency response for each bin extends over the whole frequency range given as the "Dirichlet Kernel" which is an aliased Sinc function. The equivalent noise bandwidth (or frequency resolution) of this response is 1 bin wide. The equivalent noise bandwidth is the bandwidth of a brickwall filter that would have the same output power as one bin in the DFT assuming a white noise source. In the graphic below this is demonstrated with the simple case of a 4 point DFT:

Frequency resolution

Dan Boschen
  • 50,942
  • 2
  • 57
  • 135
  • I thought that $f_s/N$ is the center of the bin (just a point, not bandwidth); I'm a bit confused of bandwidth definition, because here it looks that $f_s/N$ is just a point ($f_s=1$). – Curious May 06 '22 at 20:17
  • the understanding of bandwidth definition will allow me correctly calculate frequency domain amplitudes to apply inverse DFT further. – Curious May 06 '22 at 20:20
  • @Curious onsider an actual frequency that is not right at bin center— it shows up in all the other bins according to each bins frequency response. – Dan Boschen May 07 '22 at 00:41
  • @Curious this link may help as well if you read the section “filter bank view of the DFT”: https://dsp.stackexchange.com/a/32086/21048 – Dan Boschen May 07 '22 at 10:23
  • thank you for the link! for now, I'm reading this chapter and trying to interpret the data on Figure 8-7, it looks that here the bandwidth is not just $f_s$ it is $2f_s$ and I'm wondering why... – Curious May 07 '22 at 12:33
  • 1
    @Curious well the last diagram given in that link isn’t even consistent with the sample number on that index. However he may be defining bandwidth as the “null to null bandwidth” of the main lobe (see my last plot above) however this isn’t what is typically defined as bandwidth. Further the example given in the link (and most of that book) is limited to real waveforms only. There is no difference in the bandwidth of the first and last bins compared to any others. – Dan Boschen May 07 '22 at 14:08
  • sure, that is exactly what I was confused about: in your answer you clearly define the bandwidth as 1 bin, however such definition as in the book is consistent with standard Python function np.fft.fft() even for the first and last bins, that's why it caused even more confusion... – Curious May 07 '22 at 14:21
  • @Curious what is consistent about the Python function? The Python function is consistent with what I wrote; what are you referring to that would be otherwise? – Dan Boschen May 07 '22 at 14:30
  • let me explain the full "story" in this case)) I'm trying to output the frequency spectrum using np.fft.fft() corresponding to the time-domain amplitudes, I found that if I divide the result of this function by $N/2$ (or multiply by $2/N$) and also divide the first and last samples by $N$ (as in the book!), I'll get the desired result - amplitudes in frequency domain will unambiguously correspond to amplitudes in time-domain, but why I should divide by $N/2$ - this is the main question for me – Curious May 07 '22 at 14:49
  • 1
    &Curious If you use all the N bins you would divide by N and each sinusoidal tone will occupy two bins (if at bin center) each with a magnitude of 1/2 (consistent with Euler’s formula and the FT of a sinusoid. If it is real then the negative frequencies are redundant so you can just use the positive frequencies and multiply each of those tones by 2 (except DC since the FT of DC is a single impulse unlike the sinusoids). This is not the bandwidth of each bin but the scaling factor. – Dan Boschen May 07 '22 at 15:02
  • ok, multiplying by factor of 2 is clear (as you mentioned according to the Euler formula), but why should I divide output result by N? – Curious May 07 '22 at 15:11
  • 1
    @Curious Look at the DFT formula, and then consider the simplest case of the DFT of N ones—- you’ll see that bin 0 is the sum of the N samples and thus the DFT grows by N. All bins grow by N and as you see the sinusoids will result in two bins each being N/2. – Dan Boschen May 07 '22 at 15:59
  • this makes sense, thank you!) but I still confused about bandwidth definition I found, why it is possible to substitute the whole sequence by just $N/2$ samples with the bandwidth $2f_s/N$ for all samples except first and last with bandwidth $f_s/N$ - big mystery for me... – Curious May 07 '22 at 18:08
  • @Curious right- doesn’t make sense to me either: 2f_s/N is a scaling of magnitude not bandwidth – Dan Boschen May 07 '22 at 23:25
1

As a complement to Dan's answer: don't think in terms of the bandwidth per sample; this concept makes no sense.

I recommend studying the discrete-time Fourier transform (DTFT) before the DFT. If you do so, you'll see that a discrete-time signal sampled at frequency $f_s$ has a continuous, periodic spectrum, and we can think of one period as the spectrum between $-f_s/2$ to $f_s/2$.

Even though the signal's bandwidth is infinite, it is customary to say that its bandwidth is (at most) $f_s/2$, since the spectrum beyond this frequency is redundant.

The DFT calculates $N$ samples of this continuous spectrum, where $N$ is the length of the discrete-time signal (assuming $N<\infty$). This means that the range from $-f_s/2$ to $f_s/2$ is divided into $N$ "frequency bins". Each DFT sample is a representative spectral amplitude for the signal within that bin. The width of each bin multiplied by $N$ is equal to $f_s$ -- which I think is what you were trying to think of as "bandwidth per sample".

MBaz
  • 15,314
  • 9
  • 30
  • 44
  • bandwidth per sample - it is exactly what I needed! Why did I ask this question - because I'm trying to compare time domain signal amplitude and frequency domain signal amplitude, I use Python function np.fft.fft for calculating DFT and it calculates spectral density instead of sine/cosine amplitudes; dividing each sample (except first and last) by $N/2$ gives "correct" sine/cosine amplitudes for calculating inverse DFT. – Curious May 06 '22 at 20:09
  • I thought that $f_s/N$ is the center of the bin not a bandwidth; if $f_s/N$ is bandwidth, where is the center of the bin? $f_s/2N$? – Curious May 06 '22 at 20:22
  • 1
    Maybe this analogy will help. A signal is sampled 10 times, once per second, i.e. at times $0,1,2,3,\ldots,9$. Each sample can be thought of as "representative" of the signal during a time interval with duration one second, right?. In the DFT, each sample is "representative" of the actual spectrum, in a frequency interval with width $f_s/N$. – MBaz May 06 '22 at 21:03
  • that's clear now, thank you for explanation!) but here the author states that the bandwidth is $2f_s$, and I have no idea why... – Curious May 07 '22 at 12:35
  • It's still $f_s$. He's only considering bins from 0 to $f_s/2$. – MBaz May 07 '22 at 14:55
  • but how could it be? in the text he considers "32-point signal", so the first dashed line corresponds to $1/N$, where $N=32$ otherwise the signal will have different sampling... – Curious May 07 '22 at 15:06
  • 1
    He's assuming that the signal is real; 15 DFT samples are redundant, leaving 17 samples. These 17 samples define 17 bins. 15 of the bins have width $2f_s/32=f_s/16$ and the other two have width $f_s/32$. The total bandwidth is $152f_s/32 + 2f_s/32 = 32f_s/32 = f_s$. – MBaz May 07 '22 at 15:25
  • A two-sided analysis gives the same result: 32 bins, each of width $f_s/32$, gives a total bandwidth $f_s$. – MBaz May 07 '22 at 15:27
  • ok, but in this case 15 bins will have bandwidth $2f_s/32=f_s/16$, isn't it? is it correct? – Curious May 07 '22 at 15:52