This is a tank circuit with an input and output capacitor as follows:
C_tank [uF]: | |
C_in [uF]: | |
L_tank [mH]: |
$$ \left[ {\begin{array}{cc} A_1 & B_1 \\ C_1 & D_1 \\ \end{array} } \right]= \left[ {\begin{array}{cc} 1 & \frac{-i}{\omega C_{in}} \\ 0 & 1 \\ \end{array} } \right] $$ $$ \left[ {\begin{array}{cc} A_2 & B_2 \\ C_2 & D_2 \\ \end{array} } \right]= \left[ {\begin{array}{cc} 1 & 0 \\ i\omega C_{tank} & 1 \\ \end{array} } \right] $$ $$ \left[ {\begin{array}{cc} A_3 & B_3 \\ C_3 & D_3 \\ \end{array} } \right]= \left[ {\begin{array}{cc} 1 & 0 \\ \frac{-i}{\omega L_{tank}} & 1 \\ \end{array} } \right] $$ $$ \left[ {\begin{array}{cc} A_4 & B_4 \\ C_4 & D_4 \\ \end{array} } \right]= \left[ {\begin{array}{cc} 1 & \frac{-i}{\omega C_{in}} \\ 0 & 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}|) $$