In signal processing, sampling is the reduction of a continuous-time signal to a discrete-time signal. A common example is the conversion of a sound wave to a sequence of "samples". A sample is a value of the signal at a point in time and/or space; this definition differs from the term's usage in statistics, which refers to a set of such values.
A sampler is a subsystem or operation that extracts samples from a continuous signal. A theoretical ideal sampler produces samples equivalent to the instantaneous value of the continuous signal at the desired points.
The original signal can be reconstructed from a sequence of samples, up to the Nyquist limit, by passing the sequence of samples through a type of low-pass filter called a reconstruction filter.
Theory
Functions of space, time, or any other dimension can be sampled, and similarly in two or more dimensions.
For functions that vary with time, let S(t) be a continuous function (or "signal") to be sampled, and let sampling be performed by measuring the value of the continuous function every T seconds, which is called the sampling interval or sampling period. Then the sampled function is given by the sequence: S(nT), for integer values of n. The sampling frequency or sampling rate, fs, is the number of samples divided by the interval length over in which occur, thus , with the unit sample per second, sometimes referred to as hertz, for example e.g. 48 kHz is 48,000 samples per second.
Reconstructing a continuous function from samples is done by interpolation algorithms. The Whittaker–Shannon interpolation formula is mathematically equivalent to an ideal low-pass filter whose input is a sequence of Dirac delta functions that are modulated (multiplied) by the sample values. When the time interval between adjacent samples is a constant (T), the sequence of delta functions is called a Dirac comb. Mathematically, the modulated Dirac comb is equivalent to the product of the comb function with s(t). That mathematical abstraction is sometimes referred to as impulse sampling.
Most sampled signals are not simply stored and reconstructed. The fidelity of a theoretical reconstruction is a common measure of the effectiveness of sampling. That fidelity is reduced when s(t) contains frequency components whose cycle length (period) is less than 2 sample intervals (see Aliasing). The corresponding frequency limit, in cycles per second (hertz), is 0.5 cycle/sample × fs samples/second = fs/2, known as the Nyquist frequency of the sampler. Therefore, s(t) is usually the output of a low-pass filter, functionally known as an anti-aliasing filter. Without an anti-aliasing filter, frequencies higher than the Nyquist frequency will influence the samples in a way that is misinterpreted by the interpolation process.
Practical considerations
In practice, the continuous signal is sampled using an analog-to-digital converter (ADC), a device with various physical limitations. This results in deviations from the theoretically perfect reconstruction, collectively referred to as distortion.
Various types of distortion can occur, including: Aliasing. Some amount of aliasing is inevitable because only theoretical, infinitely long, functions can have no frequency content above the Nyquist frequency. Aliasing can be made arbitrarily small by using a sufficiently large order of the anti-aliasing filter. Aperture error results from the fact that the sample is obtained as a time average within a sampling region, rather than just being equal to the signal value at the sampling instant. In a capacitor-based sample and hold circuit, aperture errors are introduced by multiple mechanisms. For example, the capacitor cannot instantly track the input signal and the capacitor can not instantly be isolated from the input signal. Jitter or deviation from the precise sample timing intervals. Noise, including thermal sensor noise, analog circuit noise, etc. Slew rate limit error, caused by the inability of the ADC input value to change sufficiently rapidly. Quantization as a consequence of the finite precision of words that represent the converted values. Error due to other non-linear effects of the mapping of input voltage to converted output value (in addition to the effects of quantization).