HOME

Filter

plotting Scroll

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

this is a sequence of n poles of a resistance R and then a capacitance to ground C. We might or might not have an input capacitor Cin and an output resistor Rout.

Each unit of the filter is like this:

$$ \left[ {\begin{array}{cc} A & B \\ C & D \\ \end{array} } \right]= \left[ {\begin{array}{cc} 1+ i\omega R_{line}C_{line} & R_{line} \\ i\omega C_{line} & 1 \\ \end{array} } \right] $$

The input capacitor looks like this:

$$ \left[ {\begin{array}{cc} A & B \\ C & D \\ \end{array} } \right]= \left[ {\begin{array}{cc} 1 & \frac{-i}{\omega C_{in}} \\ 0 & 1 \\ \end{array} } \right] $$

The output resistor looks like this:

$$ \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}|) $$