Using the DFT to determine the component of a signal at a given frequency?

I'm struggling understand the mathematics behind how the component of a sampled continuous signal at a given frequency can be determined. Assume my sampling rate is $$f_s=100$$ for 3 seconds, so $$N=300$$.

If I have a signal vector, $$\vec{x}$$ in $$\mathbb{R}^{300}$$, I know it can be expressed as a linear combination of the columns of the Fourier matrix $$W=\begin{bmatrix} \vec{w}_0 & \vec{w}_1 & \vec{w}_2 & \cdots & \vec{w}_{N-1} \end{bmatrix}$$, whose columns have squared-norms equal to $$N$$:

$$\begin{equation*} \vec{x}=\frac{\vec{x} \bullet \vec{w}_0}{N} \cdot \vec{w}_0+ \frac{\vec{x} \bullet \vec{w}_1}{N} \cdot \vec{w}_1+ \cdots+ \frac{\vec{x} \bullet \vec{w}_{N-1}}{N} \cdot \vec{w}_{N-1}. \end{equation*}$$

Suppose I have a frequency that is a multiple of my frequency resolution, $$f=m\frac{f_s}{N}$$, thus corresponding to bin $$m \leq N-1$$.

1. Does it make sense to speak of the component of a signal at a particular frequency of this form, or is it over a frequency band of width $$\frac{fs}{N}=1/3$$?

2. If the component of my signal at frequency $$f=m\frac{f_s}{N}$$ does make sense, how is it determined? Would it be the sum $$\begin{equation*} \frac{\vec{x} \bullet \vec{w}_m}{N}\vec{w}_m+\frac{\vec{x} \bullet \vec{w}_{N-m}}{N}\vec{w}_{N-m}? \end{equation*}$$ This is real-valued is it not, since the two summands are complex conjugates of one another? Or is it something completely different?

The DFT will tell you the components of very specific frequencies, those being DC, the first harmonic at $$f_s/N$$ where $$f_s$$ is the sampling rate and $$N$$ is the number of bins in the DFT, and every integer harmonic of $$f_s/N$$ up to $$N-1$$, and for this it is equivalent to the Fourier Series Expansion when the time limited waveform used for the DFT is periodically extended to $$\pm \infty$$.

Each frequency tone is not a sinusoid, but rather a complex exponential given in continuous time as $$e^{jk \omega_o t}$$ (where $$\omega_o = 2\pi f_s/N)$$ and $$k$$ is the integer harmonic. We note how complex exponentials are related to sinusoids with Euler's formula for a cosine as:

$$2\cos(\omega t) = e^{j\omega t} + e^{-j \omega t}$$

In the formula for the DFT, we see how we use correlation to determine the complex weight (magnitude and phase) for each of these components. When we correlate signals we complex conjugate multiply the two signals and integrate the products (or is discrete time, accumulate), resulting in stronger values when signals are alike and weaker values when signals are, well, uncorrelated. Thus we can correlate to each of the frequency components mentioned above (each $$e^{k j \omega_o t}$$ for harmonic $$k$$) to determine the DFT. In the DFT we do this specifically:

$$X(k) = \sum_{n=0}^{N-1}x[n]e^{-j2\pi n k/N}$$

So we see here the generic correlation process over an $$N$$ sample waveform given as:

$$XCORR = \sum_{n=0}^{N-1}x[n]y^*[n]$$

Where $$y[n]=e^{j2\pi n k/N}$$; where we index through each $$k$$, starting with $$0$$ (as DC), and $$k=1$$ as the first harmonic given as $$e^{j2\pi n/N}$$ and all higher harmonics up to $$N-1$$. We stated earlier that that first harmonic is $$2\pi f_s/N$$ which was the actual frequency given in $$Hz$$ for the sampling rate $$f_s$$ Hz for the continuous waveform $$e^{j2\pi f_s/N t}$$. If we use units of normalized frequency (by dividing by the sampling rate) to get cycles/sample, the sampling rate $$f_s = 1$$, and time indexes by $$n$$. Thus we get $$e^{j2\pi n/N}$$ as the first harmonic and $$e^{j2\pi n k/N}$$ for all higher harmonics. This is complex conjugate multiplied by our unknown signal $$x[n]$$, which results in for each $$k$$, that weight of that harmonic as part of the signal.

Consider in comparison the same form for continuous time signals as the Fourier Series Expansion which is just a cross-correlation as the integration of a complex conjugate product:

$$c_k = \frac{1}{T}\int_0^T x(t)e^{-jk\omega_o t}dt$$

The Fourier Series Expansion decomposes an arbitrary analytic waveform extending from $$0$$ to $$T$$, and treats it as a periodic waveform over period $$T$$, if $$x(t)$$ as a periodic waveform has no discontinuities at each boundary $$nT$$ for integer $$n$$, meaning the waveform is continuous and analytic across those boundaries, then the result will be exact: each coefficient $$c_k$$ will be the complex weight for each pure complex exponential. The DFT as shown is identical for the sampled process. This hopefully illustrates in response to OP's question 1 how it can indeed be at a particular frequency and not over a frequency band, under these conditions. Under practical conditions, we cannot expect the arbitrary signal to only have integer components at frequencies given by multiples of $$1/T$$, and therefore it will also not be continuous and analytic across the boundaries if the signal extended beyond $$T$$. In this case the weight will represent the frequency content over the entire spectrum, with nulls at the frequencies for every other weight, and having a Sinc response everywhere else (explained as "spectral leakage").

Just like the Fourier Series Expansion for continuous time, we see the same principles in the DFT, as a sampled equivalent. Below shows an example for a simple 4 point DFT, where there are four bins, and each bin is the result of a filter given as a Dirichlet Kernel (aliased Sinc function), in that each bin will respond to a input tone anywhere in the spectrum except when it is on exactly bin center (in which case only that one bin will respond since all the others will be at 0). Below shows the case of a signal that has a frequency midway between bin 1 and bin 2, and on the right we see the resulting DFT (magnitude plot) where each bin will respond as if the signal contained components of the four frequencies.

• This helps immensely. I think you really answered my original questions in your first two paragraphs. The cosine term is then the sum of two frequency tones (complex exponentials). A sine term would necessarily be the difference with an extra j added in? And each term in my inner product expansion corresponds to a frequency tone at a very specific frequency? Jan 16, 2023 at 14:01
• Yes you are correct regarding sine. Ultimately in my own journey to really understand DSP I dropped sines and cosines altogether and learned to visualize everything with rotating phasors, resulting in a much more intuitive view since the real Badis functions are the exponentials. Jan 16, 2023 at 19:24