The discrete Fourier world: sampling, aliasing, the FFT and the uncertainty principle
What changes when signals are sampled and finite. The four Fourier transforms and the rule that links them, Poisson summation and the sampling theorem, aliasing in images and inside neural networks, the DFT and FFT computed by hand in 1-D and 2-D, leakage and windows, the DCT behind JPEG, and a proof that no signal is sharp in both time and frequency. Part 2 of Seeing in frequencies.
Contents
- Notation and conventions
- 1. Four Fourier transforms, one rule
- 2. Sampling
- Poisson summation: sampling one side samples the other
- Sampling makes the spectrum periodic
- The sampling theorem
- What aliasing looks like
- 3. Aliasing inside neural networks
- 4. The DFT, by hand
- Circular convolution
- 5. The 2-D DFT, by hand
- 6. Reading an FFT output
- 7. Leakage and windows
- The bright cross in image spectra
- 8. The FFT
- 9. The DCT, and why JPEG uses it
- 10. The uncertainty principle
- 11. The short-time Fourier transform
- 12. Implementation and caveats
- 13. Where it is used, and what is open
- Self-check
- References
Seeing in frequencies, part 2 of 4. Fourier analysis → the discrete Fourier world → wavelets → wavelets for images.
Keep every fourth pixel of the image on the left, and rings appear that were never there.
The rings in the middle panel are aliases: fine detail that could not survive the subsampling and came back as coarse detail instead. The right panel, blurred before subsampling, has none. This post explains exactly why, and then everything else that changes when the clean integrals of Part 1 meet a computer: signals are sampled, and they are finite.
Almost every bug in spectral code is one of these two facts forgotten. Sampling makes spectra periodic (Section 2), which is aliasing; finiteness makes them leak (Section 7), which is why a pure tone shows up in every bin. Between those two sections the post builds the discrete Fourier transform by hand in one and two dimensions, and then the FFT, the fast algorithm that computes it. It ends with the theorem that limits all of this, the uncertainty principle, and the tool built on it, the spectrogram, which is where wavelets begin.
Notation and conventions
| Symbol | Meaning |
|---|---|
| , | sampling interval and rate |
| samples | |
| discrete-time Fourier transform (DTFT) | |
| number of samples | |
| the DFT’s root of unity | |
| discrete Fourier transform (DFT) | |
| the DFT matrix, | |
| circular convolution |
Frequencies are in cycles per unit (Hz for time, cycles per pixel for images), as in Part 1. The DFT follows NumPy: no factor on the forward transform, on the inverse.
1. Four Fourier transforms, one rule
Part 1 met two transforms: the Fourier series (periodic signals) and the Fourier transform (signals on the whole line). Sampling adds two more, and the four sit on a two-by-two grid.
| Signal in time | Spectrum | Name |
|---|---|---|
| continuous, not periodic | continuous, not periodic | Fourier transform |
| continuous, periodic | discrete | Fourier series |
| discrete, not periodic | continuous, periodic | DTFT |
| discrete, periodic | discrete, periodic | DFT |
One rule organises the table: discrete in one domain if and only if periodic in the other. Part 1 proved half of it already: a periodic signal has a discrete spectrum, the Fourier series. Section 2 proves the other half: a sampled signal has a periodic spectrum. A computer can only hold finitely many numbers in each domain, so it must be discrete in both, hence periodic in both: that is the DFT.
Question 1
“The FFT computes the Fourier transform.” What does it actually compute?
Answer
The DFT of numbers. Read as a statement about a continuous signal, that is the Fourier transform of the signal after three changes: it was sampled (so its spectrum is replaced by the sum of shifted copies, Section 2), cut to samples (so the spectrum is smeared by a sinc, Section 7), and treated as periodic (so the spectrum is read at only frequencies, Section 4). Each change has a visible consequence, and each has a fix.
2. Sampling
Poisson summation: sampling one side samples the other
One identity does most of the work in this post. It relates samples of a function to samples of its transform.
Theorem 1 (Poisson summation)
For a smooth, rapidly decaying ,
Proof
Step 1. Make a periodic function. Let . Because decays fast the sum converges and is smooth, and .
Step 2. Its Fourier coefficients are samples of . (substitute ). Since , this is : the integrals over the unit intervals tile the line.
Step 3. Evaluate the series at . is smooth, so its coefficients decay fast (Part 1, Section 4) and its Fourier series converges to it at every point. At : , that is, .
Step 4. Other spacings. Apply this to , whose transform is by the scaling rule: .
Sampling makes the spectrum periodic
Sample every : . The natural transform of a sequence is the discrete-time Fourier transform, , a function of frequency in Hz. It is periodic with period , since adding to multiplies each term by . What is it, in terms of ?
Proposition 1 (The sampled spectrum is a sum of shifted copies)
Proof
Step 1. Fold the exponential into the function. Let . Then .
Step 2. Its transform is a shift. By the modulation rule, .
Step 3. Poisson summation with spacing : . Relabel .
Sampling every seconds places a copy of the spectrum at every multiple of . If contains no frequencies at or above , the copies sit side by side and the original can be read off the central one. If it does, they overlap, and in the overlap the frequencies of different copies add up and can no longer be separated. That overlap is aliasing.
The sampling theorem
Theorem 2 (Nyquist–Shannon sampling theorem)
If for all , then is determined by its samples, and
The frequency is the Nyquist frequency.
Proof
Step 1. Only one copy is non-zero in the band. For , every copy with is evaluated at a frequency of size at least , where vanishes. So there.
Step 2. Invert over the band. .
Step 3. Insert the samples. Substitute and exchange sum and integral (valid for the nice we assume): .
Step 4. The integral is a sinc. (the box pair of Part 1 with duality). With , .
Checked numerically: , whose spectrum fills Hz, sampled at 14 Hz and rebuilt from 801 samples, matches itself to .
What aliasing looks like
A single cosine makes aliasing concrete. Sampled at rate , the waves and agree at every sample, because . So a frequency is indistinguishable from for every whole , and reconstruction picks the one inside . A 7 Hz wave sampled at 10 Hz produces exactly the samples of a 3 Hz wave (checked to machine precision).
Three things people get wrong about the theorem:
- “Sample at twice the frequency.” At exactly the samples of are , which vanish for a sine. The theorem needs the signal strictly below . Set the figure to , and move the phase.
- “The rate depends on the highest frequency.” It depends on the width of the band. A signal confined to can be sampled at as little as under conditions on where the band sits (bandpass sampling), because the copies can interleave without overlapping. Radio receivers rely on this.
- “Subsampling an image is free.” Keeping every -th pixel is sampling at of the rate, so everything above cycles per pixel aliases. That is the opening figure: the zone plate’s rings have frequency cycles per pixel at radius , so with everything beyond radius folds back. Image libraries blur before shrinking for this reason (
antialias=Truein PyTorch’sinterpolate; PIL’s default resampling filters).
3. Aliasing inside neural networks
A strided convolution or a pooling layer keeps every other sample. Section 2 says what that does to anything above a quarter of the sampling rate: it folds. A consequence that surprised the deep-learning community is that convolutional networks are not shift-invariant: move the input by one pixel and the output of a strided layer changes, often a lot (Azulay and Weiss, 2019). Zhang (2019) applied the textbook fix, blur before subsampling (“BlurPool”), and recovered much of the lost invariance; Karras et al. (2021) built StyleGAN3 around alias-free signal processing to stop textures from sticking to pixel coordinates.
The input is a slow wave plus a texture at cycles per sample. Plain stride-2 subsampling folds the texture into a slow false wave whose size depends on where the samples land: over eight one-sample shifts the output energy varies by 19% (standard deviation over mean). Blurring with first, whose frequency response is , passes the slow wave () and almost erases the texture (): variation 0%. The price is lost detail; the network must decide what it was going to throw away anyway.
4. The DFT, by hand
Now finiteness. Take samples . Their DTFT, in cycles per sample, is , a continuous, 1-periodic function. A computer stores finitely many of its values, and the natural choice is equally spaced ones.
Definition 1 (Discrete Fourier transform)
In matrix form with , .
Proposition 2 (The DFT is invertible, and unitary up to scale)
. Hence , and (Parseval).
Proof
Step 1. An entry of . .
Step 2. A geometric sum. With : if every term is and the sum is . If (both in ), then and the sum is , because .
Step 3. Consequences. gives the inverse formula, and . (Some libraries divide both directions by to make exactly unitary; NumPy’s norm="ortho".)
The inverse formula defines for every integer , and the values repeat with period . So the DFT silently treats your samples as one period of a periodic signal: the bottom-right corner of the map in Section 1.
Example 1 (A 4-point DFT by hand)
With , , so every entry of is one of :
For :
- (the sum: the DC term);
- ;
- ;
- .
, as it must for real input (Part 1, Section 3): index is frequency . NumPy agrees: np.fft.fft([1, 2, 0, -1]) gives [2, 1-3j, 0, 1+3j].
Example 2 (An 8-point box)
. Then for , and . So , for even , and for odd : numerically , , and their conjugates at . This is a sampled sinc, the discrete cousin of Part 1’s box pair. Section 8 computes it again, fast.
Circular convolution
Proposition 3 (The DFT turns circular convolution into multiplication)
With , the DFT of is .
Proof
Step 1. Write it out. .
Step 2. Split the exponent as and swap the sums: .
Step 3. The inner sum is . As runs over , also runs over , and because . What remains is .
The “mod ” is the catch. Multiplying two DFTs computes a convolution that wraps around. Convolve with : the true result is , but with the last value wraps onto the first and you get . The fix is to zero-pad both signals to length at least for lengths and : with the product of DFTs returns exactly.
5. The 2-D DFT, by hand
Images are where the 2-D DFT lives, and courses usually skip from the formula to the picture. Small cases can be done by hand.
Definition 2 (2-D DFT)
For an image (row , column ),
Proposition 4 (Rows, then columns)
The 2-D DFT is a 1-D DFT of every row followed by a 1-D DFT of every column (or the other way round).
Proof
Group the sum: . The bracket, for each row , is the 1-D DFT of that row at frequency ; the outer sum is a 1-D DFT down each column of the result. Because the sums are finite, they can be taken in either order.
Example 3 (Two images by hand)
A image . With , , so every factor is :
Sum, left minus right, top minus bottom, checker. Remember these four; Part 4 shows that, divided by 4, they are exactly one level of the 2-D Haar wavelet transform.
A image of vertical stripes, when is even. The image does not depend on , so the column sum is if and otherwise. Along a row, , which is for even and for odd . So exactly two coefficients survive: (the mean, times 16) and (the stripes: two cycles across each row).
Check these, and any other pattern, below. Click pixels to change the image, click a coefficient to see the factor , , or that each pixel is multiplied by.
Question 2
Which index is the “horizontal frequency”?
Answer
In NumPy’s fft2(x), axis 0 is rows, so the first index counts cycles going down the image (vertical frequency) and counts cycles going across (horizontal frequency). Vertical stripes therefore live at . Because image rows run downward, a spectrum displayed as an image is upside down relative to a mathematics textbook’s plane, where points up. Neither is wrong; say which you use.
6. Reading an FFT output
The DFT returns numbers in an order that confuses everyone once.
- Bin is frequency for , and for : the upper half holds the negative frequencies, because the DFT is periodic in with period .
- Bin (for even ) is the Nyquist frequency, shared by and ; for real input it is real.
fftfreq(N, d=T)returns these frequencies;fftshiftreorders the output so zero is in the middle (in 2-D, both axes).- Real input gives , so half the output is redundant.
rfftreturns only , which is numbers;rfft2on an image returns . - Resolution is : one over the duration of the record. More samples per second raise the Nyquist frequency; a longer record sharpens the frequency spacing.
7. Leakage and windows
Ask an FFT for the spectrum of a pure tone and it usually answers with every bin.
Proposition 5 (A tone between bins leaks into all of them)
For , , with in cycles per record,
If is a whole number this is at and elsewhere. Otherwise it is non-zero at every , and falls off only like .
Proof
Step 1. A geometric sum. when the ratio is not .
Step 2. Factor half-angles. . Applied to the numerator () and the denominator (), the magnitudes of the phase factors are , leaving the ratio of sines.
Step 3. Whole . The numerator vanishes for every integer ; at the sum is simply terms equal to .
Step 4. Decay. For , , so .
Why? The DFT pretends the record repeats. A tone that does not fit a whole number of cycles into the record has a jump where the end meets the start, and Part 1 showed what a jump costs: slowly decaying coefficients. Two numbers measured on : a cosine exactly on bin 10 lights 2 bins (bins 10 and 54, the negative frequency); a cosine at bin 10.5 lights all 64, and its peak drops to of its true height ( dB, the “scalloping loss”).
Windows taper the record to zero at both ends, removing the jump. The Hann window, , is the clearest case: since and multiplying by shifts a DFT by one bin, a windowed spectrum is . The leakage of neighbouring bins has alternating signs, and this combination cancels most of it. The cost is a wider main lobe. Measured on 64 samples with heavy zero-padding:
| Window | Main lobe half-width | Highest side lobe |
|---|---|---|
| none (rectangular) | 1 bin | −13.3 dB |
| Hann | 2 bins | −31.5 dB |
| Blackman | 3 bins | −58.1 dB |
Question 3
Zero-padding a signal before the FFT gives more frequency bins. Does it give more resolution?
Answer
No. Padding samples with zeros to length returns the same DTFT sampled times more densely: a smoother drawing of the same curve. What decides whether two tones can be told apart is the curve itself, whose main lobes are about wide. Measured: two tones bins apart in 64 samples (Hann window) show one peak with padding , and , and two peaks when the record is four times longer. Padding is useful for locating a single peak precisely and for avoiding wrap-around in convolution, not for resolution.
The bright cross in image spectra
The same mechanism explains the bright ”+” through the centre of many image spectra. The 2-D DFT treats the image as a tile of a periodic wallpaper, so wherever the left edge differs from the right (or the top from the bottom) there is a jump along a whole border, and its slowly decaying energy lands on the axes. The standard remedy is to remove the jump without touching the image’s content: Moisan’s periodic plus smooth decomposition writes , where is the smooth function (solving a discrete Laplace equation) that carries the border mismatch, and is periodic. In the DFT, , where is zero except along the four borders, where it holds the difference between opposite edges.

But the cross is not always an artefact. Measuring the average power on the axes against the average power off them, at the same radii (16 to 120 cycles per image): for the Eye, whose borders differ, removing the border jump lowers the excess from 6.2× to 3.6×. For the Portrait it stays at 3.1×, because there the cross comes from genuine horizontal and vertical structure. Do not assume; decompose and compare.
8. The FFT
Computed directly, the DFT costs multiplications. The fast Fourier transform computes exactly the same numbers with about , by noticing that a DFT of even length is two DFTs of half the length.
Proposition 6 (Radix-2 decimation in time)
Let be even, and let and be the -point DFTs of the even-indexed and odd-indexed samples. Then for ,
Proof
Step 1. Split the sum by parity of : .
Step 2. Halve the root of unity. . So the first sum is and the second is .
Step 3. The other half. and are periodic with period , and . Substituting gives .
Proposition 7 (Cost)
If is a power of two, applying the split recursively uses complex multiplications.
Proof
Step 1. Recurrence. One level does two half-size transforms and multiplications by (each product is used twice): , with .
Step 2. Induction. If , then .
For , about a million samples, that is about ten million multiplications instead of a trillion.
Example 4 (The 8-point box, through the butterflies)
Even samples , odd samples : the same, so (a 4-point DFT, by the rule of Section 4). Then with : , matching Section 4. And .
Question 4
Is the FFT a different transform from the DFT?
Answer
No. It is an algorithm that computes the DFT exactly (up to round-off, which grows only like ). Any difference between fft(x) and a direct sum is floating-point error.
How real libraries do it. Production FFTs (FFTW, pocketfft inside NumPy and SciPy, cuFFT on GPUs) are not limited to powers of two. Mixed-radix algorithms split into any factors, and Bluestein’s algorithm turns a prime length into a convolution of power-of-two length, so every costs ; but the constant depends on ‘s factors. Measured with SciPy on my laptop: length took 0.55 ms, the prime took 2.11 ms, and (what scipy.fft.next_fast_len(65537) suggests) took 0.40 ms. Pad to a fast length when you can. FFT convolution beats direct convolution once the kernel is long enough: convolving 16,384 samples, the crossover on the same laptop fell between kernel lengths 64 and 128 (direct 0.15 ms vs FFT 0.18 ms at 64; 0.24 vs 0.17 ms at 128). CNN kernels are tiny, which is why deep-learning libraries mostly convolve directly.
9. The DCT, and why JPEG uses it
Section 7 showed that the DFT’s hidden periodic extension creates jumps at the borders. There is a cleaner way to make a finite signal periodic: reflect it. The mirrored sequence has no jump anywhere, only kinks, and by Part 1 its coefficients decay like instead of .
Proposition 8 (The DCT is the DFT of the mirrored signal)
Let be the length- mirror extension of . Then its DFT is with the DCT-II
Proof
Step 1. Pair each sample with its mirror image. for , so .
Step 2. Simplify the second exponential. .
Step 3. Factor out half a step. .
Measured on a ramp of 64 samples (the worst case for the DFT, since its two ends differ by the full range): coefficient size falls by a factor of about 2.3 to 2.9 each time triples for the DFT, roughly , and by about 9 for the DCT, roughly . The first four DCT coefficients hold 99.8% of the (mean-removed) energy; the first four DFT frequencies hold 86.8%. Energy compaction is the whole point of a compression transform: few large coefficients, many negligible ones.
JPEG applies the 2-D DCT to each block, divides each coefficient by an entry of a quantisation table (large for high frequencies) and rounds. At low quality most high-frequency coefficients round to zero, and since each block is coded alone, the blocks stop agreeing at their borders.

At quality 8 the whole sketch compresses from 65,536 bytes to 1,939, with a peak signal-to-noise ratio of 28.1 dB, and the blocks are plain to see. JPEG 2000 replaced the blocks with a wavelet transform, which is one of the stories of Part 4.
10. The uncertainty principle
Part 1 showed that squeezing a function widens its transform. How far can both be narrow at once? Measure the spread of and of by their standard deviations.
Theorem 3 (Heisenberg–Gabor uncertainty principle)
Let be smooth and decaying with , and let , , where , are the means. Then
with equality exactly for Gaussians , .
Proof
Step 1. Centre both. Replacing by changes neither spread (shift and modulation only move and ), so assume .
Step 2. Integrate by parts. ; the boundary term vanishes because decays.
Step 3. Differentiate . . So .
Step 4. Cauchy–Schwarz. .
Step 5. Plancherel and the derivative rule. , so .
Step 6. Combine. .
Step 7. Equality. Cauchy–Schwarz is tight only when for a constant , and Step 3 is tight only when is real and negative. Solving gives , a Gaussian.
Measured: a Gaussian gives to five digits; gives and gives , both above the bound.
Question 5
Is this about measurement, as in quantum mechanics?
Answer
No. It is a theorem about a function and its Fourier transform, true before anyone measures anything. Quantum mechanics inherits it because a particle’s position and momentum wavefunctions are a Fourier pair. In signal processing it says something equally concrete: a pulse lasting ms (as a standard deviation) cannot have a frequency spread below Hz, whatever the hardware.
The discrete world has its own version, with an elementary proof.
Theorem 4 (Discrete uncertainty principle (Donoho and Stark, 1989))
If is non-zero with non-zero entries and its DFT has non-zero entries, then .
Proof
Step 1. Bound one sample. By the inverse DFT and the triangle inequality, , a sum over the non-zero .
Step 2. Cauchy–Schwarz on that sum. , using Parseval from Section 4.
Step 3. So every sample is small: .
Step 4. Sum over the non-zero samples. ; divide by .
Equality holds for a comb: in , a spike every 4 samples has 4 non-zero entries, and its DFT is again a comb with 4 (checked).
11. The short-time Fourier transform
Part 1 ended with a spectrum that knows what but not when. The obvious fix is to look through a window: multiply by a window centred at time , take the Fourier transform, and slide.
Definition 3 (Short-time Fourier transform and spectrogram)
The spectrogram is .
Proposition 9 (Inversion)
If is real with , then .
Proof
Step 1. For fixed , is the Fourier transform of , so by inversion .
Step 2. Multiply by and integrate over : .
(The discrete version is “overlap-add”: windows that sum to a constant when shifted by the hop, such as Hann at half-overlap, rebuild the signal exactly.)
This is the song of Part 1: a chord of two tones 16 Hz apart, a rising chirp, and a click. A window of samples sees about seconds and separates frequencies about apart, and the product of the two is fixed. Measured with a peak count on the chord’s spectrum: windows of 32, 64 and 128 samples merge the two tones, 256 and 512 resolve them, and the longer the window, the more the click smears. This is the uncertainty principle at work, and no window escapes it. The tiles below show how three transforms divide the time–frequency plane.
A chord wants a long window; a click wants a short one; a chirp wants something in between that changes as it rises. One window for all frequencies is the STFT’s limit. Gabor (1946) chose the Gaussian window, which meets the uncertainty bound with equality, but even the best single window is a compromise. The obvious next step, letting the window shrink as the frequency grows, is the wavelet transform of Part 3.
12. Implementation and caveats
Each trap as symptom, cause and fix:
- False patterns after resizing. Aliasing. Low-pass before subsampling (
antialias=True; a Gaussian with σ ≈ d/2 for a factor d). - A pure tone appears in every bin. Leakage: the record is not a whole number of cycles. Use a window (Hann, Blackman) and accept the wider main lobe.
- A weak tone is invisible next to a strong one. The rectangular window’s side lobes (−13 dB). Use a low-side-lobe window (Blackman, −58 dB; Blackman–Harris, about −92 dB).
- Two close tones merge. The record is too short. Record longer; zero-padding does not help.
- The start of a convolution is wrong. Circular wrap-around. Pad to .
- A bright cross in an image spectrum. Border jumps, or real structure. Use the periodic + smooth decomposition, then compare.
- An FFT that is oddly slow. An awkward length (a prime, say). Pad to
scipy.fft.next_fast_len(n). - Twice the time and memory on real data. A complex FFT of real input. Use
rfft,rfft2. - Features that change when the input moves by a pixel. Strided layers alias. Blur before the stride (BlurPool), or design alias-free.
import numpy as np
from scipy import fft, signal
fs, N = 1000.0, 1000
t = np.arange(N) / fs
x = np.cos(2 * np.pi * 50.5 * t) + 1e-3 * np.cos(2 * np.pi * 80 * t) # a weak tone 60 dB down
X_rect = np.abs(fft.rfft(x)) # no window: leakage buries the weak tone
X_bh = np.abs(fft.rfft(x * signal.windows.blackmanharris(N))) # side lobes near -92 dB: it shows
f = fft.rfftfreq(N, d=1 / fs) # bin frequencies, 1 Hz apart
# measured at 80 Hz: no window, 1.3 dB *below* the neighbouring leakage; Blackman-Harris, 14 dB above it
13. Where it is used, and what is open
| Use the discrete Fourier toolkit when | Be careful when |
|---|---|
| filtering or convolving long signals, images or volumes | the signal is not periodic and you have not windowed or mirrored |
| measuring periodicities, vibrations, spectra | the record is short relative to the frequencies you need to separate |
| resampling, after a proper low-pass | you subsample without one |
| compressing smooth data (DCT) | the data has many edges (blocks; Part 4 does better) |
In current work. Anti-aliased and alias-free networks (BlurPool, StyleGAN3, alias-free U-Nets and neural operators); FFT-based global filtering and long convolutions in vision and sequence models; spectrograms and learned filterbanks as inputs to audio models; compressed sensing and accelerated MRI, which sample below the Nyquist rate and recover the rest from a prior; non-uniform FFTs for radio astronomy, MRI with spiral trajectories, and point-cloud learning.
Open questions.
- Alias-free at low cost. Exact shift-equivariance needs ideal low-pass filters, and every nonlinearity creates new high frequencies that must be filtered again (Karras et al., 2021). What is the cheapest architecture with a provable bound on aliasing?
- Sampling below Nyquist with learned priors. Compressed sensing has sharp guarantees for sparse signals (Candès, Romberg and Tao, 2006); with generative priors (Bora et al., 2017) the guarantees are partial. When do they hold, and how should failure be detected?
- Irregular samples. Point clouds, sensor networks and unstructured meshes are not on grids. Fast, accurate and differentiable transforms exist (the non-uniform FFT), but how best to build learning layers on them is unsettled.
- Learned versus fixed front ends. Learnable filterbanks sometimes beat fixed spectrograms and sometimes do not. Which properties of a fixed transform (stability, invertibility, the uncertainty trade-off) should a learned one be forced to keep?
Note (Shoulders to stand on)
- Brad Osgood, Lecture Notes for EE 261: The Fourier Transform and its Applications (Stanford). Sampling, the Dirac comb and Poisson summation, done carefully and kindly.
- Antonio Torralba, Phillip Isola, William Freeman, Foundations of Computer Vision, ch. 20–21 (MIT Press, 2024). Sampling, aliasing and resizing, taught on images.
Self-check
Question 6
A 60 Hz mains hum is recorded at 100 samples per second. At what frequency does it appear?
Answer
: it appears at 40 Hz (Section 2), a frequency nobody played.
Question 7
You convolve a signal of length 1000 with a filter of length 100 using FFTs. What is the smallest transform length that gives the linear convolution, and what would you actually use?
Answer
At least , or the result wraps around (Section 4). In practice a fast length at or above it: scipy.fft.next_fast_len(1099) returns 1100.
Question 8
You zero-pad 64 samples to 1024 before the FFT. What improves, and what does not?
Answer
The spectrum is drawn on a 16 times finer grid, so a single peak can be located more precisely and the plot looks smooth. The ability to separate two close frequencies does not change; it is set by the 64-sample record (Section 7).
Question 9
Prove that the DFT of a real signal satisfies .
Answer
because . Since is real and , this is .
Question 10
A Gaussian pulse has a time spread ms. What is the smallest possible frequency spread, and which pulses reach it?
Answer
Hz; only Gaussians (possibly shifted and modulated) reach it (Section 10).
Question 11
Why does a JPEG at low quality show blocks, and why can the DCT not be blamed?
Answer
The DCT is invertible: on its own it loses nothing. The loss is in rounding the coefficients, which JPEG does independently in every block, so neighbouring blocks no longer agree along their shared edges (Section 9).
References
- C. E. Shannon. Communication in the presence of noise. Proceedings of the IRE 37(1), 1949.
- J. W. Cooley, J. W. Tukey. An algorithm for the machine calculation of complex Fourier series. Mathematics of Computation 19, 1965.
- F. J. Harris. On the use of windows for harmonic analysis with the discrete Fourier transform. Proceedings of the IEEE 66(1), 1978.
- L. Moisan. Periodic plus smooth image decomposition. Journal of Mathematical Imaging and Vision 39(2), 2011.
- G. K. Wallace. The JPEG still picture compression standard. Communications of the ACM 34(4), 1991.
- D. Gabor. Theory of communication. Journal of the IEE 93, 1946.
- D. L. Donoho, P. B. Stark. Uncertainty principles and signal recovery. SIAM Journal on Applied Mathematics 49(3), 1989.
- A. Azulay, Y. Weiss. Why do deep convolutional networks generalize so poorly to small image transformations? JMLR 20, 2019.
- R. Zhang. Making convolutional networks shift-invariant again. ICML, 2019.
- T. Karras et al. Alias-free generative adversarial networks. NeurIPS, 2021.
- E. J. Candès, J. Romberg, T. Tao. Robust uncertainty principles: exact signal reconstruction from highly incomplete frequency information. IEEE Transactions on Information Theory 52(2), 2006.
- A. Bora, A. Jalal, E. Price, A. G. Dimakis. Compressed sensing using generative models. ICML, 2017.
- M. Frigo, S. G. Johnson. The design and implementation of FFTW3. Proceedings of the IEEE 93(2), 2005.
- A. Torralba, P. Isola, W. T. Freeman. Foundations of Computer Vision. MIT Press, 2024.
Was this useful?
Thanks, that helps me decide what to write next.