HOME

Filter

p5js Scroll

C_line [nF]:
R_line [ohms]:
C_in [uF]:
R_out [ohms]:

this is not a pi filter

Let us begin with a general T topology from p. 208 of Pozar(softcover Singapore edition)

This is the ABCD matrix:

$$ \left[ {\begin{array}{cc} A & B \\ C & D \\ \end{array} } \right]= \left[ {\begin{array}{cc} 1 + \frac{Z_1}{Z_3} & Z_1 + Z_2 + \frac{Z_1 Z_2}{Z_3} \\ \frac{1}{Z_3} & 1 + \frac{Z_2}{Z_3}\\ \end{array} } \right] $$

Now let us consider the following circuit:

A reasonable normal engineer type person would select the components in the schematic above using some sort of elaborate scheme for a desired outcome. We choose instead to make all capacitors the same and all resistors the same, appealing more to artistic than any kind of physical symmetry. This is not engineering.

The input segment can be modelled as a T like this:

$$ Z_1 = R - \frac{i}{\omega C} $$

$$ Z_2 = R $$

$$ Z_3 = \frac{R}{1 + i\omega RC} = \frac{R}{1 - \omega^2R^2C^2} - \frac{i\omega RC}{1 - \omega^2R^2C^2} $$

$$ Z_1 = R $$

$$ Z_2 = R - \frac{i}{\omega C} $$

$$ Z_3 = \frac{R}{1 + i\omega RC} = \frac{R}{1 - \omega^2R^2C^2} - \frac{i\omega RC}{1 - \omega^2R^2C^2} $$

For the output T we use the same matrix, but with the roles of the first two impedances reversed.

$$ \left[ {\begin{array}{cc} A & B \\ C & D \\ \end{array} } \right]= \\ \left[ {\begin{array}{cc} 3 + i\left(\omega RC - \frac{1}{\omega RC}\right) & 4R + i\left(\omega R^2C - \frac{1}{\omega C}\right) \\ \frac{1}{R} + i\omega C & 2 + i\omega RC \\ \end{array} } \right] $$

The device impedance $Z_{slime}$ is in parallel with a capacitor C, having total admittance to ground of

$$ Y = \frac{1}{Z_{SLIME}} + i\omega C $$

and the ABCD matrix for this device is

$$ \left[ {\begin{array}{cc} A & B \\ C & D \\ \end{array} } \right]= \left[ {\begin{array}{cc} 1 & 0 \\ \frac{1}{Z_{SLIME}} + i\omega C & 1\\ \end{array} } \right] $$

$$ \left[ {\begin{array}{cc} A & B \\ C & D \\ \end{array} } \right]= \left[ {\begin{array}{cc} 1 & 0 \\ \frac{1}{R_{out}} & 1 \\ \end{array} } \right] $$

$\omega = 2\pi f_{audio}$, and $f_{audio}$ is varied logarithmically from 1 Hz to 10 GHz. If we are plotting across a square graph which is [graphsize] wide and offset by [margin] from the left of the p5js canvas, the frequency in Hz as a function of position x is:

$$ f = 10^{10*(x-margin)/graphsize} $$

The S parameter $S_{21}$ for a device with known ABCD matrix is

$$ S_{21} = \frac{2}{A + B/Z_0 + CZ_0 + D} $$

We will want to display insertion loss in dB and have 0 be the top of the screen and the bottom be -100 dB, so that the y value associated with a given scattering parameter

$$ y = [\textrm{margin}] - 20\left(\frac{[\textrm{graphsize}]}{100}\right)\log_{10}(|S_{21}|) $$