Basics of DSP

Discretization of a continuous-time signal (sampling and aliasing)

Consider a continuous-time signal xc(t)x_c(t) whose Fourier transform is Xc(Ω)X_c(\Omega). Then

xc(t)=12πXc(Ω)ejΩtdΩ(1) x_c(t) = \frac{1}{2\pi} \int_{-\infty}^{\infty} X_c(\Omega) e^{j \Omega t} d\Omega \qquad (1)

and

Xc(Ω)=xc(t)ejΩtdt(2) X_c(\Omega) = \int_{-\infty}^{\infty} x_c(t) e^{-j \Omega t} dt \qquad (2)

A discrete-time signal xd(n)x_d(n) can be obtained by uniformly sampling the continuous-time signal xc(t)x_c(t) at discrete intervals nTnT where TT is called the sampling period and nn is an integer. Consider a unit impulse function δ(t)\delta(t), whose value is 11 at t=0t=0 and 00 elsewhere. Then the unit impulse sequence can be expressed as

s(t)=n=δ(tnT),(3) s(t) = \sum_{n=-\infty}^{\infty} \delta(t-nT), \qquad (3)

and xd(n)x_d(n) can be expressed as

xd(n)=xc(t)s(t)(4)=xc(t)n=δ(tnT)(5)=n=xc(nT)δ(tnT).(6) \begin{aligned} x_d(n) &= x_c(t) s(t) \qquad (4) \\ &= x_c(t) \sum_{n=-\infty}^{\infty} \delta(t-nT) \qquad (5) \\ &= \sum_{n=-\infty}^{\infty} x_c(nT) \delta(t-nT). \qquad (6) \end{aligned}


Figure 1:
(a) Damped sinusoid,
(b) Impulse train,
(c) Illustration of sampling and
(d) Sampled signal.

Figure 2: Fourier transform of
(a) Bandlimited signal and
(b) Impulse train.
Discrete time Fourier transform of
(c) Oversampled signal (Fs>2BF_s > 2B)
(d) Undersampled signal (Fs<2BF_s < 2B).


Figure 1 illustrates the process and effect of sampling a continuous-time signal in the time domain. In the frequency domain, the corresponding Fourier transform of (x_d(n)) can be obtained by convolving the individual Fourier transforms of (x_c(t)) and (s(t)). This is because multiplication of two sequences in the time domain is equivalent to convolution in the Fourier domain. Similarly multiplication in the Fourier domain is equivalent of convolution in the time domain.

To observe the effect of sampling in the frequency domain, we need to consider the Fourier Transform of s(t)s(t). Since s(t)s(t) is periodic with period TT, using Fourier series expansion it can be shown that

s(t)=1Tk=ejkΩst,(7) s(t) = \frac{1}{T} \sum_{k=-\infty}^{\infty} e^{-j k \Omega_s t}, \qquad (7)

where Ωs=2πT\Omega_s = \frac{2\pi}{T} is the sampling frequency.

Now the Fourier transform of s(t)s(t) may be computed as

S(Ω)=s(t)ejΩtdt(8)=1Tk=ejkΩstejΩtdt(9)=2πTk=δ(ΩkΩs).(10) \begin{aligned} S(\Omega) &= \int_{-\infty}^{\infty} s(t) e^{-j \Omega t} dt \qquad (8) \\ &= \int_{-\infty}^{\infty} \frac{1}{T} \sum_{k=-\infty}^{\infty} e^{-j k \Omega_s t} e^{-j \Omega t} dt \qquad (9) \\ &= \frac{2\pi}{T} \sum_{k=-\infty}^{\infty} \delta(\Omega - k \Omega_s). \qquad (10) \end{aligned}

Thus the Fourier transform of an impulse train with period TT is another impulse train with period Ωs=2πT\Omega_s = \frac{2\pi}{T}. To illustrate the effect of sampling in the frequency domain, consider some arbitrary Fourier transform of a signal with bandwidth BB shown in Figure 2(a). The Fourier transform of the impulse train sequence with period TT is shown in Figure 2(b) where Fs=1TF_s = \frac{1}{T} denotes the sampling frequency. The corresponding discrete-time Fourier transform of the sampled signal is shown in Figure 2(c) for the case where Fs>2BF_s > 2B. If the sampling frequency is reduced (Fs<2BF_s < 2B), the resultant discrete-time Fourier transform (shown in Figure 2(d)) clearly indicates the overlapping of spectral components. This effect is called aliasing and is due to an insufficient sampling rate. If the signal is sampled at a sampling frequency of Fs=2BF_s = 2B, then no spectral distortion occurs as can be seen from (shown in Figure 3). Hence the minimum sampling frequency required to discretize a signal without aliasing is equivalent to twice the bandwidth of the signal. This frequency is referred to as the Nyquist rate.



Figure 3: Discrete time Fourier transform of signal sampled at Nyquist frequency
(Fs=2BF_s = 2B).


Digitization of a Discrete-Time Signal - Quantization and Quantization Error


A discrete-time signal obtained through sampling is still a continuous amplitude time sequence, where each sample value has an infinite precision. But digital computers are finite precision machines and hence there is a need to discretize and limit the range of sample values. This is achieved by quantization (more accurately scalar quantization). In the quantization process, each sampled value of a discrete-time signal is compared against a finite set of amplitude values and assigned a value in the set that is closest to the discrete-time value. The number of elements in the finite set is determined by the precision of the digital system. In an 8-bit system, there are 28=2562^8 = 256 elements in the set. The number of elements in the finite set is referred as the number of quantization levels. If the difference in values of adjacent elements in the ordered set is constant, then the quantizer is referred as a uniform linear quantizer. Figure 4 shows the effect of quantizing a line using a 3-bit quantizer.
Quantizer

Figure 4: Quantization of a linear segment of an analog signal.


Since the digital signal is obtained by quantizing the continuous valued discrete-time signal, there is an error introduced in representation of the signal. If the discrete-time signal xd(n)x_d(n) has a limited amplitude range (i.e., xd(n)Amax|x_d(n)| \leq A_{\mathrm{max}}), the quantization step for a BB-bit uniform quantizer is given by

Qs=2Amax2B(11) Q_s = \frac{2A_{\mathrm{max}}}{2^B} \qquad (11)

The maximum quantization error introduced by a BB-bit uniform quantizer is given by

Qemax=Qs2(12)Qemax=Amax2B(13) \begin{aligned} Q_{e_{\mathrm{max}}} &= \frac{Q_s}{2} \qquad (12) \\ Q_{e_{\mathrm{max}}} &= \frac{A_{\mathrm{max}}}{2^B} \qquad (13) \end{aligned}

Hence the quantization error for each sample e(n)e(n) is defined as

e(n)=xd(n)xD(n),(14) e(n) = x_d(n) - x_D(n), \qquad (14)

where xd(n)x_d(n) is the discrete-time infinite precision sampled value of the continuous-time signal x(t)x(t), and xD(n)x_D(n) is the finite precision digitized (sampled and quantized) sample value. The quantization error at each sample lies within the range

Qemaxe(n)Qemax.(15) -Q_{e_{\mathrm{max}}} \leq e(n) \leq Q_{e_{\mathrm{max}}}. \qquad (15)



Design of Resonator


A resonator is an all-pole system. The transfer function of an all-pole system H(z)H(z) is given by

H(z)=11+k=1Nakzk,(16) H(z) = \frac{1}{1 + \sum_{k=1}^{N} a_k z^{-k}}, \qquad (16)

where {ak}\{a_k\} denote the real coefficients of the denominator polynomial of order NN. Roots of the denominator polynomial in z1z^{-1} give real or complex poles. Real roots correspond to zero frequency or Fs/2F_s/2. Complex roots of a polynomial with real coefficients always occur in complex conjugate pairs corresponding to a frequency related to the angle of the complex root. Each pair of complex conjugate roots (or poles) corresponds to a second order polynomial which may be denoted as

H(z)=1(1ziz1)(1ziz1)=11+ai1z1+ai2z2,(17) H(z) = \frac{1}{(1 - z_i z^{-1})(1 - z_i^* z^{-1})} = \frac{1}{1 + a_{i_1} z^{-1} + a_{i_2} z^{-2}}, \qquad (17)

where the complex root ziz_i is given by

zi=riej2πFiFs,(18) z_i = r_i e^{j 2\pi \frac{F_i}{F_s}}, \qquad (18)

where FiF_i denotes the resonance frequency of the second order system, and rir_i corresponds to the resonance bandwidth BiB_i given by

ri=eπBiT,(19) r_i = e^{-\pi B_i T}, \qquad (19)

where TT denotes the sampling interval. By using Eq. 18 and Eq. 19, Eq. 17 can be derived as

Hi(z)=112eπBiTcos(2πFiT)z1+e2πBiTz2,(20) H_i(z) = \frac{1}{1 - 2 e^{-\pi B_i T} \cos(2 \pi F_i T) z^{-1} + e^{-2 \pi B_i T} z^{-2}}, \qquad (20)

where Fs=1TF_s = \frac{1}{T} represents the sampling frequency.

For example, the magnitude response of an all-pole system H(z)H(z) with resonant frequency Fi=1000F_i = 1000 Hz, Bi=100B_i = 100 Hz and Fs=8000F_s = 8000 Hz is shown in Figure 5. The impulse response is a sampled sinusoidal signal. The damping depends on the bandwidth of the pole of the system.


Figure 5: Impulse response and magnitude response.


Consider a train of impulse sequence, I(nT0)I(nT_0), with each impulse located at integer multiples of T0T_0 (T0TT_0 \gg T) as shown in Figure 6. The output resonance of the system O(nT)O(nT) is shown in Figure 7. The output signal is periodic with fundamental period (T0T_0) (from which the fundamental frequency is obtained as F0=1T0F_0 = \frac{1}{T_0}) is shown in Figure 7.




Figure 6: Train of impulse sequence.




Figure 7: Output resonance of the system.