Mathematical description sampling process

Screencast video [⯈]


Analog to digital conversion

Sounds that reach our ears are signals in the form of air pressure. This air pressure is a continuous signal, i.e. it is defined for all time instances and can have any value on a reasonable domain. These kind of signals cannot be stored directly on a computer, which uses numbers to perform calculations. The signal first needs to be approximated in two ways in order to allow for computations on a computer and to limit the required memory.

First, it is not possible to save the signal values of every time instance. The continuous time domain has an infinite amount of distinct time instances. In order to limit the number of values that we save in the memory, we only save the values of every Ts seconds. This process is called sampling and is also know as continuous-time to discrete-time conversion, or C/D conversion.

Secondly, the values that we measure can have an infinite amount of distinct values. In order to bring down the infinite number of bits required to save these values, the measured values are rounded to a predefined set of values. This process is called quantization. After this quantization step, the values are encoded into bits.

The process of converting an analog to a digital signal is called analog-to-digital conversion or A/D conversion. An overview of this system is shown in Fig. 1. This conversion encompasses both the sampling as quantization of the analog signal. In this section we will be focusing on the sampling process.

An overview of analog-to-digital conversion with an encoding step. First the continuous-time signal is sampled in time in the C/D converter, then the signal is quantized to a predefined set of values and finally these values are encoded into bits.
An overview of analog-to-digital conversion with an encoding step. First the continuous-time signal is sampled in time in the C/D converter, then the signal is quantized to a predefined set of values and finally these values are encoded into bits.

C/D conversion

In the C/D conversion, the analog signal xa(t) is converted to a discrete-time signal with continuous values. Here the round brackets () indicate the continuous-time domain. The process of C/D conversion is presented in Fig. 2. This analog signal xa(t) is multiplied with a period pulse train sa(t) defined as (1)sa(t)=n=δ(tnTs), which consists of a train of ideal delta pulses, uniformly spaced at a distance of Ts seconds. Here Ts represents the sampling period, with is the reciprocal of the sampling frequency fs as Ts=1/fs. The resultant signal xs(t)=xa(t)sa(t) is a pulse train where the area under the delta pulse at time t=nTs represents the instantaneous value of xa(t). These values are then used to convert the signal to discrete-time signal samples x[n], where the index n is an integer and refers to the sample index. Please note that we now use square brackets [] to denote the discrete-time domain.

The process of continuous-time to discrete-time conversion. First, the analog signal $x_a(t)$ is multiplied with a delta pulse train $s_a(t)$, yielding the continuous signal $x_s(t)$. These pulses are subsequently converted into samples by discretizing the time-domain.
The process of continuous-time to discrete-time conversion. First, the analog signal xa(t) is multiplied with a delta pulse train sa(t), yielding the continuous signal xs(t). These pulses are subsequently converted into samples by discretizing the time-domain.

Pulse train multiplication

Now we will investigate the consequences of sampling the analog signal for its frequency content, starting by the multiplication of the analog signal with the pulse train. We will do this by calculating the Fourier transform for continuous-time signals (FTC) for the resulting signal xs(t)=xa(t)sa(t).

Let us assume that the ideal frequency spectrum of xa(t) can be represented as Xa(ω), where ω denotes the angular frequency ω=2πf. This gives us the Fourier pair (2)xa(t)FTCXa(ω) Similarly, the frequency spectrum Sa(ω) of the pulse train sa(t) is a basic Fourier pair, known to be (3)sa(t)=n=δ(tnTs)FTCSa(ω)=2πTsk=δ(ωk2πTs) Using the multiplication-convolution property of the FTC defined as (4)xs(t)=xa(t)sa(t)FTCXs(ω)=12πXa(ω)Sa(ω) we can obtain the frequency spectrum Xs(ω) of xs(t) as (5)Xs(ω)=1Tsk=Xa(ω)δ(ωk2πTs),=1Tsk=Xa(ωk2πTs).

From this description two consequences can be observed. First, the frequency spectrum gets scaled by a factor 1/Ts=fs. Secondly, the spectrum Xs(ω) resembles the spectrum Xa(ω), which repeats itself every 2πTs radians per second.

Conversion to samples

Another way of determining the frequency spectrum Xs(ω) can be found by treating the signal xa(nTs) as values and by using the shift property of the FTC for the delta pulses. From this we can obtain the Fourier pair (6)xs(t)=n=xa(nTs)δ(tnTs)FTCXs(ω)=n=xa(nTs)ejnωTs This expression is similar to the expression of the Fourier transform for discrete-time signals (FTD), which is defined as (7)X(ejθ)=n=x[n]ejnθ By defining the discrete-time signal x[n] as (8)x[n]=x(t)|t=nTs, we can observe equality of Xs(ω) in (6) and X(ejθ) in (7) when (9)θ=ωTs=2πffs holds. Here θ is known as the relative frequency.

From this equality and the expression in (3) we can obtain the FTD of the sampled signal xs[n] as (10)Xs(ejθ)=Xs(ω)ω=θTs=1Tsk=Xa(θTsk2πTs). As expected from our previously results, after sampling we obtain a spectrum that repeats every 2πTs radians per second. From the perspective of the relative frequency, we observe a periodic behaviour of the relative frequency every 2π and from the normal frequency, we observe a periodic behaviour of the frequency every 1/Ts=fs Hz.

Sampling theorem

Let us now consider the consequences of the spectral repetition in the frequency domain for a band-limited signal. With a band-limited signal we refer to a signal whose frequency content is restricted to a finite segment of the frequency domain. For simplicity we will assume that the spectrum of signal xa(t) is band-limited to the domain f[fmax,fmax]. If fmax does not exceed the boundary frequency kfs+fs/2, represented by the average center frequencies of two consecutive repetitions, the repetitions will be visible next to each other in the frequency domain. This is depicted on the left of Fig. 3. However, if this maximum frequency is larger than these boundaries, the repetitions will overlap each other in the frequency domain. This is called aliasing and is shown on the right of Fig. 3. Aliasing will lead to distortion at the frequency regions where the original frequency spectra overlap. Consequently, when sampling a signal, it is in general not possible to reconstruct the original signal from its samples when aliasing occurs, as we cannot undo the effect of this overlap.

In order to prevent aliasing and to make sure that we can reconstruct our original signal from our samples, we need to fulfill the following sampling theorem.

A continuous-time signal xa(t) with frequencies not higher than fmax can be reconstructed exactly from its samples x[n]=xa(t)|nTs, if samples are taken at a rate fs=1/Ts, that is larger than 2fmax.
An illustrative example showing the concept of aliasing.
An illustrative example showing the concept of aliasing.

In practice there are situations when it is not possible to satisfy this theorem, for example when you are measuring a high-frequency signal or when the computational power of the system is restricted. In these cases the distortion caused by aliasing can be prevent by cropping the frequency spectrum to the allowed domain. By doing so, we lose signal content and information, but we prevent distortion from taking place. This cropping can be performed by low-pass filtering the signal before sampling the signal. This process is depicted in Fig. 4.

An overview of the system where the sampler is preceded by a low-pass filter to prevent aliasing from distorting the signal.
An overview of the system where the sampler is preceded by a low-pass filter to prevent aliasing from distorting the signal.

Digital to analog conversion

Now that we have considered the process of sampling the signal it is time to reconstruct the analog signal from its sampled values.

Process overview

Consider the signal xs(t), which was a pulse train containing sampled values of the original analog signal xa(t) as shown on the left in equation (6). This signal can be reconstructed relatively easily from the discrete-time signal samples x[n]. If we consider the spectrum Xs(ω) of xs(t) in (5), we can observe that the spectrum contains repetitions of the original spectrum. For the reconstruction of the original band-limited signal xa(t), we are only interested in the repetition for k=0, i.e. the repetition around 0 Hz. Through low-pass filtering the signal xs(t), all repetitions of the spectrum can be filtered out and only the original spectrum remains. By low-pass filtering we can reconstruct our signal. This process is shown in Fig. 5.

Process of digital to analog conversion, where a low-pass filter is used to reconstruct the original signal from the delta pulse train.
Process of digital to analog conversion, where a low-pass filter is used to reconstruct the original signal from the delta pulse train.

Time-domain interpolation

The process of converting the samples into a delta pulse train and of low-pass filtering the signal can also be represented mathematically. The process of converting the samples into delta pulses can be represented as (11)xs(t)=n=x[n]δ(tnTs). The low-pass filter is assumed to be ideal with a cut-off radial frequency at π/Ts. This gives the frequency response of the low-pass filter Hr(ω) and the impulse response of the filter hr(t) as the Fourier pair (12)Hr(ω)={Ts|ω|πTs0|ω|>πTsFTChr(t)=sin(πTst)πTst In the frequency domain, the original spectrum is reconstructed through the multiplication of the repeating spectrum and the frequency response of the low-pass filter. In the time-domain this corresponds to the convolution of the signal with the impulse response of the low-pass filter as (13)xa(t)=xs(t)hr(t)=(n=x[n]δ(tnTs))hr(t)=n=x[n](δ(tnTs)hr(t))=n=x[n]hr(tnTs), where the time-domain interpolation equation is determined as (14)xa(t)=n=x[n](sin(πTs(tnTs))πTs(tnTs)) This process is also known as sinc-interpolation as we are replacing all samples with scaled sinc-functions and summing over them. Fig. 6 shows the process of interpolating the signal samples with sinc functions.

Process of signal reconstruction through sinc interpolation, where the signal samples are converted into scaled sinc functions over which is summed to reconstruct the original signal.
Process of signal reconstruction through sinc interpolation, where the signal samples are converted into scaled sinc functions over which is summed to reconstruct the original signal.

Frequency domain interpolation

From the description in the last line of (13) the corresponding effects on the frequency spectrum can be determined by treating x[n] again as values. This gives the Fourier pair (15)xa(t)=n=x[n]hr(tnTs)FTCXa(ω)=n=x[n]Hr(ω)ejnωTs By shuffling around the terms on the right and by using the definition of the FTD we obtain the following expression for Xa(ω) (16)Xa(ω)=Hr(ω)(n=x[n]ejnωTs)=Hr(ω)X(ejθ)θ=ωTs. Using the definition of the frequency response of the low-pass filter, we end up with the frequency domain interpolation equation: (17)Xa(ω)={TsX(ejθ)θ=ωTS|ω|πTs0elsewhere

Reconstruction in practice

In practice an ideal low-pass filter cannot be implemented as it is non-causal, i.e. it requires future observations in the filtering process, and as the filter impulse response is infinitely long. It is more common to interpolate a signal through a zero-order hold operation. This operation outputs the same sample value for the entirety of the sampling period. In other words, it outputs the last sample value until a new sample appears. This operation creates a step-like signal. The impulse response h0(t) and frequency response H0(ω) can be represented by the following Fourier pair: (18)h0(t)={10tTs0elsewhereFTCH0(ω)=sin(ωTs2)ωTs2ejωTs2 This process is visualized in Fig. 7. In order to compensate for the distortion caused by the zero-order hold operation, the signal is in practice passed through a so-called compensation filter, ideally represented by the frequency response (19)Hc(ω)={ωTs2sin(ωTs2)ejωTs2|ω|πTs0|ω|>πTs to compensate for the frequency response of the zero-order hold operation.

The zero-order hold operation and its effect for both the time-domain signal as the frequency spectrum.
The zero-order hold operation and its effect for both the time-domain signal as the frequency spectrum.

Continuous-time versus discrete-time processing

Consider the situation as depicted in Fig. 8, where a signal is processed in the continuous-time domain and in the discrete-time domain. Under two conditions, these operations are identical. The first condition is that the signal x(t) is band-limited such that no aliasing occurs. This means that X(ω)=0 needs to hold for |ω|>πTs. Secondly, the low-pass filter used for the reconstruction of the signal needs to be ideal. Therefore also Hr(ω)=0 needs to hold |ω|>πTs.

If both of these conditions are satisfied the relationship between the analog filter Ha(ω) and the discrete-time filter Hd(ejθ) can be determined as (20)Ha(ω)={Hd(ejθ)θ=ωTs|ω|πTs0elsewhere

Signal processing in the continuous- and discrete-time domain.
Signal processing in the continuous- and discrete-time domain.