Library / Signal processing and digital filters / DSP-48
Signal processing and digital filters
Sinc interpolation of a sampled waveform
Value at time t of the ideal bandlimited reconstruction from up to six samples x₀ … x₅ at indices 0 to 5 (extra values zero).
- Ref
- DSP-48
- Rev
- v1
- Field
- Signal processing and digital filters
- Result
- x(t) [V]
The sampling theorem says that a signal bandlimited below fs/2 is recovered exactly by x(t) = Σ x[n] sinc(fs t − n), a sum of shifted sinc pulses weighted by the samples. At a sample time t = m/fs it returns x[m] exactly, since all other sincs are zero there. Between samples, a finite record causes truncation error, which grows with distance from the data.
Value at time t of the ideal bandlimited reconstruction from up to six samples x₀ … x₅ at indices 0 to 5 (extra values zero). The exact result needs the full infinite record of a signal bandlimited below fs/2; truncation causes error away from the sample points.
Calculator
- Time in sample units, fs·t1.5
- Nearest sample index2
- Weight of the nearest sample0.6366
What drives the result
Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.
- Between the samples the interpolated value at t = 0.75 s (1.5 sample intervals) is 0.6366 V.
- At the exact sample times the formula returns the samples themselves, so interpolation never changes the data; with only 6 stored samples, expect error near the ends of the record.
Chart data as tables
Ranked variables
| Variable | Typical range | Lowest result | Highest result | Swing (V) | Local step | Change in result |
|---|---|---|---|---|---|---|
| x1 Sample 1 | −10 to 10 V | −6.366 | 6.366 | 12.73 | +0.4 V | +40 % |
| x2 Sample 2 | −10 to 10 V | −5.73 | 7.003 | 12.73 | +0.4 V | +40 % |
| x0 Sample 0 | −10 to 10 V | −1.485 | 2.759 | 4.244 | +0.4 V | −13.3 % |
| x3 Sample 3 | −10 to 10 V | −1.485 | 2.759 | 4.244 | +0.4 V | −13.3 % |
| x4 Sample 4 | −10 to 10 V | −0.6366 | 1.91 | 2.546 | +0.4 V | +8 % |
| x5 Sample 5 | −10 to 10 V | −0.2728 | 1.546 | 1.819 | +0.4 V | −5.71 % |
| t Time | 0 to 5 s | −0.2067 | 1 | 1.207 | +10% | −31.5 % |
| fs Sampling rate | 0.1 to 1,000,000 Hz | −0.01002 | 0.9834 | 0.9934 | +10% | −31.5 % |
Sweep of Time
| Time (s) | Interpolated value (V) |
|---|---|
| 0 | 3.898e-17 |
| 0.625 | 0.9003 |
| 1.25 | −0.2122 |
| 1.875 | 0.08185 |
| 2.5 | −3.898e-17 |
| 3.125 | −0.04287 |
| 3.75 | 0.04897 |
| 4.375 | −0.02904 |
| 5 | 3.898e-17 |
Sweep one variable
Variables and how each one contributes
Interpolated value
What the equation gives you. Everything else feeds it.
Sample 0
The sample x[0], in V. Is weighted by sinc(fs·t − 0), which peaks at t = 0/fs. Raising it by 10 % (to 0) moves the result by +0 %, from 0.6366 to 0.6366 V.
Sample 1
The sample x[1], in V. Is weighted by sinc(fs·t − 1), which peaks at t = 1/fs. Raising it by 10 % (to 1.1) moves the result by +10 %, from 0.6366 to 0.7003 V.
Sample 2
The sample x[2], in V. Is weighted by sinc(fs·t − 2), which peaks at t = 2/fs. Raising it by 10 % (to 0) moves the result by +0 %, from 0.6366 to 0.6366 V.
Sample 3
The sample x[3], in V. Is weighted by sinc(fs·t − 3), which peaks at t = 3/fs. Raising it by 10 % (to 0) moves the result by +0 %, from 0.6366 to 0.6366 V.
Sample 4
The sample x[4], in V. Is weighted by sinc(fs·t − 4), which peaks at t = 4/fs. Raising it by 10 % (to 0) moves the result by +0 %, from 0.6366 to 0.6366 V.
Sample 5
The sample x[5], in V. Is weighted by sinc(fs·t − 5), which peaks at t = 5/fs. Raising it by 10 % (to 0) moves the result by +0 %, from 0.6366 to 0.6366 V.
Sampling rate
The sampling rate, in Hz. Scales the time axis: the sample spacing is 1/fs. Raising it by 10 % (to 2.2) moves the result by −31.5 %, from 0.6366 to 0.4363 V.
Time
The time at which to interpolate, in s. Moves along the record; at t = n/fs the value is exactly x[n]. Raising it by 10 % (to 0.825) moves the result by −31.5 %, from 0.6366 to 0.4363 V.
Worked example with the values above
- Time in sample units: fs·t = 2 × 0.75 = 1.5.
- Nonzero terms: x[1] sinc(0.5) = 1 × 0.63662.
- x(t) = 0.63662 V.
Assumptions and limits
- Integer, positive resampling factors, with a low-pass filter that gives enough alias rejection.
- For analytic-signal formulas, a narrowband signal with a clean quadrature component and less than π of phase change per sample.
Common mistakes
- Not reducing L/M by the common factor, which wastes computation.
- Forgetting the filter delay when counting output samples.
- Using the phase difference when the true change per sample exceeds π.
Statistics and uncertainty
Rates and lengths here are exact integer relations. Estimates of envelope and frequency from analytic samples are sensitive to noise, since the phase of a small sample is poorly defined, so use only samples well above the noise floor.
Where it is used
- Converting between audio and instrumentation sample rates and sizing buffers.
- Demodulating amplitude and frequency from complex baseband data.
Maths you need
- Interpolation and decimation: raising and lowering the sampling rate by integer factors
- Analytic signal: a real signal plus i times its Hilbert transform
- Principal phase: phase wrapped to the range −π to π