Spectral leakage can cause engineering design issues when designing any system or instrument which uses channels to carry data (in the communication sense). I went over these issues in SPECTRAL LEAKAGE I, and here I will derive some constraints that we have between channel frequencies, sampling rate, and Nyquist, given that we want no spectral leakage in the Fourier domain channels themselves.

There are ways to mitigate spectral leakage when we reconstruct our data from the channel(s), but this makes writing the reconstruction code more difficult, more bug prone, etc. These techniques are beyond the scope of this entry, but may be discussed in detail in another post.



Suppose that we denote our sampling rate $$f_s = n_s \frac{1}{s}, \:n_s \in \mathbb{N},$$ i.e., $n_s$ evenly spaced samples per second, where $n_s$ is an integer. Now suppose that we also have defined an ordered list of channel frequencies, $$\nu_0 \leq \nu_1 \leq \cdots \leq \nu_k \leq \frac{f_s}{2},$$ where the last frequency is necessarily less than or equal to the Nyquist frequency (caveat : when sampling at Nyquist there exist functions which cannot be reconstructed, the Nyquist condition is strictly less than, but we typically may use the equality in engineering applications). Given these assumptions, we now want to find the minimum window length which encloses an integer number of sampled periods, for each frequency. Some additional insight and graphs of what is happening in the temporal domain is discussed at GaussianWaves.

The solution


The sample increment is $$\Delta t = \frac{1}{f_s},$$ so we need to find $m$ such that $$f_0(0) = f_0(m\Delta t)\\f_1(0) = f_1(m\Delta t)\\\vdots\\f_k(0) = f_k(m\Delta t)$$ simultaneously, where $f_j(t) = \cos 2\pi(\nu_j t)$ or $f_j(t) = \sin 2\pi(\nu_j t)$. This implies that for an arbitrary $j$, $$ 1 = \cos 2\pi(\nu_j m \Delta t)\quad \text{or}\quad 0 = \sin 2\pi(\nu_j m \Delta t)$$ which then leads to the fact $$ \nu_j m \Delta t = l_j,\:\: l_j\in\mathbb{N}\\\implies m = \frac{l_j}{\nu_j\Delta t},\forall j\\\implies \boxed{m = \frac{l_j f_s}{\nu_j},\forall j} $$

This last equation ($\forall$ means for all) reveals a key piece of information; $f_s/\nu_j$ must be a rational number.

The boxed equation above can then be rearranged to solve for $l_j$, $$l_j=\frac{m\nu_j}{f_s}$$since $m$ is fixed and both $\nu_j$ and $f_s$ can be specified as in the previous post, for example $$\cos 2\pi(3.75t) + \cos2\pi(7.5t) + \cos2\pi(11.25t) + \cos2\pi(15t),$$ sampled at 30fps.

For our example, we have the following set of equations $$\begin{align}l_0 &=  \frac{3.75m}{30}=\frac{m}{8}\\\\l_1 &=  \frac{7.5m}{30}=\frac{m}{4}\\\\l_2 &=  \frac{11.25m}{30}=\frac{3m}{8}\\\\l_3 &= \frac{15m}{8} = \frac{m}{2}.\end{align}$$ By inspection we can see that $m \geq 8$, then plugging in $m=8$ does in fact seem to satisfy all of the equations, resulting in $l_0=1,l_1=2,l_2=3,l_3=4$.  For this example, the smallest window is 8 samples.

8 should not be used, however, because in this case there is not enough “distance” between the respective $\delta$-functions in the Fourier domain, so at least 16 samples should be used (any multiple of 8 will work for this specific example).

To summarize, a spectral leakage free channel construction requires:

$$\boxed{m = \frac{l_j f_s}{\nu_j},\forall j},$$ where $m$ is the minimum number of samples, $f_s$ is the sampling rate, $\nu_j$ is each of the channel frequencies, $l_j$ corresponds to the number of periods in the window for each respective $\nu_j$, and finally $f_s/\nu_j$ must be rational. Notice that, typically $f_s$ is fixed, which implies that there can never be an irrational ratio between any of the channel frequencies if we want the channels to remain free of spectral leakage.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.