ADC and DAC

4 minute read

Published:

In this blog, we will study analog-to-digital conversion (ADC) and digital-to-analog conversion (DAC). Down the road, we will prove the well-known Nyquist sampling theorem.

The starting point is a continuous-time signal $x(t)$. An ADC takes $x(t)$ and produces a discrete-time signal $x[n]\triangleq x(nT)$, where $T$ is the sampling interval, also known as sampling period. It is also common to talk about the sampling rate, which is defined as $1/T$ if expressed in Hertz and $2\pi/T$ when expressed in radians per second.

Conversely, a DAC takes a sequence $x[n]$ at its input and produces a continuous-time waveform $\hat{x}(t)$ at its output. Ideally, if the samples $x[n]$ preserve all the information in $x(t)$, the DAC will be able to reconstruct $x(t)$, which theoretically can be expressed as $\hat{x}(t)=x(t)$.

Our first goal is to study under which conditions $x(t)$ can be reconstructed from $x[n]$.

The notation for Fourier transforms of continuous-time and discrete-time signals throughout this problem is respectively

\[\begin{align} Y(\Omega) \triangleq \int_{-\infty}^{\infty} y(t)e^{-j\Omega t}dt, \quad\quad Y(e^{j\omega}) \triangleq \sum_{n=-\infty}^{\infty} y[n]e^{-j\omega n}. \end{align}\]

Note the usage of different letters, namely $\Omega$ and $\omega$, in each case.

1. The Dirac comb, also known as a train of deltas or train of impulses, is $p(t)=\sum_{n=-\infty}^{\infty} \delta(t-Tn)$. The ADC conversion can be mathematically thought of as a two-step process. First, $x(t)$ is multiplied by a Dirac comb. Let $x_c(t)\triangleq x(t)p(t)$, then we have

\(\begin{align} \begin{aligned} x_c(t) & = x(t)p(t) = x(t) \sum_{n=-\infty}^{\infty}\delta(t-Tn) \\ & = \sum_{n=-\infty}^{\infty} x(t)\delta(t-Tn) \overset{(a)}{=} \sum_{n=-\infty}^{\infty} x(nT)\delta(t-Tn) \\ & = \sum_{n=-\infty}^{\infty} x[n]\delta(t-Tn), \end{aligned} \end{align}\)

where $(a)$ follows the sampling property, which is $x(t)\delta(t-t_0)=x(t_0)\delta(t-t_0)$.

2. The second step involves collecting the amplitudes of the resulting deltas to extract the sequence $x[n]$. Let us now relate the Fourier transform of $x_c(t)$ and that of $x[n]$.

\[\begin{align} \begin{aligned} X_c(\omega/T) & =\int_{-\infty}^{\infty} x_c(t)e^{-j(\omega/T) t}dt \\ & =\int_{-\infty}^{\infty} \sum_{n=-\infty}^{\infty} x[n]\delta(t-Tn)e^{-j(\omega/T) t}dt \\ & =\sum_{n=-\infty}^{\infty} x[n]\int_{-\infty}^{\infty} \delta(t-Tn)e^{-j(\omega/T) t}dt \\ & \overset{(a)}{=}\sum_{n=-\infty}^{\infty} x[n]e^{-j\omega n} = X(e^{j\omega}), \end{aligned} \end{align}\]

where $(a)$ follows the sampling property of the Dirac delta function, which is $y(t_0)=\int y(t)\delta(t-t_0)dt$, ($y(t)=e^{-j(\omega/T) t}$ and $t_0=Tn$).

3. It can be shown that the Fourier transform of $p(t)$ is

\[\begin{align} P(\Omega) = \frac{2\pi}{T}\sum_{k=-\infty}^{\infty}\delta\left(\Omega-\frac{2\pi}{T} k\right). \end{align}\]

We can find $X_c(\omega/T)$ as following:

\[\begin{align} \begin{aligned} x_c(t) = x(t)p(t) \overset{\mathcal{F}}{\longrightarrow} X_c(\Omega) & \overset{(a)}{=} \frac{1}{2\pi}X(\Omega)*P(\Omega) \\ & = \frac{1}{2\pi}X(\Omega) * \frac{2\pi}{T}\sum_{k=-\infty}^{\infty}\delta\left(\Omega-\frac{2\pi}{T} k\right) \\ & = \frac{1}{T}\sum_{k=-\infty}^{\infty}X(\Omega) * \delta\left(\Omega-\frac{2\pi}{T} k\right) \\ & = \frac{1}{T}\sum_{k=-\infty}^{\infty}\int_{-\infty}^{\infty}X(\mu)\delta\left(\Omega-\frac{2\pi}{T} k-\mu\right)d\mu \\ & \overset{(b)}{=} \frac{1}{T}\sum_{k=-\infty}^{\infty}X\left(\Omega-\frac{2\pi}{T}k\right), \end{aligned} \end{align}\]

where $(a)$ follows the property of Fourier transform and $(b)$ follows the sampling property of the Dirac delta function.

Observe that the two last parts have established the relation between the Fourier transform of $x(t)$ and that $x[n]\triangleq x(nT)$:

\(\begin{align} X(e^{j\omega}) = \frac{1}{T}\sum_{k=-\infty}^{\infty}X\left(\frac{\omega-2\pi k}{T}\right). \end{align}\)

So far, we have established the relation between the Fourier transform of $x(t)$ and that of $x[n]$. Observe that a continuous-time frequency $\Omega$ corresponds to a discrete-time frequency $\omega/T$. In other words:

\[\begin{align} \omega = \Omega T. \end{align}\]

We also observed that when the bandwidth of $x(t)$ is greater than half the sampling rate $(1/2)2\pi/T$, this Fourier transform becomes distorted. Next, we will proceed to study digital-to-analog conversion.

4. The DAC conversion can also be mathematically understood in 2 steps. The first is to form $x_c(t)$ from the samples $x[n]$ by using (2). The second step involves applying an ideal low-pass filter $g(t)$ with frequency response

\[\begin{align} G(\Omega)\triangleq\begin{cases} T, & \text{if }|\Omega|<\frac{\pi}{T}, \\ 0, & \text{otherwise}. \end{cases} \end{align}\]

to $x_c(t)$. The continuous-time signal of the above filter is given as

\(\begin{align} g(t) & =\mathcal{F}^{-1}\{G(\Omega)\}=\frac{1}{2\pi}\int_{-\pi/T}^{\pi/T}Te^{j\Omega t}d\Omega =\left[\frac{T}{2\pi}\frac{1}{jt}e^{j\Omega t}\right]_{-\pi/T}^{\pi/T} =\text{sinc}\left(\frac{t}{T}\right). \end{align}\)

Therefore,

\[\begin{align} \begin{aligned} \hat{x}(t) & = x_c(t)*g(t) = \sum_{n=-\infty}^{\infty} x[n]\delta(t-nT)*g(t)\\ & = \sum_{n=-\infty}^{\infty} x[n]\delta(t-nT)*\text{sinc}\left(\frac{t}{T}\right) \\ & = \sum_{n=-\infty}^{\infty} x[n] \int_{-\infty}^{\infty} \text{sinc}\left(\frac{\tau}{T}\right)\delta(t-nT-\tau)d\tau \\ & \overset{(a)}{=} \sum_{n=-\infty}^{\infty} x[n] \text{sinc}\left(\frac{t-nT}{T}\right), \end{aligned} \end{align}\]

where $(a)$ follows the definition of Dirac delta.

5. We say that $x(t)$ is reconstructed from $x[n]$ if $\hat{x}(t)=x(t)$. This is the case if $X(\Omega)=0$ for $\Omega\notin (-\pi/T,\pi/T)$, that is, if the sampling rate is at least twice the highest frequency (in absolute value) in $x(t)$ (Nyquist’s sampling theorem).

Indeed, since $|\Omega-\frac{2\pi}{T}k|\geq|\frac{2\pi}{T}k|-|\Omega|>\pi/T$ for $k\neq 0$. If $X(\Omega)=0$ for $\Omega\notin (-\pi/T,\pi/T)$, then $\sum_{k=-\infty}^{\infty}X\left(\Omega-\frac{2\pi}{T}k\right)=X(\Omega)$. By pluging $\omega=\Omega T$ to (6), we have

\(\begin{align} X(e^{j\Omega T}) = \frac{1}{T}\sum_{k=-\infty}^{\infty}X\left(\Omega-\frac{2\pi k}{T}\right) = \frac{1}{T}X(\Omega), \forall \Omega\in (-\pi/T,\pi/T). \end{align}\)

Therefore, $X(\Omega)=TX(e^{j\Omega T})$, $\forall \Omega\in (-\pi/T,\pi/T)$.

On the order hand,

\[\begin{align} \begin{aligned} x(t) & =\mathcal{F}^{-1}\{X(\Omega)\}=T\mathcal{F}^{-1}\{X(e^{j\Omega T})\}=\frac{T}{2\pi}\int_{-\pi/T}^{\pi/T}X(e^{j\Omega T})e^{j\Omega t}d\Omega \\ & =\frac{T}{2\pi}\int_{-\pi/T}^{\pi/T}\sum_{n=-\infty}^{\infty}x[n]e^{-j\Omega nT}e^{j\Omega t}d\Omega=\sum_{n=-\infty}^{\infty}x[n]\int_{-\pi/T}^{\pi/T}\frac{T}{2\pi}e^{j\Omega (t-nT)}d\Omega \\ & =\sum_{n=-\infty}^{\infty}x[n]\left[\frac{T}{2\pi}\frac{1}{j(t-nT)}e^{j\Omega (t-nT)}\right]_{-\pi/T}^{\pi/T}=\sum_{n=-\infty}^{\infty}x[n]\text{sinc}\left(\frac{t-nT}{T}\right) \\ & =\hat{x}(t). \end{aligned} \end{align}\]