# Going from digital to analog filters

I've been learning about digital signal processing for some time, and I understand the principles in the digital world, as well as the conversion of continuous filters in the s-domain to digital filters in the z-domain.

I'd love to learn more about the process of designing analog filters and converting this into circuits that I can try and test. Since I cannot brag about my knowledge in electronics, with the exception of a little experience dabbling with Arduino projects, I don't see how an equation in the s-domain can be translated to a circuit. From what little I have found, most sources go the other way, taking a circuit and analysing it in the s-domain, and the equations that are given usually aren't explained how they came about. This makes it somewhat hard to understand the relationship between the math and circuits. As far as I understand, the sources generally have equations readily available for simple circuits, and rely mostly on theory of parallel and serial filters to derive larger circuits — is this correct? If so, is this the be all end all method of creating larger circuits, or what is the "correct" approach?

My goal with this is to 1) gain a better understanding of designing analog filters, and 2) take my own filters and make circuits for say guitar pedals and similar applications.

To be honest, I'd love to take any shortcut methods (minimal reading, maximum hands-on and results for motivation), such that I can get some circuits going right away, and then later take a deeper learning approach later on. Similarly, any "catches" or "gotya's" that I need to know about circuits, such that I don't end up blowing myself up, would be nice to know about ahead of time.

What is your recommended learning route to get started as fast as possible? Do you have any recommended material (articles, books, videos, etc.) for a speedy start?

The main trick is knowing how typical lumped circuit element impedances are represented in the $s$-domain. Recall the current-voltage relationship for a capacitor:

$$i(t) = C \frac{dv(t)}{dt}$$

Transforming this to the Laplace domain yields:

$$I(s) = CsV(s)$$

Note that voltage and current still have a proportional relationship in this domain, just like the time domain. This allows us to write a (frequency-dependent) $s$-domain impedance for the capacitor. This impedance can be used with Ohm's law and techniques like nodal analysis to calculate what a circuit's Laplace-domain output would be for a given Laplace-domain input signal (e.g. an impulse, whose Laplace transform is unity).

For a capacitor, this impedance is:

$$Z(s) = \frac{V(s)}{I(s)} = \frac{1}{Cs}$$

This gives capacitors their known highpass characteristic; for $s=j\omega$, as $\omega$ gets larger, the impedance gets smaller. For the limiting case of $\omega=0$, $Z(0) = \infty$; a capacitor passes no DC current.

We can follow the same procedure for an inductor, starting with its current-voltage relationship:

$$v(t) = L\frac{di(t)}{dt}$$

Apply the Laplace transform:

$$V(s) = LsI(s)$$

and again, we can calculate the inductor's $s$-domain impedance:

$$Z(s) = \frac{V(s)}{I(s)} = Ls$$

As the dual to capacitors, inductors have a lowpass characteristic. For small frequencies ($s \to 0$), $Z(s) \to 0$ as well.

Given these impedances, it becomes very straightforward to apply basic circuit analysis techniques to determine the $s$-domain transfer function of a network containing resistors, capacitors, and inductors.

• I think he's asking about the other way around: going from a given $s$ domain function $H(s)$ to a circuit realization of it ? – Fat32 Oct 19 '17 at 14:14
• I was, indeed. But since this is the predominant way articles are oriented, I suspect it is common to teach it that way first. I found the answer very helpful in its concise simplicity though! – Casper B. Hansen Oct 19 '17 at 14:36
• @CasperB.Hansen Have you seen the book Analog and Digital Filter Design and Realization by LAM ? It discusses the circuit realization from a given transfer function. It discusses exactly what you look for but is a little advanced though... Or otherwise you shall look for the phrase Analog Circuit Synthesis or filter realization tags. – Fat32 Oct 19 '17 at 15:01
• @Fat32 No, I have no books that deal with circuitry. I'll look it up, and perhaps add it to my wishlist for christmas :) I assume that by advanced you mean my background doesn't meet the prerequisites to be able to understand it? In that case, what do I need to read up on? I assume these missing prerequisites are in the electronics topic? Thanks! :) – Casper B. Hansen Oct 19 '17 at 15:18
• @Fat32 Ah, I see — it's usually only boring up 'till the point where you can apply it, hence my request here to get a jump-start, heh :P My background is in computer science. My B.Sc. thesis revolves around signals and systems, Fourier and filter design :) With patience I'm sure I can handle it, although I bet there is probably a lot of electronics jargon I'll have to adjust to :) It sounds really good! – Casper B. Hansen Oct 19 '17 at 16:26

As far as I understand, the sources generally have equations readily available for simple circuits, and rely mostly on theory of parallel and serial filters to derive larger circuits — is this correct? If so, is this the be all end all method of creating larger circuits, or what is the "correct" approach?

Pretty much. In the analog domain you still typically want to use cascaded second-order sections for accuracy, just like you do in the digital domain. The various standard biquad blocks (Sallen-Key) have been around for a long time, so you just copy and paste them, put as many blocks in your circuit as you need, and choose their component values to create the transfer function you want.

You need to group the poles and zeros so that each stage has optimum dynamic range. You don't want a huge peak in the frequency response of one stage that will clip the signal, followed by a big notch that will attenuate it back down to flat overall.

Within a stage, usually the ratios between the components are what's important, so there are an infinite number of circuits with the same transfer function. You choose the absolute values of the components for other reasons, like minimizing noise, distortion of the op-amp, power/current limits, etc.

• Thank you, my suspicions were somewhat on to the technique then. The last point about ratios rather than definite values clears up another confusion I've been having, but didn't mention in the question. Thanks! :) – Casper B. Hansen Oct 19 '17 at 14:40

So you can implement an analog transfer function that is a rational function of $s$ using a canonical form just like the Direct Form II: but instead of a unit sample delay $z^{-1}$, you replace that with an analog integrator $s^{-1}$. the integrators are little circuits with an op-amp, capacitor, and resistor:

the transfer function of the integrator is $\frac{-1}{RC} s^{-1}$. that $\frac{-1}{RC}$ becomes a factor of the feedback and feedforward coefficients.

and you replace $x(n)$ with $x(t)$ and similarly to all other signals. for your adder (or subtractor) circuit, something like this: the large case Vn are added and the lower case vm are subtracted and the coefficient is inversely proportional to the resistance (Rn, rm). keep in mind the minus sign you pick up from the integrators.

the transfer function turns out just like in the digital filter except it's $H(s)$ instead of $H(z)$

\begin{align} H(s) &= \frac{b_0 + b_1 s^{-1} + b_2 s^{-2}}{1 + a_1 s^{-1} + a_2 s^{-2}} \\ \\ &= \frac{b_0 s^2 + b_1 s + b_2}{s^2 + a_1 s + a_2} \\ \end{align}

and if you have a digital filter that works pretty good for you, you can map it to an $s$-plane filter using the bilinear transform in reverse.

• This was a really nice way of relating what I know to where I want to go :D And simplistic, I loved it! — Thank you! :D – Casper B. Hansen Oct 20 '17 at 16:54