]> Sound and music - From Analog to Digital

## From Analog to Digital

Because analog filters are well-studied, a common way of designing a digital filter is to start with an analog filter, then transform it to a digital filter. To achieve this, we must find a function that maps the imaginary axis onto the unit circle, as we must have the frequency response of the analog filter be similar to the frequency response of its digital incarnation.

One such function is the bilinear transform. We substitute $s$ in the transfer function of the analog filter $H\left(s\right)$ with

$s=\frac{z-1}{z+1}$

Rearranging gives

$z=\frac{1+s}{1-s}$

Let us call this map $B$. By inspection, if $s$ is the point at infinity, then $z=-1$. Also, $0$ maps to $1$, $i$ to $i$ and $-i$ to $-i$, which suggests it does map the imaginary axis to the unit circle. More generally,

$B\left(i\omega \right)=\frac{1+i\omega }{1-i\omega }=\frac{1-{\omega }^{2}}{1+{\omega }^{2}}+\frac{2\omega }{1+{\omega }^{2}}i$

which makes it clear that it does map the imaginary axis to the unit circle. (Since $\mid B\left(i\omega \right)\mid =1$.)

Applying the bilinear transform to the transfer function ${H}_{a}\left(s\right)$ of some analog filter gives the transfer function ${H}_{d}\left(z\right)$ of some digital filter. If ${H}_{d}\left(z\right)$ is of the correct form we can read the coefficients off and implement the digital filter. However, even though the frequency response of the digital filter is based on that of the analog filter, the relationship is not straightforward. As $\omega$ increases from 0 to infinity, $B\left(i\omega \right)$ rotates counterclockwise around the unit circle starting from 1 and approaching -1, but the imaginary axis gets more and more "compressed" as it approaches infinity.

To gain more control over the conversion, we examine how the distance of a point $i\omega$ from the origin, namely $\mid \omega \mid$, relates to the angle of the point to which it maps, namely $\angle B\left(i\omega \right)$. (Recall ${H}_{a}\left(i\omega \right)$ determines the frequency response of an analog filter, while ${H}_{d}\left({e}^{i\theta }\right)$ determines the frequency response of a digital filter.)

Let $a=\angle B\left(i\omega \right)$. Then $\mathrm{tan}a=\frac{2\omega }{1-{\omega }^{2}}$, and hence

$\omega =\mathrm{tan}\left(a/2\right)$

(So $a=2\mathrm{arctan}\left(\omega \right)$.)

Now consider how the sampling rate is involved in a discrete system. As an example, let the sampling frequency be ${f}_{s}=44100$. Let $a=2\pi /{f}_{s}$. Then $x\left[n\right]=\mathrm{cos}\left(an\right)$ represents a sinusoid of frequency 1Hz; after 44100 samples, exactly one cycle has completed.

In general, for a digital system, we have that a sinusoid of frequency $f$ is represented by $\mathrm{cos}\left(an+b\right)$ where

$a=2\pi f/{f}_{s}$

From above, ${H}_{d}\left({e}^{ia}\right)={H}_{a}\left(i\mathrm{tan}\left(a/2\right)\right)={H}_{a}\left(i\mathrm{tan}\left(\pi f/{f}_{s}\right)\right)$

Suppose we wish to construct a digital filter that amplifies a particular frequency $f$ by a particular amount $G$, that is, we want ${H}_{d}\left({e}^{\mathrm{ia}}\right)=G$, where $a=2\pi f/{f}_{s}$. Then the analog filter we transform from must have its transfer function satisfying ${H}_{a}\left(i\mathrm{tan}\left(a/2\right)\right)=G$.