neil's webbly world

me@njohnson.co.uk
learn Russian

# ABCD To Z And Back

A little while back I was reminded of the ABCD matrix during a discussion on the synth-diy mailing list. While they have been around for decades their power and simplicity is perfect for design and analysis of passive filter networks. On this page I bring together the theory of the ABCD matrix, and show how it can be used to solve seemingly-complex passive networks using nothing more than 2x2 matrices. And along the way we'll use computers to do the tedious algebraic crunching.

## A To D Via B And C

The ABCD Matrix (or Chain Matrix or Transmission Matrix) describes a two-port network: a box with a two-wire port on the left and a two-wire port on the right.

One peculiarity of the ABCD matrix as compared to the other two-port networks is the direction of the current flow on the second port is reversed (those familiar with two-port networks would have spotted the "wrong" sign of I2 already). The importance of this subtle distinction comes to light when we cascade - or chain - two networks whereupon the output current of the first network becomes the input current of the second network without tedious sign-changing to worry about.

The A, B, C and D refer to the names of the four components of the ABCD matrix. First we write out the matrices in full:

$$\left[ \begin{array}{c} V_1 \\ I_1 \\ \end{array} \right] = \left[ \begin{array}{cc} A & B \\ C & D \\ \end{array} \right] \left[ \begin{array}{c} V_2 \\ I_2 \\ \end{array} \right]$$

From here we can write down the expressions for V1 and I1:

$$\begin{array}{rcl} V_1 &=& AV_2 + BI_2 \\ I_1 &=& CV_2 + DI_2 \end{array}$$

By setting V2 or I2 to zero (short-circuit or open-circuit respectively) we can derive simple expressions for the four terms:

$$\begin{array}{cc} A = \left.\frac{V_1}{V_2}\right|_{I_2=0} & B = \left.\frac{V_1}{I_2}\right|_{V_2=0}\\ C = \left.\frac{I_1}{V_2}\right|_{I_2=0} & D = \left.\frac{I_1}{I_2}\right|_{V_2=0}\\ \end{array}$$

Components A and D are dimensionless ratios, B is in Ohms, and C is in Siemens.

A network is said to be symmetrical (input impedance equals output impedance) if A = D. A network is reciprocal if AD - BC = 1; that is, the voltage at port 2 when a current is applied to port 1 is the same as the voltage at port 1 when the same current is applied to port 2.

## Chaining

Now consider two networks chained together:

Starting from the left side of the circuit we have

$$\left[ \begin{array}{c} V_1 \\ I_1 \\ \end{array} \right] = \left[ \begin{array}{cc} A_1 & B_1 \\ C_1 & D_1 \\ \end{array} \right] \left[ \begin{array}{c} V_2 \\ I_2 \\ \end{array} \right]$$

and then

$$\left[ \begin{array}{c} V_2 \\ I_2 \\ \end{array} \right] = \left[ \begin{array}{cc} A_2 & B_2 \\ C_2 & D_2 \\ \end{array} \right] \left[ \begin{array}{c} V_3 \\ I_3 \\ \end{array} \right]$$

Chaining the two together we get

$$\left[ \begin{array}{c} V_1 \\ I_1 \\ \end{array} \right] = \left[ \begin{array}{cc} A_1 & B_1 \\ C_1 & D_1 \\ \end{array} \right] \left[ \begin{array}{cc} A_2 & B_2 \\ C_2 & D_2 \\ \end{array} \right] \left[ \begin{array}{c} V_3 \\ I_3 \\ \end{array} \right]$$

Note that the order of multiplication is important in matrix math so make sure you follow the order as described by the circuit.

## Simple Networks

There are just two basic networks to consider - what we might call the canonical forms. These are the series element and the shunt element.

#### Series Element

The series element has one impedance - Z - in series with two of the port connections. The convention is as shown below although there is no reason it cannot be in the bottom connection.

If we now consider the four matrix terms by examining the circuit with the right-hand port open- and close-circuited then we find the corresponding matrix to be:

$$\left[ \begin{array}{cc} 1 & Z \\ 0 & 1 \\ \end{array} \right]$$

#### Shunt Element

Similarly, the shunt element has one impedance connected across, or shunting, the two sets of connections:

From which we can derive the matrix as:

$$\left[ \begin{array}{cc} 1 & 0 \\ \frac{1}{Z} & 1 \\ \end{array} \right]$$

### Worked Example: RC Low Pass Filter

To illustrate how ABCD matrices are applied we show how the transfer function of the well-known RC low-pass filter can be derived from a chain of a series resistor and a shunt capacitor.

$$\left[ \begin{array}{c} V_{\textit{in}} \\ I_{\textit{in}} \\ \end{array} \right] = \left[ \begin{array}{cc} 1 & R \\ 0 & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1 & 0 \\ sC & 1 \\ \end{array} \right] \left[ \begin{array}{c} V_{\textit{out}} \\ I_{\textit{out}} \\ \end{array} \right]$$

After matrix multiplication we get

$$\left[ \begin{array}{c} V_{\textit{in}} \\ I_{\textit{in}} \\ \end{array} \right] = \left[ \begin{array}{cc} 1+sCR & R \\ sC & 1 \\ \end{array} \right] \left[ \begin{array}{c} V_{\textit{out}} \\ I_{\textit{out}} \\ \end{array} \right]$$

If we assume that the output of the resulting network connects to a high-impedance circuit (e.g., op-amp buffer) then we can use the A term as simply the inverse of the transfer function of the network:

$$\begin{array}{rcl} H(s) &=& \frac{1}{A} \\ A &=& 1 + sCR \\ \therefore H(s) &=& \frac{1}{1 + sCR} \\ \end{array}$$

which is the well-known transfer function of an RC low-pass filter.

## Running In Parallel

ABCD matrices work fine for chaining two or more networks in series, but are rather difficult for parallel networks (e.g., twin-T notch filter). The solution is to use Y (admittance) networks as an intermediate step, converting the two ABCD matrices into Y matrices, adding them, and then converting the resulting Y matrix back into an ABCD matrix.

From Frickey:

$$\begin{array}{rcl} Y_{11} &=& \frac{D}{B} \\ Y_{12} &=& \frac{(BC-AD)}{B} \\ Y_{21} &=& \frac{-1}{B} \\ Y_{22} &=& \frac{A}{B} \\ \end{array}$$

and the inverses

$$\begin{array}{rcl} A &=& \frac{-Y_{22}}{Y_{21}} \\ B &=& \frac{-1}{Y_{21}} \\ C &=& \frac{(Y_{12}Y_{21} - Y_{11}Y_{22})}{Y_{21}} \\ D &=& \frac{-Y_{11}}{Y_{21}} \\ \end{array}$$

## Practical Examples

### 4-Stage RC Low Pass Filter

Given that we have just seen how the classic RC filter can be analysed with the help of the ABCD matrix let's take a look at a more involved example. Consider the 4-stage unbuffered RC filter in the paper by Electronotes/Hutchins (ELECTRONOTES 210 Vol. 22 May 2012). The filter in question is reproduced below:

This circuit comprises four RC sections in cascade. According to the author:

I don't know how many times I have started out to actually solve the unbuffered case (A). I always gave up, even after dropping back to the case where all the R's and all the C's were equal. It clearly was not impossible - just excessively tedious.

We previously computed the ABCD matrix for a single RC section, so the solution is the multiplication of four RC sections:

$$\left[ \begin{array}{c} V_\textit{in} \\ I_\textit{in} \\ \end{array} \right] = \left[ \begin{array}{cc} 1+sC_1R_1 & R_1 \\ sC_1 & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1+sC_2R_2 & R_2 \\ sC_2 & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1+sC_3R_3 & R_3 \\ sC_3 & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1+sC_4R_4 & R_4 \\ sC_4 & 1 \\ \end{array} \right] \left[ \begin{array}{c} V_\textit{out} \\ I_\textit{out} \\ \end{array} \right]$$

Expanding out the multiplication would be rather tedious by hand, so we use maxima to do the algebraic gymnastics for us. Setting all resistors equal and all capacitors equal simplifies the transfer function to the following expression:

$$\frac{1}{s^4C^4R^4 + 7s^3C^3R^3 + 15s^2C^2R^2 + 10sCR + 1}$$

Factorising this we can determine the locations of the poles:

$$\frac{1}{(sCR + 1)(s^3C^3R^3 + 6s^2C^2R^2 + 9sCR + 1)}$$

The first term is the familiar RC low-pass filter we derived above. The second term is rather more complex. If we rewrite the term substituting $$p = sCR$$ then we have a simple cubic expression $$p^3 + 6p^2 + 9p + 1$$. Using any one of the online cubic solvers we find the three values for $$p = -0.121, -2.347, -3.532$$. Notice that they are all real, i.e., lie on the real axis.

We can now write down the three poles as: $$(p + 0.121)(p + 2.347)(p + 3.532)$$. Substituting back we get $$(sCR + 0.121)(sCR + 2.347)(sCR + 3.532)$$. Finally we can write down the transfer function:

$$\frac{1}{(sCR + 1)(sCR + 0.121)(sCR + 2.347)(sCR + 3.532)}$$

For the plot below we set R to 1k0, C to 100n and sweep over the range 1Hz to 100kHz.

To confirm these results an AC simulation was run in LTSpice confirming the theoretical filter behaviour:

Some interesting observations can be made from the spice plot. Firstly, note that at around 2kHz the phase (dashed line) reaches 180° of phase shift. In other words a 2kHz sine wave is inverted, albeit reduced in amplitude by about 26dB (roughly 1/20th of the input level). Secondly, the phase shift continues heading towards 360° - by the time the frequency reaches around 1MHz the phase shift is very close to 360°, although this far from the cutoff point the attenuation is around 200dB. Things get rather theoretical down at this level!

--

A little while after publishing the above analysis Hutchins wrote a response published as ENWN42. While taking a slightly different route to the common-RC solution he arrives at the same point, and extends the work by plotting the root-locus of the filter in the presence of feedback.

### Twin-T Filter

The classic twin-T filter is a purely RC circuit that can produce a very sharp notch response. It (or its close cousin the bridged-T) is often used in audio analysers to remove the fundamental signal. The circuit is remarkably simple, yet theoretically can achieve very deep notches.

As can be seen the circuit comprises two T-sections (one RCR the other CRC) wired in parallel. On one branch the current leads, and on the other the current lags. As the frequency approaches the notch frequency the phase shifts approach ±90° effectively cancelling each other out at the summing node. If all the components were ideal then the cancellation would be perfect.

Analysis proceeds by considering each of the T-sections in turn. To facilitate the operations in Maxima I use these two definitions to convert between ABCD and Y matrices:

abcd_to_y(m) := matrix([m[2,2]/m[1,2], (m[1,2]*m[2,1] - m[1,1]*m[2,2])/m[1,2]],[-1/m[1,2], m[1,1]/m[1,2]]);

y_to_abcd(y) := matrix([-y[2,2]/y[2,1],-1/y[2,1]],[(y[1,2]*y[2,1] - y[1,1]*y[2,2])/y[2,1],-y[1,1]/y[2,1]]);

The first section, comprising R1, C1 and R2, is described by three chained matrices:

$$\left[ \begin{array}{c} V_\textit{in} \\ I_\textit{in} \\ \end{array} \right] = \left[ \begin{array}{cc} 1 & R_1 \\ 0 & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1 & 0 \\ sC_1 & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1 & R_2 \\ 0 & 1 \\ \end{array} \right] \left[ \begin{array}{c} V_\textit{out} \\ I_\textit{out} \\ \end{array} \right]$$

The second section, comprising C2, R3 and C3, produces

$$\left[ \begin{array}{c} V_\textit{in} \\ I_\textit{in} \\ \end{array} \right] = \left[ \begin{array}{cc} 1 & \frac{1}{sC_2} \\ 0 & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1 & 0 \\ \frac{1}{R_3} & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1 & \frac{1}{sC_3} \\ 0 & 1 \\ \end{array} \right] \left[ \begin{array}{c} V_\textit{out} \\ I_\textit{out} \\ \end{array} \right]$$

For the next step we compute the ABCD matrices for the two sections, then use abcd_to_y() and y_to_abcd():

$$\begin{array}{rcl} \textit{RCR} &=& \left[ \begin{array}{cc} 1 & R_1 \\ 0 & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1 & 0 \\ sC_1 & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1 & R_2 \\ 0 & 1 \\ \end{array} \right] \\ \textit{CRC} &=& \left[ \begin{array}{cc} 1 & \frac{1}{sC_2} \\ 0 & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1 & 0 \\ \frac{1}{R_3} & 1 \\ \end{array} \right] \left[ \begin{array}{cc} 1 & \frac{1}{sC_3} \\ 0 & 1 \\ \end{array} \right] \\ Y_\textit{RCR} &=& \mathtt{abcd\_to\_y}(\textit{RCR}) \\ Y_\textit{CRC} &=& \mathtt{abcd\_to\_y}(\textit{CRC}) \\ Y_\textit{TT} &=& Y_\textit{RCR} + Y_\textit{CRC} \\ \textit{TT} &=& \mathtt{y\_to\_abcd}(Y_\textit{TT}) \end{array}$$

The result is rather complicated, so we won't show it here. What we are interested in is the transfer function, which is:

$$\textit{TF}(s) = {{-{{1}\over{{\it R_1}\,\left(1+s\,{\it C_1}\,{\it R_2}\right)+ {\it R_2}}}-{{1}\over{{{1+{{1}\over{s\,{\it C_3}\,{\it R_3}}}}\over{ s\,{\it C_2}}}+{{1}\over{s\,{\it C_3}}}}}}\over{-{{1+{{1}\over{s\, {\it C_2}\,{\it R_3}}}}\over{{{1+{{1}\over{s\,{\it C_3}\,{\it R_3}}} }\over{s\,{\it C_2}}}+{{1}\over{s\,{\it C_3}}}}}-{{1+s\,{\it C_1}\, {\it R_1}}\over{{\it R_1}\,\left(1+s\,{\it C_1}\,{\it R_2}\right)+ {\it R_2}}}}}$$

Still quite a handful, so we apply the usual simplification setting $$R1 = R, R2 = R, R3 = R/2$$ and $$C1 = 2C, C2 = C, C3 = C$$.

$${TF(s)}={{1+s^2\,C^2\,R^2}\over{s^2\,C^2\,R^2+4\,s\,C\,R+1}}$$

That looks more tractable. If we then expand out $$s = j\omega$$ we get

$${TF(s)}={{1-\omega^2\,C^2\,R^2}\over{-\omega^2\,C^2\,R^2+4\,j\,\omega\,C\,R+1}}$$

For a notch filter (band reject) we are interested in the frequency at which the transfer function is zero (infinite attenuation). For this we need only find when the numerator is equal to zero:

$$1-\omega^2\,C^2\,R^2=0$$

Finally we can determine the relationship between f, C, and R:

$$\begin{array}{c} \omega^2\,C^2\,R^2 = 1\\ \omega CR = 1 \\ \omega = \frac{1}{CR} \\ \end{array}$$

Substituting $$\omega = 2\pi f$$ leads us to $$f = \frac{1}{2 \pi CR}$$

which is the expected result.

### Conclusion

In this section we have seen how the ABCD matrices can be used together with automated tools (maxima in this case) to analyse the behaviour of passive component networks. While intermediate results may look scary, in practice we are primarily interested in the transfer function which is readily extracted from the ABCD matrix.

As an aside, there may be readers thinking "Ah yes, but what if there is an inverting op-amp on the output, so we can't assume that $$I_2$$ is zero. What then smarty-pants?". In that specific case you can model the input resistance of the inverting amplifier stage as a final shunt resistor and then you can either consider the output voltage, as before, or determine the current through the resistor as the current into the transimpedance (current-in-voltage-out) amplifier.