Physics · Article
Sampling, digitization, aliasing, and the Nyquist limit
Separate discrete recording times from finite amplitude codes, derive an exact alias, and check the conditions behind sampling and quantization limits.
Previous article: Sensors, transducers, and measurement chains
Back to PhysicsAfter reading, you can
- Distinguish uniform sampling in time, quantization of amplitude and encoding of a level.
- Calculate sample instants and counts with an explicit endpoint convention.
- Show why two different continuous voltage signals can have identical uniform samples.
- Distinguish a signal's Nyquist rate from a sampling system's Nyquist frequency.
- Apply a strict ideal bandlimited sampling condition and examine a phase-dependent boundary case.
- Use a fully specified finite quantizer, including midpoint ties, clipping and the domain of its half-step error bound.
Separate time, amplitude and code
Let x(t) be the voltage at an identified input terminal relative to a fixed electrical reference, with time t in seconds. Sampling selects values at stated times. A sequence x[n] can still have continuously valued amplitudes; selecting discrete times alone does not assign a finite set of voltage levels.
Quantization maps an amplitude to one of a limited set of representative values. Encoding then assigns each selected level a symbol or code word. A binary word identifies a level through a stated mapping; the word is not itself a voltage.
The examples below assume an exact clock, instantaneous samples and the supplied ideal voltage functions. They separately add a deterministic quantizer. No sensor noise, clock jitter, acquisition interval, real converter specification or measurement accuracy is supplied. These assumptions let us identify which loss of distinction belongs to timing and which belongs to amplitude representation.
Specify the uniform clock and window
With time origin t = 0, define uniform sample instants t_n = n Δt = n/f_s, where n is an integer, f_s is the sampling rate in samples per second, and Δt = 1/f_s is the interval in seconds. Define x[n] = x(t_n). The index n counts samples; it is not a time in seconds. For f_s = 20 samples/s, Δt = 0.05 s.
Record only 0 ≤ t < 0.5 s in this original finite example. The included indices are n = 0 through 9: ten samples, with the last at 0.45 s. Including the right endpoint t = 0.5 s instead would add n = 10 and give eleven samples. The endpoints belong in a sample-count calculation; the elapsed time from the first included instant to the last is 0.45 s, not 0.5 s.
A sinusoid (1 V) cos[2π f t] has signal frequency f in cycles per second, or Hz. At the uniform instants it becomes (1 V) cos[2π(f/f_s)n]. The product f t and the ratio f/f_s are dimensionless; the cosine's phase is in radians. A sampling rate is not an angular frequency: the corresponding angular sampling frequency is 2π f_s in radians per second.
Derive an exact frequency alias
Use two original ideal inputs, defined for all real t: x_2(t) = (1 V) cos[2π(2 Hz)t] and x_18(t) = (1 V) cos[2π(18 Hz)t]. At t_n = n/(20 samples/s), their phases are 2π n/10 and 2π n − 2π n/10. Since n is an integer and cosine is even and 2π-periodic, x_18[n] = x_2[n] for every integer n. This is aliasing: different continuous signals give the same sample sequence.
For example, at the unsampled instant t = 0.025 s, x_2 is approximately +0.951057 V and x_18 is approximately −0.951057 V. Their continuous inputs differ, even though every sample on the supplied clock agrees. The table gives selected shared samples; decimal values are rounded displays of the exact cosine values, not additional measurements.
More generally, adding any integer multiple k f_s to a cosine frequency preserves these zero-origin samples: cos[2π(f + k f_s)n/f_s] = cos[2π f n/f_s]. A frequency reflected to f_s − f also gives the same zero-phase cosine samples. Thus the sequence alone cannot choose the 2 Hz input over the 18 Hz input. Applying the same deterministic quantizer to identical samples cannot distinguish them either.
Derive an exact frequency alias
| Sample index n | Instant t_n | x_2[n] | x_18[n] |
|---|---|---|---|
| 0 | 0 s | 1 V | 1 V |
| 1 | 0.05 s | ≈ 0.809017 V | ≈ 0.809017 V |
| 2 | 0.10 s | ≈ 0.309017 V | ≈ 0.309017 V |
| 5 | 0.25 s | −1 V | −1 V |
State the bandlimit and strict rate
The ideal low-pass sampling theorem supplies a restriction that makes reconstruction possible. In the usual Fourier reconstruction setting, assume a continuous bandlimited signal with no frequency content outside −B to +B, exact uniform sample values for every integer n, and f_s > 2B. The signal is then determined by the entire sample sequence. Here B is the maximum absolute signal frequency, not the width 2B of that interval.
Keep two names separate. The signal's Nyquist rate is 2B; it depends on the admitted signal class. The clock's Nyquist frequency is f_s/2; it depends on the chosen sampling rate. For a supplied B = 7 Hz and f_s = 20 samples/s, these values are 14 samples/s and 10 Hz respectively, and 20 > 14. A 10 samples/s clock does not guarantee reconstruction of every signal in that B = 7 Hz class.
The theorem uses ideal values over the whole sequence, not just ten quantized readings from a short record. A finite record or finite amplitude codes require additional analysis; satisfying the frequency inequality alone is not proof that an actual instrument has preserved every relevant quantity.
Test the boundary and filter before sampling
Equality requires care when the admitted signals include a tone at the boundary with unknown phase. At f_s = 14 samples/s, the ideal input z(t) = (1 V) sin[2π(7 Hz)t] gives z[n] = (1 V) sin(π n) = 0 V at every integer n. The zero input gives the same samples. By contrast, the 7 Hz cosine has alternating +1 V and −1 V samples. A blanket promise that equality always preserves an unknown-phase boundary tone would miss this distinction.
In fact, a boundary input A cos[2π(f_s/2)t + φ], with A a voltage amplitude and φ a phase in radians, has samples A(−1)^n cos φ. The samples determine that product, not both A and φ separately. We use the strict condition for the stated signal class rather than treating exactly two samples per cycle as an unconditional reconstruction rule.
An anti-alias filter acts before sampling to reduce frequencies outside the intended band; the Waseda conversion notes place pre-filtering before sampling. If an ideal supplied filter retains the 2 Hz component and removes the 18 Hz component, the sampled signal belongs to a different, restricted class. It does not retain all information about the unfiltered input. A later operation on the already identical 2 Hz and 18 Hz sample sequences cannot select their original source without additional information.
Define a finite voltage quantizer
For a separate original amplitude model, supply eight levels with nominal input interval −1 V ≤ u ≤ 1 V and spacing Δ = 0.25 V. The representative voltage for level index k is q_k = −1 V + (k + 1/2)Δ, for k = 0 through 7. Thus the representatives range from −0.875 V to +0.875 V. Uniform level spacing is the defining feature relevant here.
Define the mapping for every real voltage u by k(u) = min(7, max(0, floor[(u + 1 V)/Δ])) and Q(u) = q_{k(u)}. The floor function takes the greatest integer no larger than its dimensionless argument. At an interior midpoint between representatives, choose the higher-voltage representative. At the nominal endpoints use the outer representative; beyond the nominal interval the same outer level is retained. This formula specifies the ties and clipping as well as the interior cells.
Encode k in three binary digits: 0 → 000 through 7 → 111, with leading zeros retained. Decoding that word returns q_k through the supplied voltage mapping. For u = 0.31 V, k = 5, word 101 and Q(u) = 0.375 V. At the tie u = 0.50 V, k = 6, word 110 and Q(u) = 0.625 V. Increasing the number of available words changes amplitude representation; it does not change the sampling times.
| Input u | Index k | Three-bit word | Representative Q(u) | Signed error e |
|---|---|---|---|---|
| −0.62 V | 1 | 001 | −0.625 V | −0.005 V |
| 0.31 V | 5 | 101 | 0.375 V | +0.065 V |
| 0.50 V | 6 | 110 | 0.625 V | +0.125 V |
| 0.74 V | 6 | 110 | 0.625 V | −0.115 V |
| 1.10 V | 7 | 111 | 0.875 V | −0.225 V |
Bound only the specified quantization error
Within −1 V ≤ u ≤ 1 V, each selected representative lies at the center of its 0.25 V cell. Therefore the supplied mapping satisfies |Q(u) − u| ≤ Δ/2 = 0.125 V throughout that interval, including its endpoints and assigned midpoint ties. This is a worst-case bound for a deterministic model. It does not assert a random error distribution, independence of errors or a standard uncertainty.
Outside the nominal interval, the half-step guarantee fails. The clipped input 1.10 V gives Q = 0.875 V and e = −0.225 V, whose magnitude exceeds 0.125 V. The same finite word 111 can represent an in-range input or a larger clipped input. Without a separately specified overload indicator or other information, that word alone does not diagnose which occurred.
Different in-range inputs can also share one level: 0.31 V and 0.36 V both become 0.375 V and word 101. More amplitude levels can reduce this particular model's cell width, but finite words do not preserve every real input amplitude. A half-step quantization bound does not cover sensor error, loading, imperfect reference voltages or uncertain times, and does not establish the accuracy of a complete measurement.
Record the model and preserve its scope
Keep the clock origin and rate, record endpoints, input units and electrical reference, intended signal band, pre-filter behavior, representative levels, code mapping, ties and clipping rules with the data. Ten of our three-bit words require 30 payload bits; including the eleventh sample requires 33. Those counts exclude timing metadata, headers and any other storage overhead.
Treat timing and amplitude conditions separately. Increasing bit depth cannot distinguish continuous inputs that already have identical samples. Increasing the sampling rate does not by itself prevent voltage clipping. In practice, pre-filtering has finite attenuation and a transition region, and samples are acquired and represented imperfectly; a chosen rate needs to be assessed with the actual chain and the intended measurement.
The supplied models give exact timing, aliasing and quantizer calculations. They do not assess a real converter or reconstruct an arbitrary signal from a short finite record. The next subject, Noise, signal-to-noise ratio, and filtering, examines how unwanted contributions and specified filtering affect signal interpretation; the distinctions established here remain part of that analysis.
Worked examples
Count samples and prove the alias
Use the exact clock t_n = n/20 seconds and record 0 ≤ t < 0.5 s. Compare x_2(t) = (1 V) cos[2π(2 Hz)t] with x_18(t) = (1 V) cos[2π(18 Hz)t]. Count the samples and determine whether their values can identify which continuous input was present.
- The interval is Δt = 1/(20 samples/s) = 0.05 s. The admitted integer indices are 0 through 9, so there are ten samples and the last is at 0.45 s.
- For the 2 Hz input, substitution gives x_2[n] = (1 V) cos(2π n/10).
- For the 18 Hz input, substitution gives x_18[n] = (1 V) cos(2π n − 2π n/10). Periodicity removes 2π n and cosine's evenness removes the remaining minus sign.
- Thus x_18[n] = x_2[n] for every integer n, including all ten recorded values. Increasing the duration on this same exact clock would still leave these two inputs indistinguishable.
- Check an instant outside the clock grid: at 0.025 s the phases are π/10 and 9π/10. Their cosines have opposite signs, giving approximately +0.951057 V and −0.951057 V. Identical samples have not made the continuous signals identical.
There are ten samples. Their values cannot distinguish the supplied 2 Hz and 18 Hz inputs: the two signals alias exactly on this clock, despite differing between its instants.
Apply the strict rate and test equality
A supplied ideal low-pass signal class has no frequency content outside ±7 Hz. Compare 20 samples/s with 10 samples/s under the strict sampling condition. Then test the boundary clock 14 samples/s on z(t) = (1 V) sin[2π(7 Hz)t], assuming zero clock origin and exact values for every integer sample index.
- The admitted maximum absolute frequency is B = 7 Hz, so the signal class's Nyquist rate is 2B = 14 samples/s.
- For 20 samples/s, the clock's Nyquist frequency is 10 Hz. Since 20 > 14, the strict ideal condition is satisfied for the stated class and complete exact sequence.
- For 10 samples/s, the clock's Nyquist frequency is 5 Hz, below 7 Hz. This clock does not guarantee reconstruction throughout the supplied class. A zero-phase 7 Hz cosine aliases a 3 Hz cosine because 7 = 10 − 3.
- At 14 samples/s, the boundary sine has phase 2π(7/14)n = π n. Every sample equals 0 V, just as for the zero input.
- A 7 Hz cosine on that boundary clock instead gives (1 V)(−1)^n. The phase-dependent difference shows why equality is not an unconditional guarantee for the admitted unknown-phase boundary tones. Neither computation changes the theorem's ideal whole-sequence assumptions.
20 samples/s satisfies the supplied strict ideal condition; 10 samples/s does not guarantee that class's reconstruction. At 14 samples/s, the boundary sine is indistinguishable from zero, so equality alone cannot guarantee preservation of an unknown-phase edge tone.
Quantize with ties and clipping
Use Δ = 0.25 V, q_k = −1 V + (k + 1/2)Δ and k(u) = min(7, max(0, floor[(u + 1 V)/Δ])). Encode k in three bits and define e = Q(u) − u. Evaluate u = 0.31 V, 0.50 V and 1.10 V, then test the in-range half-step bound.
- For 0.31 V, (u + 1 V)/Δ = 5.24. Its floor is 5, so the word is 101 and q_5 = −1 V + 5.5(0.25 V) = 0.375 V.
- The first signed error is 0.375 V − 0.31 V = +0.065 V, with magnitude below 0.125 V.
- For 0.50 V, the dimensionless ratio is exactly 6. The specified midpoint rule selects k = 6, word 110 and Q = 0.625 V. The signed error is +0.125 V, exactly the permitted in-range bound.
- For 1.10 V, the ratio is 8.4 and its floor is 8. The finite-index limit changes it to k = 7, word 111 and Q = 0.875 V. The signed error is −0.225 V.
- The first two inputs are in the nominal −1–1 V interval and satisfy |e| ≤ Δ/2. The last input is outside it and violates that bound. The finite word remains valid as a code even though the amplitude is clipped.
The words are 101, 110 and 111; representatives are 0.375 V, 0.625 V and 0.875 V; signed errors are +0.065 V, +0.125 V and −0.225 V. The half-step guarantee applies to the stated in-range model, not to the clipped input.
Try it yourself
On the same 20 samples/s clock, include both endpoints of 0 ≤ t ≤ 0.5 s. Give the sample indices, count, final instant and payload size when each sample uses exactly three bits. Exclude all storage overhead.
Show the answer and reasoning
The indices are 0 through 10: eleven samples ending at 0.5 s, with 33 payload bits.
Including the right endpoint adds the previously excluded n = 10. Eleven three-bit words occupy 11 × 3 = 33 bits. The ten-sample half-open record instead has 30 payload bits and ends at 0.45 s.
At t_n = n/20 seconds, compare zero-phase 1 V cosine inputs at 6 Hz, 14 Hz and 26 Hz. Which have identical samples, and can a longer record on this exact clock distinguish them without an input-band restriction?
Show the answer and reasoning
All three have identical samples for every integer n. A longer record on this clock cannot distinguish these supplied inputs without additional information.
14 = 20 − 6 gives the reflected cosine identity, while 26 = 20 + 6 adds 2π n to the sample phase. Evenness and periodicity give the same 6 Hz sample sequence; the equality is not limited to a few recorded points.
Keep the ideal low-pass bound B = 7 Hz. Give the signal's Nyquist rate, the Nyquist frequency of a 16 samples/s clock, and its interval. Does 16 samples/s satisfy the stated strict ideal condition, and does that fact alone guarantee exact reconstruction from a short quantized record?
Show the answer and reasoning
The signal's Nyquist rate is 14 samples/s. The clock's Nyquist frequency is 8 Hz and its interval is 0.0625 s. The strict rate condition is satisfied, but a short quantized record alone is not the complete exact sequence assumed by the theorem.
Compute 2B = 14, f_s/2 = 8 and 1/f_s = 1/16 s. The inequality 16 > 14 concerns the admitted band and ideal sampling; finite duration, quantization and actual instrument behavior remain separate conditions.
On the 14 samples/s clock, compare z(t) = (1 V) sin[2π(7 Hz)t] with c(t) = (1 V) cos[2π(7 Hz)t]. Give their values at n = 0, 1 and 2. What information does the general boundary sequence A(−1)^n cos φ determine?
Show the answer and reasoning
The sine gives 0 V, 0 V, 0 V; the cosine gives +1 V, −1 V, +1 V. The general sequence determines A cos φ, without determining A and φ separately.
The sample phases are 0, π and 2π. A sine at those phases is zero and a cosine alternates sign. The general expression has one voltage-valued coefficient A cos φ, so unknown amplitude and phase are not separately recoverable from that coefficient.
Use the original eight-level quantizer on u = −0.50 V, 0 V and −1.20 V. Give each three-bit word, representative and signed error. Which input is outside the nominal interval?
Show the answer and reasoning
−0.50 V gives 010, −0.375 V and +0.125 V; 0 V gives 100, +0.125 V and +0.125 V; −1.20 V gives 000, −0.875 V and +0.325 V. Only −1.20 V is outside the nominal −1–1 V interval.
At the two interior ties the higher-voltage representative is selected, so the indices are 2 and 4. For −1.20 V the ratio is −0.8, its floor is −1 and clipping sets the index to 0. The overrange error exceeds the in-range 0.125 V guarantee.
Define a new quantizer on the same nominal −1–1 V interval with sixteen equally spaced cell centers, the same higher-voltage tie rule and outer-level clipping. Use four-bit codes. Find its step and in-range half-step bound, and quantize u = 0.50 V. Does this change alone distinguish the original 2 Hz and 18 Hz inputs sampled at 20 samples/s?
Show the answer and reasoning
The step is 0.125 V and the bound is 0.0625 V. At 0.50 V, index 12 gives word 1100, representative 0.5625 V and error +0.0625 V. The unchanged 20 samples/s clock still makes the original two inputs indistinguishable.
Divide the 2 V nominal width into sixteen cells. The ratio (0.50 V + 1 V)/(0.125 V) is 12, so the new representative is −1 V + 12.5(0.125 V). Four bits select among sixteen levels, but identical input sample sequences remain identical under the same deterministic mapping.
What to carry forward
- Sampling selects times, quantization selects representative amplitudes, and encoding assigns words to those levels.
- On the supplied zero-origin 20 samples/s clock, the exact 2 Hz and 18 Hz cosine inputs have identical samples for every integer index.
- For the stated ideal low-pass setting, f_s > 2B is a sufficient sampling condition using the entire exact sequence; 2B is the signal's Nyquist rate and f_s/2 is the clock's Nyquist frequency.
- An unknown-phase tone at exactly half the sampling rate needs special care: the supplied boundary sine has only zero samples.
- The original eight-level quantizer has a 0.125 V worst-case error bound within its nominal input interval; clipping can exceed that bound.
- Record the clock, input band, endpoints and code mapping. Timing ambiguity, amplitude quantization and real measurement uncertainty require distinct conditions.
References
Sources for the concepts and teaching approaches in this article.
Massachusetts Institute of Technology2 sources
- Signal Theory — No. 1: Sampling Theorem渡辺 裕 / Hiroshi Watanabe — Waseda University, JapanCourse notes · PDF
- Module 3, Lesson 6: Theory of Quantization (Version 2)ECE, IIT Kharagpur / NPTEL — Multimedia Processing course, instructor Somnath SenguptaCourse notes · PDF