# Bandwidth visualization in frequency domain

Consider some signal in frequency domain:

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):

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?

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.

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:

• 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$). Commented May 6, 2022 at 20:17
• the understanding of bandwidth definition will allow me correctly calculate frequency domain amplitudes to apply inverse DFT further. Commented May 6, 2022 at 20:20
• @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. Commented May 7, 2022 at 14:08
• &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. Commented May 7, 2022 at 15:02
• @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. Commented May 7, 2022 at 15:59

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".

• 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. Commented May 6, 2022 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$? Commented May 6, 2022 at 20:22
• 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
Commented May 6, 2022 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... Commented May 7, 2022 at 12:35
• 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 $15*2f_s/32 + 2*f_s/32 = 32f_s/32 = f_s$.
– MBaz
Commented May 7, 2022 at 15:25