from sympy import *
import numpy as np
from tabulate import tabulate
from scipy import signal
import matplotlib.pyplot as plt
import SymMNA
from IPython.display import display, Markdown, Math, Latex
init_printing()16 Elliptic Function LPF
The circuit shown above is an elliptic function low pass filter. The design of elliptic filters is somewhat complex and usually involves the use of tables found in filter design handbooks. An elliptic filter, also known as a Cauer filter, is a signal processing filter designed to have equal ripple characteristics in both its passband and its stopband. Its defining advantage is achieving the steepest possible transition (or roll-off rate) between the passband and stopband for a given filter order, significantly outperforming Butterworth and Chebyshev filters in selectivity. However, this high performance comes at the cost of passband and stopband ripples, as well as a highly non-linear phase response that can introduce phase distortion in time-domain signals.
Initially I was thinking that with a symbolic solution of the equations and the use of SciPy’s filter functions to obtain the pole and zero locations, I could derive the element values for active elliptic filters. But since the subject of this book is MNA and not filter design, only the analysis of the filter is described.
16.1 Circuit description
The circuit in Figure 16.1 has 13 branches and 7 nodes. There are 12 passive components and one OpAmp. The circuit is from Williams and Taylor (1995), example 3-26, and is an elliptic function low pass filter with a cutoff frequency of 100 Hz. The schematic for the filter was entered into LTSpice and an the following netlist was obtained.
R3 3 0 4750
R4 5 0 73.2k
R1 4 1 9530
R2 5 4 9530
R7 2 7 10k
C1 3 1 0.05µ
C2 5 3 0.05µ
C3 7 4 0.1µ
C4 5 0 0.22µ
C5 2 0 0.18µ
XU1 6 5 7 opamp Aol=100K GBW=10Meg
V1 1 0 AC 1
R6 7 6 44.2k
R5 6 0 10k
The following Python modules are used in this notebook.
16.1.1 Network equations
The netlist generated by LTSpice is pasted into the cell below and some edits were made to fix up the formating of the component values and the OpAmp declaration.
example_net_list = '''
R3 3 0 4750
R4 5 0 73.2e3
R1 4 1 9530
R2 5 4 9530
R7 2 7 10e3
C1 3 1 0.05e-6
C2 5 3 0.05e-6
C3 7 4 0.1e-6
C4 5 0 0.22e-6
C5 2 0 0.18e-6
O1 6 5 7
V1 1 0 1
R6 7 6 44.2e3
R5 6 0 10e3
'''Callin smna() to generate the network equations.
report, network_df, df2, A, X, Z = SymMNA.smna(example_net_list)
# Put matricies into SymPy
X = Matrix(X)
Z = Matrix(Z)
NE_sym = Eq(A*X,Z)
# turn the free symbols into SymPy variables.
var(str(NE_sym.free_symbols).replace('{','').replace('}',''))
# built a dictionary of element values.
element_values = SymMNA.get_part_values(network_df)Generate markdown text to display the network equations.
temp = ''
for i in range(len(X)):
temp += '${:s}$<br>'.format(latex(Eq((A*X)[i:i+1][0],Z[i])))
Markdown(temp)\(- C_{1} s v_{3} + I_{V1} + v_{1} \left(C_{1} s + \frac{1}{R_{1}}\right) - \frac{v_{4}}{R_{1}} = 0\)
\(v_{2} \left(C_{5} s + \frac{1}{R_{7}}\right) - \frac{v_{7}}{R_{7}} = 0\)
\(- C_{1} s v_{1} - C_{2} s v_{5} + v_{3} \left(C_{1} s + C_{2} s + \frac{1}{R_{3}}\right) = 0\)
\(- C_{3} s v_{7} + v_{4} \left(C_{3} s + \frac{1}{R_{2}} + \frac{1}{R_{1}}\right) - \frac{v_{5}}{R_{2}} - \frac{v_{1}}{R_{1}} = 0\)
\(- C_{2} s v_{3} + v_{5} \left(C_{2} s + C_{4} s + \frac{1}{R_{4}} + \frac{1}{R_{2}}\right) - \frac{v_{4}}{R_{2}} = 0\)
\(v_{6} \left(\frac{1}{R_{6}} + \frac{1}{R_{5}}\right) - \frac{v_{7}}{R_{6}} = 0\)
\(- C_{3} s v_{4} + I_{O1} + v_{7} \left(C_{3} s + \frac{1}{R_{7}} + \frac{1}{R_{6}}\right) - \frac{v_{2}}{R_{7}} - \frac{v_{6}}{R_{6}} = 0\)
\(v_{1} = V_{1}\)
\(- v_{5} + v_{6} = 0\)
As shown above MNA generated many equations and these would be difficult to solve by hand and a symbolic soultion would take a lot of computing time.
16.2 Symbolic solution
The SymPy function solve can be used to deterermine the unknown node voltages and device currents. %%time is a built-in cell magic command in IPython and Jupyter environments used to measure the execution time of an entire block of code.
%%time
U_sym = solve(NE_sym,X)CPU times: user 2.05 s, sys: 3.02 ms, total: 2.06 s
Wall time: 2.06 s
Display the solution.
temp = ''
for i in U_sym.keys():
temp += '${:s} = {:s}$<br>'.format(latex(i),latex(U_sym[i]))
Markdown(temp)\(I_{O1} = \frac{- C_{1} C_{2} C_{3} C_{5} R_{1} R_{2} R_{3} R_{4} R_{5} V_{1} s^{4} - C_{1} C_{2} C_{3} C_{5} R_{1} R_{2} R_{3} R_{4} R_{6} V_{1} s^{4} - C_{1} C_{2} C_{3} C_{5} R_{1} R_{2} R_{3} R_{4} R_{7} V_{1} s^{4} - C_{1} C_{2} C_{3} C_{5} R_{1} R_{3} R_{4} R_{6} R_{7} V_{1} s^{4} - C_{1} C_{2} C_{3} C_{5} R_{2} R_{3} R_{4} R_{6} R_{7} V_{1} s^{4} - C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} V_{1} s^{3} - C_{1} C_{2} C_{3} R_{1} R_{3} R_{4} R_{6} V_{1} s^{3} - C_{1} C_{2} C_{3} R_{2} R_{3} R_{4} R_{6} V_{1} s^{3} - C_{1} C_{2} C_{5} R_{1} R_{3} R_{4} R_{5} V_{1} s^{3} - C_{1} C_{2} C_{5} R_{1} R_{3} R_{4} R_{6} V_{1} s^{3} - C_{1} C_{2} C_{5} R_{1} R_{3} R_{4} R_{7} V_{1} s^{3} - C_{1} C_{2} C_{5} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} - C_{1} C_{2} C_{5} R_{2} R_{3} R_{4} R_{6} V_{1} s^{3} - C_{1} C_{2} C_{5} R_{2} R_{3} R_{4} R_{7} V_{1} s^{3} - C_{1} C_{2} R_{1} R_{3} R_{4} V_{1} s^{2} - C_{1} C_{2} R_{2} R_{3} R_{4} V_{1} s^{2} + C_{1} C_{3} C_{4} C_{5} R_{2} R_{3} R_{4} R_{5} R_{7} V_{1} s^{4} + C_{1} C_{3} C_{4} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} + C_{1} C_{3} C_{5} R_{2} R_{3} R_{5} R_{7} V_{1} s^{3} - C_{1} C_{3} C_{5} R_{3} R_{4} R_{6} R_{7} V_{1} s^{3} + C_{1} C_{3} R_{2} R_{3} R_{5} V_{1} s^{2} - C_{1} C_{3} R_{3} R_{4} R_{6} V_{1} s^{2} - C_{1} C_{5} R_{3} R_{4} R_{5} V_{1} s^{2} - C_{1} C_{5} R_{3} R_{4} R_{6} V_{1} s^{2} - C_{1} C_{5} R_{3} R_{4} R_{7} V_{1} s^{2} - C_{1} R_{3} R_{4} V_{1} s + C_{2} C_{3} C_{4} C_{5} R_{2} R_{3} R_{4} R_{5} R_{7} V_{1} s^{4} + C_{2} C_{3} C_{4} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} + C_{2} C_{3} C_{5} R_{2} R_{3} R_{5} R_{7} V_{1} s^{3} + C_{2} C_{3} C_{5} R_{2} R_{4} R_{5} R_{7} V_{1} s^{3} - C_{2} C_{3} C_{5} R_{3} R_{4} R_{6} R_{7} V_{1} s^{3} + C_{2} C_{3} R_{2} R_{3} R_{5} V_{1} s^{2} + C_{2} C_{3} R_{2} R_{4} R_{5} V_{1} s^{2} - C_{2} C_{3} R_{3} R_{4} R_{6} V_{1} s^{2} - C_{2} C_{5} R_{3} R_{4} R_{5} V_{1} s^{2} - C_{2} C_{5} R_{3} R_{4} R_{6} V_{1} s^{2} - C_{2} C_{5} R_{3} R_{4} R_{7} V_{1} s^{2} - C_{2} R_{3} R_{4} V_{1} s + C_{3} C_{4} C_{5} R_{2} R_{4} R_{5} R_{7} V_{1} s^{3} + C_{3} C_{4} R_{2} R_{4} R_{5} V_{1} s^{2} + C_{3} C_{5} R_{2} R_{5} R_{7} V_{1} s^{2} - C_{3} C_{5} R_{4} R_{6} R_{7} V_{1} s^{2} + C_{3} R_{2} R_{5} V_{1} s - C_{3} R_{4} R_{6} V_{1} s - C_{5} R_{4} R_{5} V_{1} s - C_{5} R_{4} R_{6} V_{1} s - C_{5} R_{4} R_{7} V_{1} s - R_{4} V_{1}}{C_{1} C_{2} C_{3} C_{5} R_{1} R_{2} R_{3} R_{4} R_{5} R_{7} s^{4} + C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{2} C_{5} R_{1} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{1} C_{2} C_{5} R_{2} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{3} C_{4} C_{5} R_{1} R_{2} R_{3} R_{4} R_{5} R_{7} s^{4} + C_{1} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{3} C_{5} R_{1} R_{2} R_{3} R_{5} R_{7} s^{3} - C_{1} C_{3} C_{5} R_{1} R_{3} R_{4} R_{6} R_{7} s^{3} + C_{1} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} - C_{1} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{1} C_{4} C_{5} R_{1} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{1} C_{4} C_{5} R_{2} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{1} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{5} R_{1} R_{3} R_{5} R_{7} s^{2} + C_{1} C_{5} R_{2} R_{3} R_{5} R_{7} s^{2} + C_{1} C_{5} R_{3} R_{4} R_{5} R_{7} s^{2} + C_{1} R_{1} R_{3} R_{5} s + C_{1} R_{2} R_{3} R_{5} s + C_{1} R_{3} R_{4} R_{5} s + C_{2} C_{3} C_{4} C_{5} R_{1} R_{2} R_{3} R_{4} R_{5} R_{7} s^{4} + C_{2} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{2} C_{3} C_{5} R_{1} R_{2} R_{3} R_{5} R_{7} s^{3} + C_{2} C_{3} C_{5} R_{1} R_{2} R_{4} R_{5} R_{7} s^{3} - C_{2} C_{3} C_{5} R_{1} R_{3} R_{4} R_{6} R_{7} s^{3} + C_{2} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} + C_{2} C_{3} R_{1} R_{2} R_{4} R_{5} s^{2} - C_{2} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{2} C_{4} C_{5} R_{1} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{2} C_{4} C_{5} R_{2} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{2} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{2} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{2} C_{5} R_{1} R_{3} R_{5} R_{7} s^{2} + C_{2} C_{5} R_{1} R_{4} R_{5} R_{7} s^{2} + C_{2} C_{5} R_{2} R_{3} R_{5} R_{7} s^{2} + C_{2} C_{5} R_{2} R_{4} R_{5} R_{7} s^{2} + C_{2} C_{5} R_{3} R_{4} R_{5} R_{7} s^{2} + C_{2} R_{1} R_{3} R_{5} s + C_{2} R_{1} R_{4} R_{5} s + C_{2} R_{2} R_{3} R_{5} s + C_{2} R_{2} R_{4} R_{5} s + C_{2} R_{3} R_{4} R_{5} s + C_{3} C_{4} C_{5} R_{1} R_{2} R_{4} R_{5} R_{7} s^{3} + C_{3} C_{4} R_{1} R_{2} R_{4} R_{5} s^{2} + C_{3} C_{5} R_{1} R_{2} R_{5} R_{7} s^{2} - C_{3} C_{5} R_{1} R_{4} R_{6} R_{7} s^{2} + C_{3} R_{1} R_{2} R_{5} s - C_{3} R_{1} R_{4} R_{6} s + C_{4} C_{5} R_{1} R_{4} R_{5} R_{7} s^{2} + C_{4} C_{5} R_{2} R_{4} R_{5} R_{7} s^{2} + C_{4} R_{1} R_{4} R_{5} s + C_{4} R_{2} R_{4} R_{5} s + C_{5} R_{1} R_{5} R_{7} s + C_{5} R_{2} R_{5} R_{7} s + C_{5} R_{4} R_{5} R_{7} s + R_{1} R_{5} + R_{2} R_{5} + R_{4} R_{5}}\)
\(I_{V1} = \frac{- C_{1} C_{2} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} V_{1} s^{4} - C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{5} V_{1} s^{3} - C_{1} C_{2} C_{3} R_{1} R_{2} R_{4} R_{5} V_{1} s^{3} + C_{1} C_{2} C_{3} R_{1} R_{3} R_{4} R_{6} V_{1} s^{3} + C_{1} C_{2} C_{3} R_{2} R_{3} R_{4} R_{6} V_{1} s^{3} - C_{1} C_{2} C_{4} R_{1} R_{3} R_{4} R_{5} V_{1} s^{3} - C_{1} C_{2} C_{4} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} - C_{1} C_{2} R_{1} R_{3} R_{5} V_{1} s^{2} - C_{1} C_{2} R_{1} R_{4} R_{5} V_{1} s^{2} - C_{1} C_{2} R_{2} R_{3} R_{5} V_{1} s^{2} - C_{1} C_{2} R_{2} R_{4} R_{5} V_{1} s^{2} - C_{1} C_{3} C_{4} R_{1} R_{2} R_{4} R_{5} V_{1} s^{3} - C_{1} C_{3} C_{4} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} - C_{1} C_{3} R_{1} R_{2} R_{5} V_{1} s^{2} + C_{1} C_{3} R_{1} R_{4} R_{6} V_{1} s^{2} - C_{1} C_{3} R_{2} R_{3} R_{5} V_{1} s^{2} + C_{1} C_{3} R_{3} R_{4} R_{6} V_{1} s^{2} - C_{1} C_{4} R_{1} R_{4} R_{5} V_{1} s^{2} - C_{1} C_{4} R_{2} R_{4} R_{5} V_{1} s^{2} - C_{1} C_{4} R_{3} R_{4} R_{5} V_{1} s^{2} - C_{1} R_{1} R_{5} V_{1} s - C_{1} R_{2} R_{5} V_{1} s - C_{1} R_{3} R_{5} V_{1} s - C_{1} R_{4} R_{5} V_{1} s - C_{2} C_{3} C_{4} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} - C_{2} C_{3} R_{2} R_{3} R_{5} V_{1} s^{2} - C_{2} C_{3} R_{2} R_{4} R_{5} V_{1} s^{2} + C_{2} C_{3} R_{3} R_{4} R_{6} V_{1} s^{2} - C_{2} C_{4} R_{3} R_{4} R_{5} V_{1} s^{2} - C_{2} R_{3} R_{5} V_{1} s - C_{2} R_{4} R_{5} V_{1} s - C_{3} C_{4} R_{2} R_{4} R_{5} V_{1} s^{2} - C_{3} R_{2} R_{5} V_{1} s + C_{3} R_{4} R_{6} V_{1} s - C_{4} R_{4} R_{5} V_{1} s - R_{5} V_{1}}{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} - C_{1} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{1} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} R_{1} R_{3} R_{5} s + C_{1} R_{2} R_{3} R_{5} s + C_{1} R_{3} R_{4} R_{5} s + C_{2} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{2} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} + C_{2} C_{3} R_{1} R_{2} R_{4} R_{5} s^{2} - C_{2} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{2} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{2} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{2} R_{1} R_{3} R_{5} s + C_{2} R_{1} R_{4} R_{5} s + C_{2} R_{2} R_{3} R_{5} s + C_{2} R_{2} R_{4} R_{5} s + C_{2} R_{3} R_{4} R_{5} s + C_{3} C_{4} R_{1} R_{2} R_{4} R_{5} s^{2} + C_{3} R_{1} R_{2} R_{5} s - C_{3} R_{1} R_{4} R_{6} s + C_{4} R_{1} R_{4} R_{5} s + C_{4} R_{2} R_{4} R_{5} s + R_{1} R_{5} + R_{2} R_{5} + R_{4} R_{5}}\)
\(v_{1} = V_{1}\)
\(v_{2} = \frac{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} + C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{6} V_{1} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{6} V_{1} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{6} V_{1} s^{2} + C_{1} R_{3} R_{4} R_{5} V_{1} s + C_{1} R_{3} R_{4} R_{6} V_{1} s + C_{2} R_{3} R_{4} R_{5} V_{1} s + C_{2} R_{3} R_{4} R_{6} V_{1} s + R_{4} R_{5} V_{1} + R_{4} R_{6} V_{1}}{C_{1} C_{2} C_{3} C_{5} R_{1} R_{2} R_{3} R_{4} R_{5} R_{7} s^{4} + C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{2} C_{5} R_{1} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{1} C_{2} C_{5} R_{2} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{3} C_{4} C_{5} R_{1} R_{2} R_{3} R_{4} R_{5} R_{7} s^{4} + C_{1} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{3} C_{5} R_{1} R_{2} R_{3} R_{5} R_{7} s^{3} - C_{1} C_{3} C_{5} R_{1} R_{3} R_{4} R_{6} R_{7} s^{3} + C_{1} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} - C_{1} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{1} C_{4} C_{5} R_{1} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{1} C_{4} C_{5} R_{2} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{1} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{5} R_{1} R_{3} R_{5} R_{7} s^{2} + C_{1} C_{5} R_{2} R_{3} R_{5} R_{7} s^{2} + C_{1} C_{5} R_{3} R_{4} R_{5} R_{7} s^{2} + C_{1} R_{1} R_{3} R_{5} s + C_{1} R_{2} R_{3} R_{5} s + C_{1} R_{3} R_{4} R_{5} s + C_{2} C_{3} C_{4} C_{5} R_{1} R_{2} R_{3} R_{4} R_{5} R_{7} s^{4} + C_{2} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{2} C_{3} C_{5} R_{1} R_{2} R_{3} R_{5} R_{7} s^{3} + C_{2} C_{3} C_{5} R_{1} R_{2} R_{4} R_{5} R_{7} s^{3} - C_{2} C_{3} C_{5} R_{1} R_{3} R_{4} R_{6} R_{7} s^{3} + C_{2} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} + C_{2} C_{3} R_{1} R_{2} R_{4} R_{5} s^{2} - C_{2} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{2} C_{4} C_{5} R_{1} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{2} C_{4} C_{5} R_{2} R_{3} R_{4} R_{5} R_{7} s^{3} + C_{2} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{2} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{2} C_{5} R_{1} R_{3} R_{5} R_{7} s^{2} + C_{2} C_{5} R_{1} R_{4} R_{5} R_{7} s^{2} + C_{2} C_{5} R_{2} R_{3} R_{5} R_{7} s^{2} + C_{2} C_{5} R_{2} R_{4} R_{5} R_{7} s^{2} + C_{2} C_{5} R_{3} R_{4} R_{5} R_{7} s^{2} + C_{2} R_{1} R_{3} R_{5} s + C_{2} R_{1} R_{4} R_{5} s + C_{2} R_{2} R_{3} R_{5} s + C_{2} R_{2} R_{4} R_{5} s + C_{2} R_{3} R_{4} R_{5} s + C_{3} C_{4} C_{5} R_{1} R_{2} R_{4} R_{5} R_{7} s^{3} + C_{3} C_{4} R_{1} R_{2} R_{4} R_{5} s^{2} + C_{3} C_{5} R_{1} R_{2} R_{5} R_{7} s^{2} - C_{3} C_{5} R_{1} R_{4} R_{6} R_{7} s^{2} + C_{3} R_{1} R_{2} R_{5} s - C_{3} R_{1} R_{4} R_{6} s + C_{4} C_{5} R_{1} R_{4} R_{5} R_{7} s^{2} + C_{4} C_{5} R_{2} R_{4} R_{5} R_{7} s^{2} + C_{4} R_{1} R_{4} R_{5} s + C_{4} R_{2} R_{4} R_{5} s + C_{5} R_{1} R_{5} R_{7} s + C_{5} R_{2} R_{5} R_{7} s + C_{5} R_{4} R_{5} R_{7} s + R_{1} R_{5} + R_{2} R_{5} + R_{4} R_{5}}\)
\(v_{3} = \frac{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} + C_{1} C_{3} R_{1} R_{2} R_{3} R_{5} V_{1} s^{2} - C_{1} C_{3} R_{1} R_{3} R_{4} R_{6} V_{1} s^{2} + C_{1} C_{4} R_{1} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{4} R_{2} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} R_{1} R_{3} R_{5} V_{1} s + C_{1} R_{2} R_{3} R_{5} V_{1} s + C_{1} R_{3} R_{4} R_{5} V_{1} s + C_{2} R_{3} R_{4} R_{5} V_{1} s}{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} - C_{1} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{1} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} R_{1} R_{3} R_{5} s + C_{1} R_{2} R_{3} R_{5} s + C_{1} R_{3} R_{4} R_{5} s + C_{2} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{2} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} + C_{2} C_{3} R_{1} R_{2} R_{4} R_{5} s^{2} - C_{2} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{2} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{2} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{2} R_{1} R_{3} R_{5} s + C_{2} R_{1} R_{4} R_{5} s + C_{2} R_{2} R_{3} R_{5} s + C_{2} R_{2} R_{4} R_{5} s + C_{2} R_{3} R_{4} R_{5} s + C_{3} C_{4} R_{1} R_{2} R_{4} R_{5} s^{2} + C_{3} R_{1} R_{2} R_{5} s - C_{3} R_{1} R_{4} R_{6} s + C_{4} R_{1} R_{4} R_{5} s + C_{4} R_{2} R_{4} R_{5} s + R_{1} R_{5} + R_{2} R_{5} + R_{4} R_{5}}\)
\(v_{4} = \frac{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} + C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{6} V_{1} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{4} R_{2} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} R_{2} R_{3} R_{5} V_{1} s + C_{1} R_{3} R_{4} R_{5} V_{1} s + C_{2} C_{4} R_{2} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{2} R_{2} R_{3} R_{5} V_{1} s + C_{2} R_{2} R_{4} R_{5} V_{1} s + C_{2} R_{3} R_{4} R_{5} V_{1} s + C_{4} R_{2} R_{4} R_{5} V_{1} s + R_{2} R_{5} V_{1} + R_{4} R_{5} V_{1}}{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} - C_{1} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{1} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} R_{1} R_{3} R_{5} s + C_{1} R_{2} R_{3} R_{5} s + C_{1} R_{3} R_{4} R_{5} s + C_{2} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{2} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} + C_{2} C_{3} R_{1} R_{2} R_{4} R_{5} s^{2} - C_{2} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{2} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{2} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{2} R_{1} R_{3} R_{5} s + C_{2} R_{1} R_{4} R_{5} s + C_{2} R_{2} R_{3} R_{5} s + C_{2} R_{2} R_{4} R_{5} s + C_{2} R_{3} R_{4} R_{5} s + C_{3} C_{4} R_{1} R_{2} R_{4} R_{5} s^{2} + C_{3} R_{1} R_{2} R_{5} s - C_{3} R_{1} R_{4} R_{6} s + C_{4} R_{1} R_{4} R_{5} s + C_{4} R_{2} R_{4} R_{5} s + R_{1} R_{5} + R_{2} R_{5} + R_{4} R_{5}}\)
\(v_{5} = \frac{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} R_{3} R_{4} R_{5} V_{1} s + C_{2} R_{3} R_{4} R_{5} V_{1} s + R_{4} R_{5} V_{1}}{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} - C_{1} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{1} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} R_{1} R_{3} R_{5} s + C_{1} R_{2} R_{3} R_{5} s + C_{1} R_{3} R_{4} R_{5} s + C_{2} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{2} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} + C_{2} C_{3} R_{1} R_{2} R_{4} R_{5} s^{2} - C_{2} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{2} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{2} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{2} R_{1} R_{3} R_{5} s + C_{2} R_{1} R_{4} R_{5} s + C_{2} R_{2} R_{3} R_{5} s + C_{2} R_{2} R_{4} R_{5} s + C_{2} R_{3} R_{4} R_{5} s + C_{3} C_{4} R_{1} R_{2} R_{4} R_{5} s^{2} + C_{3} R_{1} R_{2} R_{5} s - C_{3} R_{1} R_{4} R_{6} s + C_{4} R_{1} R_{4} R_{5} s + C_{4} R_{2} R_{4} R_{5} s + R_{1} R_{5} + R_{2} R_{5} + R_{4} R_{5}}\)
\(v_{6} = \frac{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} R_{3} R_{4} R_{5} V_{1} s + C_{2} R_{3} R_{4} R_{5} V_{1} s + R_{4} R_{5} V_{1}}{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} - C_{1} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{1} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} R_{1} R_{3} R_{5} s + C_{1} R_{2} R_{3} R_{5} s + C_{1} R_{3} R_{4} R_{5} s + C_{2} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{2} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} + C_{2} C_{3} R_{1} R_{2} R_{4} R_{5} s^{2} - C_{2} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{2} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{2} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{2} R_{1} R_{3} R_{5} s + C_{2} R_{1} R_{4} R_{5} s + C_{2} R_{2} R_{3} R_{5} s + C_{2} R_{2} R_{4} R_{5} s + C_{2} R_{3} R_{4} R_{5} s + C_{3} C_{4} R_{1} R_{2} R_{4} R_{5} s^{2} + C_{3} R_{1} R_{2} R_{5} s - C_{3} R_{1} R_{4} R_{6} s + C_{4} R_{1} R_{4} R_{5} s + C_{4} R_{2} R_{4} R_{5} s + R_{1} R_{5} + R_{2} R_{5} + R_{4} R_{5}}\)
\(v_{7} = \frac{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} V_{1} s^{3} + C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{6} V_{1} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{6} V_{1} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} V_{1} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{6} V_{1} s^{2} + C_{1} R_{3} R_{4} R_{5} V_{1} s + C_{1} R_{3} R_{4} R_{6} V_{1} s + C_{2} R_{3} R_{4} R_{5} V_{1} s + C_{2} R_{3} R_{4} R_{6} V_{1} s + R_{4} R_{5} V_{1} + R_{4} R_{6} V_{1}}{C_{1} C_{2} C_{3} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{2} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{2} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{1} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} - C_{1} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{1} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{1} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{1} R_{1} R_{3} R_{5} s + C_{1} R_{2} R_{3} R_{5} s + C_{1} R_{3} R_{4} R_{5} s + C_{2} C_{3} C_{4} R_{1} R_{2} R_{3} R_{4} R_{5} s^{3} + C_{2} C_{3} R_{1} R_{2} R_{3} R_{5} s^{2} + C_{2} C_{3} R_{1} R_{2} R_{4} R_{5} s^{2} - C_{2} C_{3} R_{1} R_{3} R_{4} R_{6} s^{2} + C_{2} C_{4} R_{1} R_{3} R_{4} R_{5} s^{2} + C_{2} C_{4} R_{2} R_{3} R_{4} R_{5} s^{2} + C_{2} R_{1} R_{3} R_{5} s + C_{2} R_{1} R_{4} R_{5} s + C_{2} R_{2} R_{3} R_{5} s + C_{2} R_{2} R_{4} R_{5} s + C_{2} R_{3} R_{4} R_{5} s + C_{3} C_{4} R_{1} R_{2} R_{4} R_{5} s^{2} + C_{3} R_{1} R_{2} R_{5} s - C_{3} R_{1} R_{4} R_{6} s + C_{4} R_{1} R_{4} R_{5} s + C_{4} R_{2} R_{4} R_{5} s + R_{1} R_{5} + R_{2} R_{5} + R_{4} R_{5}}\)
The symbolic transfer function, \(H_{sym}=\frac {v_2}{v_1}\).
We can make some simplifications with the following:
\(C_1=C_2=C\) and \(C_3=2C\)
\(R_1=R_2=2R\) and \(R_3=R\)
R, C = symbols('R C')H_sym = (U_sym[v2]/U_sym[v1]).subs({C1:C,C2:C,C3:2*C,R1:2*R,R2:2*R,R3:R}).simplify().collect(s)
H_sym\(\displaystyle \frac{R_{4} \left(R_{5} + R_{6} + s^{2} \left(4 C^{2} R^{2} R_{5} + 4 C^{2} R^{2} R_{6}\right)\right)}{4 R R_{5} + R_{4} R_{5} + s^{3} \left(4 C^{2} C_{5} R^{2} R_{4} R_{5} R_{7} + 8 C C_{4} C_{5} R^{2} R_{4} R_{5} R_{7}\right) + s^{2} \left(4 C^{2} R^{2} R_{4} R_{5} + 8 C C_{4} R^{2} R_{4} R_{5} + 8 C C_{5} R^{2} R_{5} R_{7} + 4 C C_{5} R R_{4} R_{5} R_{7} - 4 C C_{5} R R_{4} R_{6} R_{7} + 4 C_{4} C_{5} R R_{4} R_{5} R_{7}\right) + s \left(8 C R^{2} R_{5} + 4 C R R_{4} R_{5} - 4 C R R_{4} R_{6} + 4 C_{4} R R_{4} R_{5} + 4 C_{5} R R_{5} R_{7} + C_{5} R_{4} R_{5} R_{7}\right)}\)
The numerator and denominator polynominals can be extracted by the following code:
num, den = fraction(H_sym)The numerator can be factored:
num.factor()\(\displaystyle R_{4} \left(R_{5} + R_{6}\right) \left(4 C^{2} R^{2} s^{2} + 1\right)\)
We get two imaginary zeros.
In filter design, zeros are the frequencies where the transfer function evaluates to zero, resulting in complete signal attenuation (transmission zeros). Complex zeros, which must occur in complex conjugate pairs for systems with real-valued coefficients, play a critical role in shaping advanced frequency and phase characteristics. By placing complex conjugate zeros directly on the imaginary axis (\(j\omega\) axis in analog filters) or on the unit circle (in digital IIR filters), the filter forces the frequency response to drop to absolute zero at specific frequencies. Complex zeros are essential for creating precise notch filters (band-stop filters). * When a complex conjugate pair of zeros is placed precisely on the unit circle at an angle corresponding to an undesired frequency (such as 50 Hz or 60 Hz power-line interference), the filter provides near-infinite attenuation at that exact frequency while leaving neighboring frequencies relatively untouched.
The denominator polynominal can also be factored.
den.factor()\(\displaystyle \left(C_{5} R_{7} s + 1\right) \left(4 C^{2} R^{2} R_{4} R_{5} s^{2} + 8 C C_{4} R^{2} R_{4} R_{5} s^{2} + 8 C R^{2} R_{5} s + 4 C R R_{4} R_{5} s - 4 C R R_{4} R_{6} s + 4 C_{4} R R_{4} R_{5} s + 4 R R_{5} + R_{4} R_{5}\right)\)
We get one real pole and a set of complex poles from the 2nd order factor. We can extract the 2nd order term with the following code:
Seems that with the simplification a real pole and zero now cancel and we get a real pole determined by \(R_7\) and \(C_5\). There is also a 2nd order factor which can be reformulated in terms of \(\omega_n\) and \(\zeta\).
den_factor_list = factor_list(den.factor())
H_sym_denom_2nd_order_factor = den_factor_list[1][-1][0]
H_sym_denom_2nd_order_factor\(\displaystyle 4 C^{2} R^{2} R_{4} R_{5} s^{2} + 8 C C_{4} R^{2} R_{4} R_{5} s^{2} + 8 C R^{2} R_{5} s + 4 C R R_{4} R_{5} s - 4 C R R_{4} R_{6} s + 4 C_{4} R R_{4} R_{5} s + 4 R R_{5} + R_{4} R_{5}\)
(den_factor_list[1][-1][0]).factor()\(\displaystyle 4 C^{2} R^{2} R_{4} R_{5} s^{2} + 8 C C_{4} R^{2} R_{4} R_{5} s^{2} + 8 C R^{2} R_{5} s + 4 C R R_{4} R_{5} s - 4 C R R_{4} R_{6} s + 4 C_{4} R R_{4} R_{5} s + 4 R R_{5} + R_{4} R_{5}\)
(den_factor_list[1][-1][0]).collect(s)\(\displaystyle 4 R R_{5} + R_{4} R_{5} + s^{2} \left(4 C^{2} R^{2} R_{4} R_{5} + 8 C C_{4} R^{2} R_{4} R_{5}\right) + s \left(8 C R^{2} R_{5} + 4 C R R_{4} R_{5} - 4 C R R_{4} R_{6} + 4 C_{4} R R_{4} R_{5}\right)\)
When a transfer function’s denominator is factored into one real pole and a second-order factor, it defines a third-order system.
In linear time-invariant (LTI) systems with real coefficients, complex roots must appear in conjugate pairs. Therefore, any odd-degree polynomial will always factor out into at least one real root and one or more quadratic (second-order) factors. A real pole on the negative real axis contributes a smooth, non-resonant magnitude roll-off of \(-20\text{ dB/decade}\) (\(-6\text{ dB/octave}\)) starting at its cutoff frequency. Depending on the damping ratio \(\zeta\) (or \(Q\)), the complex conjugate pair can introduce a resonant peak near the cutoff frequency \(\omega_0\). For instance, a Butterworth filter optimizes \(\zeta\) to make this transition maximally flat without peaking, whereas a Chebyshev filter allows controlled ripple.
16.2.0.1 Coefficients of 2nd order factor of the Characteristic Polynomial
Considereing the demoninator polynominal of \(H(s)\), the coefficients of each Laplace term can be equated to the variables \(b_2\), \(b_1\) and \(b_0\) in the expression:
\(b_2s^2+b_1s+b_0\)
where \(b_2\), \(b_1\) and \(b_0\) are:
b2 = H_sym_denom_2nd_order_factor.coeff(s**2)
b1 = H_sym_denom_2nd_order_factor.coeff(s**1)
b0 = (H_sym_denom_2nd_order_factor - b1*s*1 - b2*s**2).expand()
Markdown('<p>$b_2={:s}$</p><p>$b_1={:s}$</p><p>$b_0={:s}$</p>'.format(latex(b2),latex(b1),latex(b0)))\(b_2=4 C^{2} R^{2} R_{4} R_{5} + 8 C C_{4} R^{2} R_{4} R_{5}\)
\(b_1=8 C R^{2} R_{5} + 4 C R R_{4} R_{5} - 4 C R R_{4} R_{6} + 4 C_{4} R R_{4} R_{5}\)
\(b_0=4 R R_{5} + R_{4} R_{5}\)
16.2.0.2 Expressions for \(\omega_n\) and \(\zeta\)
The denominator of \(H(s)\) is a 2nd order polynominal in \(s\). When using the standardized notation for damping ratio and natural frequency, the coefficients of the denominator polynominal can be equated to these quantities and expressed in terms of the circuit’s reference designators. The standard notation is: \(s^2 + 2\zeta\omega_n s + \omega_n^2\), where \(\zeta\) is the damping ratio and \(\omega_n\) is the natural frequency. The Quality Factor, \(Q=\frac{1}{2\zeta}\) is a dimensionless quantity representing energy loss per cycle relative to the stored energy.
Equating the coefficients, \(\omega_n^2=\frac{b_0}{b_2}\), and rearranging the terms, \(\omega_n=\sqrt {\frac{b_0}{b_2}}\), we can obtain the expression for the natural frequency in terms of the component values.
omega_n = sqrt(b0/b2).simplify()
Markdown('The natural frequency, $\omega_n={:s}$'.format(latex(omega_n)))The natural frequency, \(\omega_n=\frac{\sqrt{\frac{4 R + R_{4}}{C R^{2} R_{4} \left(C + 2 C_{4}\right)}}}{2}\)
The coefficient of the \(s\) term is:
\(\frac {b_1}{b_2}=2 \zeta \omega_n\)
and rearranging the terms, we get the damping ratio:
\(\zeta =\frac {b_1}{2 b_2 \omega_n}\)
zeta = (b1/(2*b2*omega_n)).simplify()
Markdown('The damping ratio, $\zeta={:s}$'.format(latex(zeta)))The damping ratio, \(\zeta=\frac{2 C R R_{5} + C R_{4} R_{5} - C R_{4} R_{6} + C_{4} R_{4} R_{5}}{C R R_{4} R_{5} \sqrt{\frac{4 R + R_{4}}{C R^{2} R_{4} \left(C + 2 C_{4}\right)}} \left(C + 2 C_{4}\right)}\)
The quality factor is:
\(Q=\frac {1}{2 \zeta}\)
quality_factor = 1/(2*zeta).simplify()
Markdown('The quality factor, $Q={:s}$'.format(latex(quality_factor)))The quality factor, \(Q=\frac{C R R_{4} R_{5} \sqrt{\frac{4 R + R_{4}}{C R^{2} R_{4} \left(C + 2 C_{4}\right)}} \left(C + 2 C_{4}\right)}{2 \left(2 C R R_{5} + C R_{4} R_{5} - C R_{4} R_{6} + C_{4} R_{4} R_{5}\right)}\)
Numerical values for these parameters are calculated as follows:
s1 = (f'The natural frequency, $\omega_n$ = {omega_n.subs(element_values).subs({R:4750, C:0.05e-6})/(2*np.pi):0.2f} Hz')
s2 = (f'The damping ratio, $\zeta$ = {zeta.subs(element_values).subs({R:4750, C:0.05e-6}):0.3f}')
s3 = (f'The quality factor, Q = {quality_factor.subs(element_values).subs({R:4750, C:0.05e-6}):0.3f}')
Markdown(f'<p>{s1}</p><p>{s2}</p><p>{s3}</p>')The natural frequency, \(\omega_n\) = 120.12 Hz
The damping ratio, \(\zeta\) = 0.316
The quality factor, Q = 1.583
16.3 Numerical solution
Substitue the element values into the equations and solve for unknown node voltages and currents. Need to set the current source, I1, to zero.
# put the element values into the equations
NE = NE_sym.subs(element_values)temp = ''
for i in range(shape(NE.lhs)[0]):
temp += '${:s} = {:s}$<br>'.format(latex(NE.rhs[i]),latex(NE.lhs[i]))
Markdown(temp)\(0 = I_{V1} - 5.0 \cdot 10^{-8} s v_{3} + v_{1} \left(5.0 \cdot 10^{-8} s + 0.000104931794333683\right) - 0.000104931794333683 v_{4}\)
\(0 = v_{2} \left(1.8 \cdot 10^{-7} s + 0.0001\right) - 0.0001 v_{7}\)
\(0 = - 5.0 \cdot 10^{-8} s v_{1} - 5.0 \cdot 10^{-8} s v_{5} + v_{3} \left(1.0 \cdot 10^{-7} s + 0.000210526315789474\right)\)
\(0 = - 1.0 \cdot 10^{-7} s v_{7} - 0.000104931794333683 v_{1} + v_{4} \left(1.0 \cdot 10^{-7} s + 0.000209863588667366\right) - 0.000104931794333683 v_{5}\)
\(0 = - 5.0 \cdot 10^{-8} s v_{3} - 0.000104931794333683 v_{4} + v_{5} \left(2.7 \cdot 10^{-7} s + 0.000118592996519475\right)\)
\(0 = 0.00012262443438914 v_{6} - 2.26244343891403 \cdot 10^{-5} v_{7}\)
\(0 = I_{O1} - 1.0 \cdot 10^{-7} s v_{4} - 0.0001 v_{2} - 2.26244343891403 \cdot 10^{-5} v_{6} + v_{7} \left(1.0 \cdot 10^{-7} s + 0.00012262443438914\right)\)
\(1.0 = v_{1}\)
\(0 = - v_{5} + v_{6}\)
Solve for voltages and currents in terms of Laplace variable s.
U = solve(NE,X)16.3.1 Find the network transfer function \(\frac {v_2(s)}{v_1(s)}\)
H = (U[v2]/U[v1]).cancel()
H\(\displaystyle \frac{7.66402714932125 \cdot 10^{50} s^{3} + 1.60840024120068 \cdot 10^{54} s^{2} + 3.37544646631832 \cdot 10^{57} s + 7.10620308698594 \cdot 10^{60}}{2.49434389140272 \cdot 10^{48} s^{4} + 7.82471226796141 \cdot 10^{51} s^{3} + 7.48699036699101 \cdot 10^{54} s^{2} + 5.1465987346903 \cdot 10^{57} s + 1.65249706814803 \cdot 10^{60}}\)
H_num, H_denom = fraction(H) #returns numerator and denominator# convert symbolic to numpy polynomial
a = np.array(Poly(H_num, s).all_coeffs(), dtype=float)
b = np.array(Poly(H_denom, s).all_coeffs(), dtype=float)
sys = signal.TransferFunction(a,b)16.3.2 Poles and zeros of the low pass transfer function
The poles and zeros of the transfer function can easly be obtained with the following code:
sys_zeros = np.roots(sys.num)
sys_poles = np.roots(sys.den)16.3.2.1 Low pass filter pole zero plot
The poles and zeros of the preamp transfer function are plotted.
plt.plot(np.real(sys_zeros), np.imag(sys_zeros), 'ob', markerfacecolor='none')
plt.plot(np.real(sys_poles), np.imag(sys_poles), 'xr')
plt.legend(['Zeros', 'Poles'], loc=0)
plt.title('Pole / Zero Plot')
plt.xlabel('real part, \u03B1')
plt.ylabel('imaginary part, j\u03C9')
plt.grid()
plt.show()
Poles and zeros of the transfer function plotted on the complex plane. The units are in radian frequency.
Printing these values in Hz.
print('number of zeros: {:d}'.format(len(sys_zeros)))
for i in sys_zeros:
print('{:,.2f} Hz'.format(i/(2*np.pi)))number of zeros: 3
-334.53+0.00j Hz
0.26+334.27j Hz
0.26-334.27j Hz
print('number of poles: {:d}'.format(len(sys_poles)))
for i in sys_poles:
print('{:,.2f} Hz'.format(i/(2*np.pi)))number of poles: 4
-335.18+0.00j Hz
-37.83+113.63j Hz
-37.83-113.63j Hz
-88.42+0.00j Hz
16.4 AC analysis
Solve the network equations at a frequency of 100 Hz or \(\omega\) equal to 628.318 radians per second, s = 628.318j.
Load numerical values into the network equations.
freq_Hz = 100 #Hz
w = 2*np.pi*freq_Hz
NE_w = NE_sym.subs(element_values)
NE_w = NE_w.subs({s:1j*w})
# display the equations
temp = ''
for i in range(shape(NE_w.lhs)[0]):
temp += '${:s} = {:s}$<br>'.format(latex(NE_w.rhs[i]),latex(NE_w.lhs[i]))
Markdown(temp)\(0 = I_{V1} + v_{1} \left(0.000104931794333683 + 3.14159265358979 \cdot 10^{-5} i\right) - 3.14159265358979 \cdot 10^{-5} i v_{3} - 0.000104931794333683 v_{4}\)
\(0 = v_{2} \left(0.0001 + 0.000113097335529233 i\right) - 0.0001 v_{7}\)
\(0 = - 3.14159265358979 \cdot 10^{-5} i v_{1} + v_{3} \left(0.000210526315789474 + 6.28318530717959 \cdot 10^{-5} i\right) - 3.14159265358979 \cdot 10^{-5} i v_{5}\)
\(0 = - 0.000104931794333683 v_{1} + v_{4} \left(0.000209863588667366 + 6.28318530717959 \cdot 10^{-5} i\right) - 0.000104931794333683 v_{5} - 6.28318530717959 \cdot 10^{-5} i v_{7}\)
\(0 = - 3.14159265358979 \cdot 10^{-5} i v_{3} - 0.000104931794333683 v_{4} + v_{5} \left(0.000118592996519475 + 0.000169646003293849 i\right)\)
\(0 = 0.00012262443438914 v_{6} - 2.26244343891403 \cdot 10^{-5} v_{7}\)
\(0 = I_{O1} - 0.0001 v_{2} - 6.28318530717959 \cdot 10^{-5} i v_{4} - 2.26244343891403 \cdot 10^{-5} v_{6} + v_{7} \left(0.00012262443438914 + 6.28318530717959 \cdot 10^{-5} i\right)\)
\(1.0 = v_{1}\)
\(0 = - v_{5} + v_{6}\)
Solve the newtork equations and list the node voltages and unknown currents.
U_w = solve(NE_w,X)
table_header = ['unknown', 'mag','phase, deg']
table_row = []
for name, value in U_w .items():
table_row.append([str(name),float(abs(value)),float(arg(value)*180/np.pi)])
print(tabulate(table_row, headers=table_header,colalign = ('left','decimal','decimal'),tablefmt="simple",floatfmt=('5s','.6f','.6f')))unknown mag phase, deg
--------- -------- ------------
I_O1 0.000875 166.380500
I_V1 0.000150 -20.838911
v1 1.000000 0.000000
v2 4.264586 -108.662048
v3 0.271069 40.463593
v4 2.401757 -6.456457
v5 1.187844 -60.144973
v6 1.187844 -60.144973
v7 6.438113 -60.144973
16.5 AC Sweep
Plot the magnitude and phase of the filter’s transfer function.
num, denom = fraction(H) #returns numerator and denominator
# convert symbolic to numpy polynomial
a = np.array(Poly(num, s).all_coeffs(), dtype=float)
b = np.array(Poly(denom, s).all_coeffs(), dtype=float)
system = (a, b) # system for circuit 1
x = np.logspace(1, 3, 1000, endpoint=True)*2*np.pi
w, mag, phase = signal.bode(system, w=x) # returns: rad/s, mag in dB, phase in deg
fig, ax1 = plt.subplots()
ax1.set_ylabel('magnitude, dB')
ax1.set_xlabel('frequency, Hz')
plt.semilogx(w/(2*np.pi), mag,'-b') # magnitude plot
ax1.tick_params(axis='y')
plt.grid()
# instantiate a second y-axes that shares the same x-axis
ax2 = ax1.twinx()
color = 'tab:blue'
plt.semilogx(w/(2*np.pi), phase,':',color='tab:red') # phase plot
ax2.set_ylabel('phase, deg',color=color)
ax2.tick_params(axis='y', labelcolor=color)
plt.title('Magnitude and phase plot')
plt.show()
16.6 Summary
An elliptic filter was analyized and a symbolic solution of the network equations takes a long time. Numerical solutions using component values are easily obtained.