#import os
from sympy import *
import numpy as np
from tabulate import tabulate
from scipy import signal
import matplotlib.pyplot as plt
import pandas as pd
import SymMNA
from IPython.display import display, Markdown, Math, Latex
init_printing()
12 Test 8
This test circuit shown in Figure 12.1 is the same circuit as Figure 11.1, for the addition of two Op Amps.
\(\large{\color {red} {\text{Note for author:}}}\)
- make a spread sheet to find the differences at s=1 between NMA and LTSpice
- see: /home/jeff64/Documents/Solving Electrical Engineering Problems with Python Blog/MNA Test Circuits/test_8/test_8_comparison_of_results.ods
The netlist generated by LTSpice:
R1 16 8 5
R2 8 1 2
R6 2 0 5
R8 11 10 8
R10 23 22 9
R11 9 8 4
R12 2 1 2
R14 10 9 10
R15 24 23 5
V1 22 0 AC 10
V2 1 0 2
V3 10 3 3
V4 10 20 5
I1 5 0 3
I2 2 3 1
I3 16 9 2
I4 12 18 2
R7 12 5 10
R16 3 0 6
R3 26 25 10
R4 4 3 3
F1 14 7 V2 2
E1 15 21 2 7 2
H1 4 0 V2 3
G1 11 4 13 12 2
L1 16 23 1 Rser=0
L2 25 9 4 Rser=0
V5 20 28 0
V6 23 27 0
L3 22 21 2 Rser=0
L4 17 11 5 Rser=0
C1 23 18 2
C2 12 11 2
L5 0 7 1 Rser=0
L6 9 2 2 Rser=0
F2 0 27 V2 2
E2 17 26 10 9 2
H2 27 26 V2 3
G2 16 28 0 5 2
V7 24 25 0
V8 0 6 0
R9 22 16 3
R13 15 0 5
R17 19 13 5
R18 13 6 2
R19 23 19 7
R20 20 19 5
R21 19 18 3
R22 14 13 3
R23 5 4 1
R24 20 14 3
R25 23 28 10
R5 28 0 3
R26 32 31 20k
R27 30 29 10k
R28 13 30 2
R29 24 32 5
R30 29 21 20k
R31 31 8 10k
XU1 29 0 30 opamp Aol=100K GBW=10Meg
XU2 31 0 32 opamp Aol=100K GBW=10Meg
K1 L1 L2 0.8
K2 L3 L4 0.2
12.1 Load the net list
= '''
net_list R1 16 8 5
R2 8 1 2
R6 2 0 5
R8 11 10 8
R10 23 22 9
R11 9 8 4
R12 2 1 2
R14 10 9 10
R15 24 23 5
V1 22 0 10
V2 1 0 2
V3 10 3 3
V4 10 20 5
I1 5 0 3
I2 2 3 1
I3 16 9 2
I4 12 18 2
R7 12 5 10
R16 3 0 6
R3 26 25 10
R4 4 3 3
F1 14 7 V2 2
E1 15 21 2 7 2
H1 4 0 V2 3
G1 11 4 13 12 2
L1 16 23 1
L2 25 9 4
V5 20 28 0
V6 23 27 0
L3 22 21 2
L4 17 11 5
C1 23 18 2
C2 12 11 2
L5 0 7 1
L6 9 2 2
F2 0 27 V2 2
E2 17 26 10 9 2
H2 27 26 V2 3
G2 16 28 0 5 2
V7 24 25 0
V8 0 6 0
R9 22 16 3
R13 15 0 5
R17 19 13 5
R18 13 6 2
R19 23 19 7
R20 20 19 5
R21 19 18 3
R22 14 13 3
R23 5 4 1
R24 20 14 3
R25 23 28 10
R5 28 0 3
R26 32 31 20e3
R27 30 29 10e3
R28 13 30 2
R29 24 32 5
R30 29 21 20e3
R31 31 8 10e3
O1 29 0 30
O2 31 0 32
K1 L1 L2 0.8
K2 L3 L4 0.2
'''
12.2 Call the symbolic modified nodal analysis function
The circuit has 32 nodes and 59 branches, which results in 54 network equations. The Python code can generate these equations in about 1 second.
= SymMNA.smna(net_list) report, network_df, i_unk_df, A, X, Z
Display the equations
# reform X and Z into Matrix type for printing
= Matrix(X)
Xp = Matrix(Z)
Zp = ''
temp for i in range(len(X)):
+= '${:s}$<br>'.format(latex(Eq((A*Xp)[i:i+1][0],Zp[i])))
temp
Markdown(temp)
\(I_{V2} + v_{1} \cdot \left(\frac{1}{R_{2}} + \frac{1}{R_{12}}\right) - \frac{v_{8}}{R_{2}} - \frac{v_{2}}{R_{12}} = 0\)
\(- I_{L6} + v_{2} \cdot \left(\frac{1}{R_{6}} + \frac{1}{R_{12}}\right) - \frac{v_{1}}{R_{12}} = - I_{2}\)
\(- I_{V3} + v_{3} \cdot \left(\frac{1}{R_{4}} + \frac{1}{R_{16}}\right) - \frac{v_{4}}{R_{4}} = I_{2}\)
\(I_{H1} + g_{1} v_{12} - g_{1} v_{13} + v_{4} \cdot \left(\frac{1}{R_{4}} + \frac{1}{R_{23}}\right) - \frac{v_{3}}{R_{4}} - \frac{v_{5}}{R_{23}} = 0\)
\(v_{5} \cdot \left(\frac{1}{R_{7}} + \frac{1}{R_{23}}\right) - \frac{v_{12}}{R_{7}} - \frac{v_{4}}{R_{23}} = - I_{1}\)
\(- I_{V8} - \frac{v_{13}}{R_{18}} + \frac{v_{6}}{R_{18}} = 0\)
\(- I_{F1} - I_{L5} = 0\)
\(v_{8} \cdot \left(\frac{1}{R_{31}} + \frac{1}{R_{2}} + \frac{1}{R_{11}} + \frac{1}{R_{1}}\right) - \frac{v_{31}}{R_{31}} - \frac{v_{1}}{R_{2}} - \frac{v_{9}}{R_{11}} - \frac{v_{16}}{R_{1}} = 0\)
\(- I_{L2} + I_{L6} + v_{9} \cdot \left(\frac{1}{R_{14}} + \frac{1}{R_{11}}\right) - \frac{v_{10}}{R_{14}} - \frac{v_{8}}{R_{11}} = I_{3}\)
\(I_{V3} + I_{V4} + v_{10} \cdot \left(\frac{1}{R_{8}} + \frac{1}{R_{14}}\right) - \frac{v_{11}}{R_{8}} - \frac{v_{9}}{R_{14}} = 0\)
\(- I_{L4} + g_{1} v_{13} + v_{11} \left(C_{2} s + \frac{1}{R_{8}}\right) + v_{12} \left(- C_{2} s - g_{1}\right) - \frac{v_{10}}{R_{8}} = 0\)
\(- C_{2} s v_{11} + v_{12} \left(C_{2} s + \frac{1}{R_{7}}\right) - \frac{v_{5}}{R_{7}} = - I_{4}\)
\(v_{13} \cdot \left(\frac{1}{R_{28}} + \frac{1}{R_{22}} + \frac{1}{R_{18}} + \frac{1}{R_{17}}\right) - \frac{v_{30}}{R_{28}} - \frac{v_{14}}{R_{22}} - \frac{v_{6}}{R_{18}} - \frac{v_{19}}{R_{17}} = 0\)
\(I_{F1} + v_{14} \cdot \left(\frac{1}{R_{24}} + \frac{1}{R_{22}}\right) - \frac{v_{20}}{R_{24}} - \frac{v_{13}}{R_{22}} = 0\)
\(I_{Ea1} + \frac{v_{15}}{R_{13}} = 0\)
\(I_{L1} - g_{2} v_{5} + v_{16} \cdot \left(\frac{1}{R_{9}} + \frac{1}{R_{1}}\right) - \frac{v_{22}}{R_{9}} - \frac{v_{8}}{R_{1}} = - I_{3}\)
\(I_{Ea2} + I_{L4} = 0\)
\(- C_{1} s v_{23} + v_{18} \left(C_{1} s + \frac{1}{R_{21}}\right) - \frac{v_{19}}{R_{21}} = I_{4}\)
\(v_{19} \cdot \left(\frac{1}{R_{21}} + \frac{1}{R_{20}} + \frac{1}{R_{19}} + \frac{1}{R_{17}}\right) - \frac{v_{18}}{R_{21}} - \frac{v_{20}}{R_{20}} - \frac{v_{23}}{R_{19}} - \frac{v_{13}}{R_{17}} = 0\)
\(- I_{V4} + I_{V5} + v_{20} \cdot \left(\frac{1}{R_{24}} + \frac{1}{R_{20}}\right) - \frac{v_{14}}{R_{24}} - \frac{v_{19}}{R_{20}} = 0\)
\(- I_{Ea1} - I_{L3} + \frac{v_{21}}{R_{30}} - \frac{v_{29}}{R_{30}} = 0\)
\(I_{L3} + I_{V1} + v_{22} \cdot \left(\frac{1}{R_{9}} + \frac{1}{R_{10}}\right) - \frac{v_{16}}{R_{9}} - \frac{v_{23}}{R_{10}} = 0\)
\(- C_{1} s v_{18} - I_{L1} + I_{V6} + v_{23} \left(C_{1} s + \frac{1}{R_{25}} + \frac{1}{R_{19}} + \frac{1}{R_{15}} + \frac{1}{R_{10}}\right) - \frac{v_{28}}{R_{25}} - \frac{v_{19}}{R_{19}} - \frac{v_{24}}{R_{15}} - \frac{v_{22}}{R_{10}} = 0\)
\(I_{V7} + v_{24} \cdot \left(\frac{1}{R_{29}} + \frac{1}{R_{15}}\right) - \frac{v_{32}}{R_{29}} - \frac{v_{23}}{R_{15}} = 0\)
\(I_{L2} - I_{V7} + \frac{v_{25}}{R_{3}} - \frac{v_{26}}{R_{3}} = 0\)
\(- I_{Ea2} - I_{H2} - \frac{v_{25}}{R_{3}} + \frac{v_{26}}{R_{3}} = 0\)
\(- I_{F2} + I_{H2} - I_{V6} = 0\)
\(- I_{V5} + g_{2} v_{5} + v_{28} \cdot \left(\frac{1}{R_{5}} + \frac{1}{R_{25}}\right) - \frac{v_{23}}{R_{25}} = 0\)
\(v_{29} \cdot \left(\frac{1}{R_{30}} + \frac{1}{R_{27}}\right) - \frac{v_{21}}{R_{30}} - \frac{v_{30}}{R_{27}} = 0\)
\(I_{O1} + v_{30} \cdot \left(\frac{1}{R_{28}} + \frac{1}{R_{27}}\right) - \frac{v_{13}}{R_{28}} - \frac{v_{29}}{R_{27}} = 0\)
\(v_{31} \cdot \left(\frac{1}{R_{31}} + \frac{1}{R_{26}}\right) - \frac{v_{8}}{R_{31}} - \frac{v_{32}}{R_{26}} = 0\)
\(I_{O2} + v_{32} \cdot \left(\frac{1}{R_{29}} + \frac{1}{R_{26}}\right) - \frac{v_{24}}{R_{29}} - \frac{v_{31}}{R_{26}} = 0\)
\(v_{22} = V_{1}\)
\(v_{1} = V_{2}\)
\(v_{10} - v_{3} = V_{3}\)
\(v_{10} - v_{20} = V_{4}\)
\(v_{20} - v_{28} = V_{5}\)
\(v_{23} - v_{27} = V_{6}\)
\(v_{24} - v_{25} = V_{7}\)
\(- v_{6} = V_{8}\)
\(I_{F1} - I_{V2} f_{1} = 0\)
\(- ea_{1} v_{2} + ea_{1} v_{7} + v_{15} - v_{21} = 0\)
\(- I_{V2} h_{1} + v_{4} = 0\)
\(- I_{L1} L_{1} s - I_{L2} M_{1} s + v_{16} - v_{23} = 0\)
\(- I_{L1} M_{1} s - I_{L2} L_{2} s + v_{25} - v_{9} = 0\)
\(- I_{L3} L_{3} s - I_{L4} M_{2} s - v_{21} + v_{22} = 0\)
\(- I_{L3} M_{2} s - I_{L4} L_{4} s - v_{11} + v_{17} = 0\)
\(- I_{L5} L_{5} s - v_{7} = 0\)
\(- I_{L6} L_{6} s - v_{2} + v_{9} = 0\)
\(I_{F2} - I_{V2} f_{2} = 0\)
\(- ea_{2} v_{10} + ea_{2} v_{9} + v_{17} - v_{26} = 0\)
\(- I_{V2} h_{2} - v_{26} + v_{27} = 0\)
\(v_{29} = 0\)
\(v_{31} = 0\)
print('There are {:d} network equations for this circuit generated by MNA'.format(len(X)))
There are 54 network equations for this circuit generated by MNA
12.2.1 Netlist statistics
print(report)
Net list report
number of lines in netlist: 63
number of branches: 59
number of nodes: 32
number of unknown currents: 22
number of RLC (passive components): 39
number of inductors: 6
number of independent voltage sources: 8
number of independent current sources: 4
number of Op Amps: 2
number of E - VCVS: 2
number of G - VCCS: 2
number of F - CCCS: 2
number of H - CCVS: 2
number of K - Coupled inductors: 2
12.2.2 Connectivity Matrix
A
\(\displaystyle \left[\begin{array}{cccccccccccccccccccccccccccccccccccccccccccccccccccccc}\frac{1}{R_{2}} + \frac{1}{R_{12}} & - \frac{1}{R_{12}} & 0 & 0 & 0 & 0 & 0 & - \frac{1}{R_{2}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\- \frac{1}{R_{12}} & \frac{1}{R_{6}} + \frac{1}{R_{12}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0\\0 & 0 & \frac{1}{R_{4}} + \frac{1}{R_{16}} & - \frac{1}{R_{4}} & 0 & 0 & 0 & 0 & 0 & 0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 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\end{array}\right]\)
12.2.3 Unknown voltages and currents
X
\(\displaystyle \left[ v_{1}, \ v_{2}, \ v_{3}, \ v_{4}, \ v_{5}, \ v_{6}, \ v_{7}, \ v_{8}, \ v_{9}, \ v_{10}, \ v_{11}, \ v_{12}, \ v_{13}, \ v_{14}, \ v_{15}, \ v_{16}, \ v_{17}, \ v_{18}, \ v_{19}, \ v_{20}, \ v_{21}, \ v_{22}, \ v_{23}, \ v_{24}, \ v_{25}, \ v_{26}, \ v_{27}, \ v_{28}, \ v_{29}, \ v_{30}, \ v_{31}, \ v_{32}, \ I_{V1}, \ I_{V2}, \ I_{V3}, \ I_{V4}, \ I_{V5}, \ I_{V6}, \ I_{V7}, \ I_{V8}, \ I_{F1}, \ I_{Ea1}, \ I_{H1}, \ I_{L1}, \ I_{L2}, \ I_{L3}, \ I_{L4}, \ I_{L5}, \ I_{L6}, \ I_{F2}, \ I_{Ea2}, \ I_{H2}, \ I_{O1}, \ I_{O2}\right]\)
12.2.4 Known voltages and currents
Z
\(\displaystyle \left[ 0, \ - I_{2}, \ I_{2}, \ 0, \ - I_{1}, \ 0, \ 0, \ 0, \ I_{3}, \ 0, \ 0, \ - I_{4}, \ 0, \ 0, \ 0, \ - I_{3}, \ 0, \ I_{4}, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ V_{1}, \ V_{2}, \ V_{3}, \ V_{4}, \ V_{5}, \ V_{6}, \ V_{7}, \ V_{8}, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0\right]\)
12.2.5 Network dataframe
network_df
element | p node | n node | cp node | cn node | Vout | value | Vname | Lname1 | Lname2 | |
---|---|---|---|---|---|---|---|---|---|---|
0 | V1 | 22 | 0 | NaN | NaN | NaN | 10.0 | NaN | NaN | NaN |
1 | V2 | 1 | 0 | NaN | NaN | NaN | 2.0 | NaN | NaN | NaN |
2 | V3 | 10 | 3 | NaN | NaN | NaN | 3.0 | NaN | NaN | NaN |
3 | V4 | 10 | 20 | NaN | NaN | NaN | 5.0 | NaN | NaN | NaN |
4 | V5 | 20 | 28 | NaN | NaN | NaN | 0.0 | NaN | NaN | NaN |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
58 | R31 | 31 | 8 | NaN | NaN | NaN | 10000.0 | NaN | NaN | NaN |
59 | O1 | 29 | 0 | NaN | NaN | 30 | NaN | NaN | NaN | NaN |
60 | O2 | 31 | 0 | NaN | NaN | 32 | NaN | NaN | NaN | NaN |
61 | K1 | NaN | NaN | NaN | NaN | NaN | 0.8 | NaN | L1 | L2 |
62 | K2 | NaN | NaN | NaN | NaN | NaN | 0.2 | NaN | L3 | L4 |
63 rows × 10 columns
12.2.6 Unknown current dataframe
i_unk_df
element | p node | n node | |
---|---|---|---|
0 | V1 | 22 | 0 |
1 | V2 | 1 | 0 |
2 | V3 | 10 | 3 |
3 | V4 | 10 | 20 |
4 | V5 | 20 | 28 |
5 | V6 | 23 | 27 |
6 | V7 | 24 | 25 |
7 | V8 | 0 | 6 |
8 | F1 | 14 | 7 |
9 | Ea1 | 15 | 21 |
10 | H1 | 4 | 0 |
11 | L1 | 16 | 23 |
12 | L2 | 25 | 9 |
13 | L3 | 22 | 21 |
14 | L4 | 17 | 11 |
15 | L5 | 0 | 7 |
16 | L6 | 9 | 2 |
17 | F2 | 0 | 27 |
18 | Ea2 | 17 | 26 |
19 | H2 | 27 | 26 |
20 | O1 | 29 | 0 |
21 | O2 | 31 | 0 |
12.2.7 Build the network equations
# Put matrices into SymPy
= Matrix(X)
X = Matrix(Z)
Z
= Eq(A*X,Z) NE_sym
Turn the free symbols into SymPy variables.
str(NE_sym.free_symbols).replace('{','').replace('}','')) var(
\(\displaystyle \left( ea_{1}, \ v_{19}, \ R_{8}, \ I_{Ea2}, \ R_{14}, \ R_{3}, \ R_{15}, \ g_{2}, \ v_{27}, \ I_{V8}, \ V_{5}, \ V_{8}, \ h_{2}, \ V_{6}, \ I_{V7}, \ v_{32}, \ R_{31}, \ I_{H2}, \ v_{25}, \ R_{1}, \ v_{5}, \ M_{1}, \ I_{V1}, \ R_{19}, \ I_{1}, \ I_{V5}, \ I_{L1}, \ I_{L4}, \ v_{7}, \ R_{18}, \ R_{16}, \ R_{25}, \ v_{20}, \ v_{8}, \ R_{4}, \ s, \ v_{28}, \ v_{22}, \ v_{14}, \ C_{2}, \ ea_{2}, \ v_{24}, \ v_{16}, \ I_{O1}, \ v_{4}, \ f_{1}, \ h_{1}, \ v_{3}, \ v_{10}, \ V_{1}, \ R_{9}, \ R_{12}, \ I_{4}, \ I_{L3}, \ R_{20}, \ v_{26}, \ v_{11}, \ R_{23}, \ I_{L6}, \ v_{31}, \ v_{9}, \ g_{1}, \ I_{3}, \ V_{3}, \ I_{V3}, \ V_{4}, \ I_{V2}, \ v_{23}, \ R_{22}, \ L_{1}, \ R_{10}, \ v_{1}, \ I_{V4}, \ R_{6}, \ v_{13}, \ R_{21}, \ L_{2}, \ I_{L2}, \ L_{4}, \ v_{6}, \ I_{F2}, \ v_{17}, \ L_{6}, \ R_{30}, \ R_{2}, \ R_{28}, \ L_{5}, \ v_{12}, \ v_{18}, \ R_{29}, \ I_{Ea1}, \ C_{1}, \ R_{17}, \ L_{3}, \ R_{27}, \ R_{26}, \ V_{2}, \ v_{21}, \ I_{L5}, \ v_{2}, \ V_{7}, \ R_{5}, \ v_{29}, \ f_{2}, \ I_{2}, \ I_{F1}, \ R_{13}, \ v_{15}, \ R_{24}, \ v_{30}, \ I_{O2}, \ M_{2}, \ I_{H1}, \ R_{7}, \ R_{11}, \ I_{V6}\right)\)
12.3 Symbolic solution
The symbolic solution was taking longer than a couple of minutes on my i3-8130U CPU @ 2.20GHz, so I interruped the kernel and commended the code.
#U_sym = solve(NE_sym,X)
Display the symbolic solution
#temp = ''
#for i in U_sym.keys():
# temp += '${:s} = {:s}$<br>'.format(latex(i),latex(U_sym[i]))
#Markdown(temp)
12.4 Construct a dictionary of element values
= SymMNA.get_part_values(network_df)
element_values
# display the component values
for k,v in element_values.items():
print('{:s} = {:s}'.format(str(k), str(v)))
V1 = 10.0
V2 = 2.0
V3 = 3.0
V4 = 5.0
V5 = 0.0
V6 = 0.0
V7 = 0.0
V8 = 0.0
R1 = 5.0
R2 = 2.0
R6 = 5.0
R8 = 8.0
R10 = 9.0
R11 = 4.0
R12 = 2.0
R14 = 10.0
R15 = 5.0
I1 = 3.0
I2 = 1.0
I3 = 2.0
I4 = 2.0
R7 = 10.0
R16 = 6.0
R3 = 10.0
R4 = 3.0
f1 = 2.0
ea1 = 2.0
h1 = 3.0
g1 = 2.0
L1 = 1.0
L2 = 4.0
L3 = 2.0
L4 = 5.0
C1 = 2.0
C2 = 2.0
L5 = 1.0
L6 = 2.0
f2 = 2.0
ea2 = 2.0
h2 = 3.0
g2 = 2.0
R9 = 3.0
R13 = 5.0
R17 = 5.0
R18 = 2.0
R19 = 7.0
R20 = 5.0
R21 = 3.0
R22 = 3.0
R23 = 1.0
R24 = 3.0
R25 = 10.0
R5 = 3.0
R26 = 20000.0
R27 = 10000.0
R28 = 2.0
R29 = 5.0
R30 = 20000.0
R31 = 10000.0
O1 = nan
O2 = nan
K1 = 0.8
K2 = 0.2
12.4.1 Mutual inductance
In the netlist, the line below specifies that L3 and L4 are connected by a magnetic circuit. >K1 L1 L2 0.8
K2 L3 L4 0.2
K1 identifies the mutual inductance between in two inductors, L3 and L4. k is the coefficient of coupling.
A coupled inductor has two or more windings that are connected by a magnetic circuit. Coupled inductors transfer energy from one winding to a different winding usually through a commonly used core. The efficiency of the magnetic coupling between both the windings is defined by the coupling factor k or by mutual inductance.
The coupling constant and the mutual inductance are related by the equation:
\(k = \frac {M}{\sqrt{L_1 \times L_2}}\)
Where k is the coupling coefficient and in spice the value of k can be from -1 to +1 to account for a a negative phase relation. Phase dots are drawn on the schematic to indicate the relative direction of the windings. In LTspice the phase dots are associated with the negative terminal of the winding.
= symbols('K1 K2')
K1, K2
# calculate the coupling constant from the mutual inductance
= element_values[K1]*np.sqrt(element_values[L1] *element_values[L2])
element_values[M1] print('mutual inductance, M1 = {:.9f}'.format(element_values[M1]))
= element_values[K2]*np.sqrt(element_values[L3] *element_values[L4])
element_values[M2] print('mutual inductance, M2 = {:.9f}'.format(element_values[M2]))
mutual inductance, M1 = 1.600000000
mutual inductance, M2 = 0.632455532
12.5 DC operating point
= NE_sym.subs(element_values)
NE = NE.subs({s:0}) NE_dc
Display the equations with numeric values.
= ''
temp for i in range(shape(NE_dc.lhs)[0]):
+= '${:s} = {:s}$<br>'.format(latex(NE_dc.rhs[i]),latex(NE_dc.lhs[i]))
temp
Markdown(temp)
\(0 = I_{V2} + 1.0 v_{1} - 0.5 v_{2} - 0.5 v_{8}\)
\(-1.0 = - I_{L6} - 0.5 v_{1} + 0.7 v_{2}\)
\(1.0 = - I_{V3} + 0.5 v_{3} - 0.333333333333333 v_{4}\)
\(0 = I_{H1} + 2.0 v_{12} - 2.0 v_{13} - 0.333333333333333 v_{3} + 1.33333333333333 v_{4} - 1.0 v_{5}\)
\(-3.0 = - 0.1 v_{12} - 1.0 v_{4} + 1.1 v_{5}\)
\(0 = - I_{V8} - 0.5 v_{13} + 0.5 v_{6}\)
\(0 = - I_{F1} - I_{L5}\)
\(0 = - 0.5 v_{1} - 0.2 v_{16} - 0.0001 v_{31} + 0.9501 v_{8} - 0.25 v_{9}\)
\(2.0 = - I_{L2} + I_{L6} - 0.1 v_{10} - 0.25 v_{8} + 0.35 v_{9}\)
\(0 = I_{V3} + I_{V4} + 0.225 v_{10} - 0.125 v_{11} - 0.1 v_{9}\)
\(0 = - I_{L4} - 0.125 v_{10} + 0.125 v_{11} - 2.0 v_{12} + 2.0 v_{13}\)
\(-2.0 = 0.1 v_{12} - 0.1 v_{5}\)
\(0 = 1.53333333333333 v_{13} - 0.333333333333333 v_{14} - 0.2 v_{19} - 0.5 v_{30} - 0.5 v_{6}\)
\(0 = I_{F1} - 0.333333333333333 v_{13} + 0.666666666666667 v_{14} - 0.333333333333333 v_{20}\)
\(0 = I_{Ea1} + 0.2 v_{15}\)
\(-2.0 = I_{L1} + 0.533333333333333 v_{16} - 0.333333333333333 v_{22} - 2.0 v_{5} - 0.2 v_{8}\)
\(0 = I_{Ea2} + I_{L4}\)
\(2.0 = 0.333333333333333 v_{18} - 0.333333333333333 v_{19}\)
\(0 = - 0.2 v_{13} - 0.333333333333333 v_{18} + 0.876190476190476 v_{19} - 0.2 v_{20} - 0.142857142857143 v_{23}\)
\(0 = - I_{V4} + I_{V5} - 0.333333333333333 v_{14} - 0.2 v_{19} + 0.533333333333333 v_{20}\)
\(0 = - I_{Ea1} - I_{L3} + 5.0 \cdot 10^{-5} v_{21} - 5.0 \cdot 10^{-5} v_{29}\)
\(0 = I_{L3} + I_{V1} - 0.333333333333333 v_{16} + 0.444444444444444 v_{22} - 0.111111111111111 v_{23}\)
\(0 = - I_{L1} + I_{V6} - 0.142857142857143 v_{19} - 0.111111111111111 v_{22} + 0.553968253968254 v_{23} - 0.2 v_{24} - 0.1 v_{28}\)
\(0 = I_{V7} - 0.2 v_{23} + 0.4 v_{24} - 0.2 v_{32}\)
\(0 = I_{L2} - I_{V7} + 0.1 v_{25} - 0.1 v_{26}\)
\(0 = - I_{Ea2} - I_{H2} - 0.1 v_{25} + 0.1 v_{26}\)
\(0 = - I_{F2} + I_{H2} - I_{V6}\)
\(0 = - I_{V5} - 0.1 v_{23} + 0.433333333333333 v_{28} + 2.0 v_{5}\)
\(0 = - 5.0 \cdot 10^{-5} v_{21} + 0.00015 v_{29} - 0.0001 v_{30}\)
\(0 = I_{O1} - 0.5 v_{13} - 0.0001 v_{29} + 0.5001 v_{30}\)
\(0 = 0.00015 v_{31} - 5.0 \cdot 10^{-5} v_{32} - 0.0001 v_{8}\)
\(0 = I_{O2} - 0.2 v_{24} - 5.0 \cdot 10^{-5} v_{31} + 0.20005 v_{32}\)
\(10.0 = v_{22}\)
\(2.0 = v_{1}\)
\(3.0 = v_{10} - v_{3}\)
\(5.0 = v_{10} - v_{20}\)
\(0 = v_{20} - v_{28}\)
\(0 = v_{23} - v_{27}\)
\(0 = v_{24} - v_{25}\)
\(0 = - v_{6}\)
\(0 = I_{F1} - 2.0 I_{V2}\)
\(0 = v_{15} - 2.0 v_{2} - v_{21} + 2.0 v_{7}\)
\(0 = - 3.0 I_{V2} + v_{4}\)
\(0 = v_{16} - v_{23}\)
\(0 = v_{25} - v_{9}\)
\(0 = - v_{21} + v_{22}\)
\(0 = - v_{11} + v_{17}\)
\(0 = - v_{7}\)
\(0 = - v_{2} + v_{9}\)
\(0 = I_{F2} - 2.0 I_{V2}\)
\(0 = - 2.0 v_{10} + v_{17} - v_{26} + 2.0 v_{9}\)
\(0 = - 3.0 I_{V2} - v_{26} + v_{27}\)
\(0 = v_{29}\)
\(0 = v_{31}\)
Solve for voltages and currents.
= solve(NE_dc,X) U_dc
Display the numerical solution
Six significant digits are displayed so that results can be compared to LTSpice.
= ['unknown', 'mag']
table_header = []
table_row
for name, value in U_dc.items():
str(name),float(value)])
table_row.append([
print(tabulate(table_row, headers=table_header,colalign = ('left','decimal'),tablefmt="simple",floatfmt=('5s','.6f')))
unknown mag
--------- ----------
v1 2.000000
v2 5.487985
v3 -13.447794
v4 17.339762
v5 12.339762
v6 0.000000
v7 0.000000
v8 10.071856
v9 5.487985
v10 -10.447794
v11 -13.224949
v12 -7.660238
v13 -7.240585
v14 -28.683952
v15 20.975971
v16 35.986371
v17 -13.224949
v18 10.795432
v19 4.795432
v20 -15.447794
v21 10.000000
v22 10.000000
v23 35.986371
v24 5.487985
v25 5.487985
v26 18.646609
v27 35.986371
v28 -15.447794
v29 0.000000
v30 -5.000000
v31 0.000000
v32 -20.143712
I_V1 7.353804
I_V2 5.779921
I_V3 -13.503818
I_V4 14.750251
I_V5 14.386843
I_V6 -9.751819
I_V7 0.973338
I_V8 3.620293
I_F1 11.559841
I_Ea1 -4.195194
I_H1 -14.423214
I_L1 8.834498
I_L2 2.289200
I_L3 4.195694
I_L4 0.492160
I_L5 -11.559841
I_L6 3.841590
I_F2 11.559841
I_Ea2 -0.492160
I_H2 1.808023
I_O1 -1.119793
I_O2 5.127347
The node voltages and current through the sources are solved for. The Sympy generated solution matches the LTSpice results:
--- Operating Point ---
V(16): 35.9859 voltage
V(8): 10.0718 voltage
V(1): 2 voltage
V(2): 5.48801 voltage
V(11): -13.2252 voltage
V(10): -10.4477 voltage
V(23): 35.9859 voltage
V(22): 10 voltage
V(9): 5.48801 voltage
V(24): 5.48801 voltage
V(3): -13.4477 voltage
V(20): -15.4477 voltage
V(5): 12.3397 voltage
V(12): -7.66035 voltage
V(18): 10.7954 voltage
V(26): 18.6462 voltage
V(25): 5.48801 voltage
V(4): 17.3397 voltage
V(14): -28.6838 voltage
V(7): 0 voltage
V(15): 20.976 voltage
V(21): 10 voltage
V(13): -7.24054 voltage
V(28): -15.4477 voltage
V(27): 35.9859 voltage
V(17): -13.2252 voltage
V(6): 0 voltage
V(19): 4.79535 voltage
V(32): -20.1428 voltage
V(31): 0.000252699 voltage
V(30): -4.99994 voltage
V(29): 3.88014e-05 voltage
I(C1): 5.03811e-11 device_current
I(C2): 1.11297e-11 device_current
I(F1): 11.5598 device_current
I(F2): 11.5598 device_current
I(H1): -14.4228 device_current
I(H2): 1.80825 device_current
I(L1): 8.83452 device_current
I(L2): 2.28924 device_current
I(L3): 4.1957 device_current
I(L4): 0.492428 device_current
I(L5): -11.5598 device_current
I(L6): 3.84161 device_current
I(I1): 3 device_current
I(I2): 1 device_current
I(I3): 2 device_current
I(I4): 2 device_current
I(R1): 5.18282 device_current
I(R2): 4.03588 device_current
I(R6): 1.0976 device_current
I(R8): -0.347188 device_current
I(R10): 2.88732 device_current
I(R11): -1.14594 device_current
I(R12): 1.744 device_current
I(R14): -1.59357 device_current
I(R15): -6.09957 device_current
I(R7): -2 device_current
I(R16): -2.24128 device_current
I(R3): 1.31582 device_current
I(R4): 10.2625 device_current
I(R9): -8.66196 device_current
I(R13): 4.1952 device_current
I(R17): 2.40718 device_current
I(R18): -3.62027 device_current
I(R19): 4.45579 device_current
I(R20): -4.04861 device_current
I(R21): -2 device_current
I(R22): -7.14775 device_current
I(R23): -5 device_current
I(R24): 4.41202 device_current
I(R25): 5.14336 device_current
I(R5): -5.14924 device_current
I(R26): -0.00100715 device_current
I(R27): -0.000499998 device_current
I(R28): -1.1203 device_current
I(R29): 5.12615 device_current
I(R30): -0.000499998 device_current
I(R31): -0.00100715 device_current
I(G1): 0.839616 device_current
I(G2): -24.6793 device_current
I(E1): -4.1952 device_current
I(E2): -0.492428 device_current
I(V1): 7.35358 device_current
I(V2): 5.77988 device_current
I(V3): -13.5037 device_current
I(V4): 14.7501 device_current
I(V5): 14.3867 device_current
I(V6): -9.75152 device_current
I(V7): 0.97342 device_current
I(V8): 3.62027 device_current
Ix(u1:3): -1.1198 subckt_current
Ix(u2:3): 5.12716 subckt_current
The results from LTSpice are slightly different in some cases starting at the 2nd decimal place.
12.5.1 AC analysis
Solve equations for \(\omega\) equal to 1 radian per second, s = 1j. V1 is the AC source, magnitude of 10
V2, V3, V4, I1, I2, I3, I4 are DC sources and are set to zero for AC analysis.
= 0
element_values[V2] = 0
element_values[V3] = 0
element_values[V4] = 0
element_values[I1] = 0
element_values[I2] = 0
element_values[I3] = 0
element_values[I4]
= NE_sym.subs(element_values)
NE = NE.subs({s:1j}) NE_w1
Display the equations with numeric values.
= ''
temp for i in range(shape(NE_w1.lhs)[0]):
+= '${:s} = {:s}$<br>'.format(latex(NE_w1.rhs[i]),latex(NE_w1.lhs[i]))
temp
Markdown(temp)
\(0 = I_{V2} + 1.0 v_{1} - 0.5 v_{2} - 0.5 v_{8}\)
\(0 = - I_{L6} - 0.5 v_{1} + 0.7 v_{2}\)
\(0 = - I_{V3} + 0.5 v_{3} - 0.333333333333333 v_{4}\)
\(0 = I_{H1} + 2.0 v_{12} - 2.0 v_{13} - 0.333333333333333 v_{3} + 1.33333333333333 v_{4} - 1.0 v_{5}\)
\(0 = - 0.1 v_{12} - 1.0 v_{4} + 1.1 v_{5}\)
\(0 = - I_{V8} - 0.5 v_{13} + 0.5 v_{6}\)
\(0 = - I_{F1} - I_{L5}\)
\(0 = - 0.5 v_{1} - 0.2 v_{16} - 0.0001 v_{31} + 0.9501 v_{8} - 0.25 v_{9}\)
\(0 = - I_{L2} + I_{L6} - 0.1 v_{10} - 0.25 v_{8} + 0.35 v_{9}\)
\(0 = I_{V3} + I_{V4} + 0.225 v_{10} - 0.125 v_{11} - 0.1 v_{9}\)
\(0 = - I_{L4} - 0.125 v_{10} + v_{11} \cdot \left(0.125 + 2.0 i\right) + v_{12} \left(-2.0 - 2.0 i\right) + 2.0 v_{13}\)
\(0 = - 2.0 i v_{11} + v_{12} \cdot \left(0.1 + 2.0 i\right) - 0.1 v_{5}\)
\(0 = 1.53333333333333 v_{13} - 0.333333333333333 v_{14} - 0.2 v_{19} - 0.5 v_{30} - 0.5 v_{6}\)
\(0 = I_{F1} - 0.333333333333333 v_{13} + 0.666666666666667 v_{14} - 0.333333333333333 v_{20}\)
\(0 = I_{Ea1} + 0.2 v_{15}\)
\(0 = I_{L1} + 0.533333333333333 v_{16} - 0.333333333333333 v_{22} - 2.0 v_{5} - 0.2 v_{8}\)
\(0 = I_{Ea2} + I_{L4}\)
\(0 = v_{18} \cdot \left(0.333333333333333 + 2.0 i\right) - 0.333333333333333 v_{19} - 2.0 i v_{23}\)
\(0 = - 0.2 v_{13} - 0.333333333333333 v_{18} + 0.876190476190476 v_{19} - 0.2 v_{20} - 0.142857142857143 v_{23}\)
\(0 = - I_{V4} + I_{V5} - 0.333333333333333 v_{14} - 0.2 v_{19} + 0.533333333333333 v_{20}\)
\(0 = - I_{Ea1} - I_{L3} + 5.0 \cdot 10^{-5} v_{21} - 5.0 \cdot 10^{-5} v_{29}\)
\(0 = I_{L3} + I_{V1} - 0.333333333333333 v_{16} + 0.444444444444444 v_{22} - 0.111111111111111 v_{23}\)
\(0 = - I_{L1} + I_{V6} - 2.0 i v_{18} - 0.142857142857143 v_{19} - 0.111111111111111 v_{22} + v_{23} \cdot \left(0.553968253968254 + 2.0 i\right) - 0.2 v_{24} - 0.1 v_{28}\)
\(0 = I_{V7} - 0.2 v_{23} + 0.4 v_{24} - 0.2 v_{32}\)
\(0 = I_{L2} - I_{V7} + 0.1 v_{25} - 0.1 v_{26}\)
\(0 = - I_{Ea2} - I_{H2} - 0.1 v_{25} + 0.1 v_{26}\)
\(0 = - I_{F2} + I_{H2} - I_{V6}\)
\(0 = - I_{V5} - 0.1 v_{23} + 0.433333333333333 v_{28} + 2.0 v_{5}\)
\(0 = - 5.0 \cdot 10^{-5} v_{21} + 0.00015 v_{29} - 0.0001 v_{30}\)
\(0 = I_{O1} - 0.5 v_{13} - 0.0001 v_{29} + 0.5001 v_{30}\)
\(0 = 0.00015 v_{31} - 5.0 \cdot 10^{-5} v_{32} - 0.0001 v_{8}\)
\(0 = I_{O2} - 0.2 v_{24} - 5.0 \cdot 10^{-5} v_{31} + 0.20005 v_{32}\)
\(10.0 = v_{22}\)
\(0 = v_{1}\)
\(0 = v_{10} - v_{3}\)
\(0 = v_{10} - v_{20}\)
\(0 = v_{20} - v_{28}\)
\(0 = v_{23} - v_{27}\)
\(0 = v_{24} - v_{25}\)
\(0 = - v_{6}\)
\(0 = I_{F1} - 2.0 I_{V2}\)
\(0 = v_{15} - 2.0 v_{2} - v_{21} + 2.0 v_{7}\)
\(0 = - 3.0 I_{V2} + v_{4}\)
\(0 = - 1.0 i I_{L1} - 1.6 i I_{L2} + v_{16} - v_{23}\)
\(0 = - 1.6 i I_{L1} - 4.0 i I_{L2} + v_{25} - v_{9}\)
\(0 = - 2.0 i I_{L3} - 0.632455532033676 i I_{L4} - v_{21} + v_{22}\)
\(0 = - 0.632455532033676 i I_{L3} - 5.0 i I_{L4} - v_{11} + v_{17}\)
\(0 = - 1.0 i I_{L5} - v_{7}\)
\(0 = - 2.0 i I_{L6} - v_{2} + v_{9}\)
\(0 = I_{F2} - 2.0 I_{V2}\)
\(0 = - 2.0 v_{10} + v_{17} - v_{26} + 2.0 v_{9}\)
\(0 = - 3.0 I_{V2} - v_{26} + v_{27}\)
\(0 = v_{29}\)
\(0 = v_{31}\)
Solve for voltages and currents.
= solve(NE_w1,X) U_w1
Display the numerical solution
Six significant digits are displayed so that results can be compared to LTSpice.
= ['unknown', 'mag','phase, deg']
table_header = []
table_row
for name, value in U_w1.items():
str(name),float(abs(value)),float(arg(value)*180/np.pi)])
table_row.append([
print(tabulate(table_row, headers=table_header,colalign = ('left','decimal','decimal'),tablefmt="simple",floatfmt=('5s','.6f','.6f')))
unknown mag phase, deg
--------- --------- ------------
v1 0.000000 nan
v2 0.529312 -148.498854
v3 2.318355 160.462708
v4 2.716202 -16.110995
v5 2.274423 -15.079695
v6 0.000000 nan
v7 1.810802 73.889005
v8 2.202609 -5.887185
v9 0.910663 -94.036532
v10 2.318355 160.462708
v11 2.230400 146.370665
v12 2.194128 152.046037
v13 1.799206 158.492008
v14 4.771405 162.040739
v15 8.166288 -49.821325
v16 10.488620 0.340133
v17 3.084191 60.400459
v18 8.481449 -4.374848
v19 3.704998 -2.371134
v20 2.318355 160.462708
v21 7.507931 -17.093526
v22 10.000000 0.000000
v23 8.497267 -9.753103
v24 4.119822 7.433394
v25 4.119822 7.433394
v26 5.805567 -6.783261
v27 8.497267 -9.753103
v28 2.318355 160.462708
v29 0.000000 nan
v30 3.753966 162.906474
v31 0.000000 nan
v32 4.405217 174.112815
I_V1 1.542202 134.030697
I_V2 0.905401 -16.110995
I_V3 2.063669 161.965216
I_V4 2.338768 -18.698461
I_V5 2.701207 -15.096706
I_V6 1.422424 -174.447987
I_V7 0.931072 -153.824119
I_V8 0.899603 -21.507992
I_F1 1.810802 -16.110995
I_Ea1 1.633258 130.178675
I_H1 1.484613 -177.450035
I_L1 2.862976 -26.151162
I_L2 0.854027 -141.418577
I_L3 1.633573 -49.814207
I_L4 0.541202 -73.251389
I_L5 1.810802 163.889005
I_L6 0.370519 -148.498854
I_F2 1.810802 -16.110995
I_Ea2 0.541202 106.748611
I_H2 0.717411 -63.158104
I_O1 0.982866 -13.053681
I_O2 1.693733 0.548292
--- AC Analysis ---
frequency: 0.159155 Hz
V(16): mag: 10.4887 phase: 0.339452° voltage
V(8): mag: 2.20263 phase: -5.8879° voltage
V(1): mag: 0 phase: 0° voltage
V(2): mag: 0.529319 phase: -148.499° voltage
V(11): mag: 2.23038 phase: 146.371° voltage
V(10): mag: 2.31839 phase: 160.462° voltage
V(23): mag: 8.49732 phase: -9.75384° voltage
V(22): mag: 10 phase: 0° voltage
V(9): mag: 0.910675 phase: -94.0363° voltage
V(24): mag: 4.1199 phase: 7.43283° voltage
V(3): mag: 2.31839 phase: 160.462° voltage
V(20): mag: 2.31839 phase: 160.462° voltage
V(5): mag: 2.27445 phase: -15.0807° voltage
V(12): mag: 2.19411 phase: 152.046° voltage
V(18): mag: 8.4815 phase: -4.37559° voltage
V(26): mag: 5.80559 phase: -6.78388° voltage
V(25): mag: 4.1199 phase: 7.43283° voltage
V(4): mag: 2.71624 phase: -16.1119° voltage
V(14): mag: 4.77144 phase: 162.04° voltage
V(7): mag: 1.81082 phase: 73.8881° voltage
V(15): mag: 8.16625 phase: -49.8218° voltage
V(21): mag: 7.50792 phase: -17.0934° voltage
V(13): mag: 1.79919 phase: 158.492° voltage
V(28): mag: 2.31839 phase: 160.462° voltage
V(27): mag: 8.49732 phase: -9.75384° voltage
V(17): mag: 3.08423 phase: 60.4014° voltage
V(6): mag: 0 phase: 0° voltage
V(19): mag: 3.70502 phase: -2.37192° voltage
V(32): mag: 4.40507 phase: 174.112° voltage
V(31): mag: 6.0913e-05 phase: -4.03597° voltage
V(30): mag: 3.75389 phase: 162.907° voltage
V(29): mag: 4.73489e-05 phase: -16.1831° voltage
I(C1): mag: 1.5935 phase: -5.92837° device_current
I(C2): mag: 0.444041 phase: -21.4012° device_current
I(F1): mag: 1.81082 phase: -16.1119° device_current
I(F2): mag: 1.81082 phase: -16.1119° device_current
I(H1): mag: 1.48461 phase: -177.452° device_current
I(H2): mag: 0.717409 phase: -63.1574° device_current
I(L1): mag: 2.86299 phase: -26.1518° device_current
I(L2): mag: 0.854034 phase: -141.418° device_current
I(L3): mag: 1.63357 phase: -49.8147° device_current
I(L4): mag: 0.541197 phase: -73.2497° device_current
I(L5): mag: 1.81082 phase: 163.888° device_current
I(L6): mag: 0.370523 phase: -148.499° device_current
I(I1): mag: 0 phase: 0° device_current
I(I2): mag: 0 phase: 0° device_current
I(I3): mag: 0 phase: 0° device_current
I(I4): mag: 0 phase: 0° device_current
I(R1): mag: 1.6605 phase: 1.98853° device_current
I(R2): mag: 1.10131 phase: -5.8879° device_current
I(R6): mag: 0.105864 phase: -148.499° device_current
I(R8): mag: 0.0705929 phase: 54.5194° device_current
I(R10): mag: 0.241259 phase: -138.471° device_current
I(R11): mag: 0.589029 phase: -163.163° device_current
I(R12): mag: 0.26466 phase: -148.499° device_current
I(R14): mag: 0.270792 phase: 141.553° device_current
I(R15): mag: 0.944208 phase: 155.303° device_current
I(R7): mag: 0.444041 phase: 158.599° device_current
I(R16): mag: 0.386398 phase: 160.462° device_current
I(R3): mag: 0.207524 phase: -35.9644° device_current
I(R4): mag: 1.67746 phase: -17.6897° device_current
I(R9): mag: 0.164149 phase: -172.751° device_current
I(R13): mag: 1.63325 phase: -49.8218° device_current
I(R17): mag: 1.08737 phase: -8.59974° device_current
I(R18): mag: 0.899593 phase: 158.492° device_current
I(R19): mag: 0.692348 phase: -15.3907° device_current
I(R20): mag: 1.19191 phase: 171.035° device_current
I(R21): mag: 1.5935 phase: 174.072° device_current
I(R22): mag: 0.992596 phase: 164.183° device_current
I(R23): mag: 0.444041 phase: 158.599° device_current
I(R24): mag: 0.818256 phase: -16.4696° device_current
I(R25): mag: 1.07892 phase: -11.8466° device_current
I(R5): mag: 0.772795 phase: 160.462° device_current
I(R26): mag: 0.000220257 phase: 174.112° device_current
I(R27): mag: 0.000375394 phase: 162.907° device_current
I(R28): mag: 0.982466 phase: -13.0516° device_current
I(R29): mag: 1.6935 phase: 0.548618° device_current
I(R30): mag: 0.000375394 phase: 162.907° device_current
I(R31): mag: 0.000220257 phase: 174.112° device_current
I(G1): mag: 0.90747 phase: -54.3873° device_current
I(G2): mag: 4.54891 phase: 164.919° device_current
I(E1): mag: 1.63325 phase: 130.178° device_current
I(E2): mag: 0.541197 phase: 106.75° device_current
I(V1): mag: 1.54213 phase: 134.031° device_current
I(V2): mag: 0.905412 phase: -16.1119° device_current
I(V3): mag: 2.0637 phase: 161.964° device_current
I(V4): mag: 2.3388 phase: -18.6996° device_current
I(V5): mag: 2.70125 phase: -15.0979° device_current
I(V6): mag: 1.42243 phase: -174.45° device_current
I(V7): mag: 0.931071 phase: -153.824° device_current
I(V8): mag: 0.899593 phase: -21.5082° device_current
Ix(u1:3): mag: 0.98284 phase: -13.0531° subckt_current
Ix(u2:3): mag: 1.69372 phase: 0.547783° subckt_current
12.5.2 AC Sweep
Looking at node 21 voltage and comparing the results with those obtained from LTSpice. The frequency sweep is from 0.01 Hz to 1 Hz.
= NE_sym.subs(element_values) NE
Display the equations with numeric values.
= ''
temp for i in range(shape(NE.lhs)[0]):
+= '${:s} = {:s}$<br>'.format(latex(NE.rhs[i]),latex(NE.lhs[i]))
temp
Markdown(temp)
\(0 = I_{V2} + 1.0 v_{1} - 0.5 v_{2} - 0.5 v_{8}\)
\(0 = - I_{L6} - 0.5 v_{1} + 0.7 v_{2}\)
\(0 = - I_{V3} + 0.5 v_{3} - 0.333333333333333 v_{4}\)
\(0 = I_{H1} + 2.0 v_{12} - 2.0 v_{13} - 0.333333333333333 v_{3} + 1.33333333333333 v_{4} - 1.0 v_{5}\)
\(0 = - 0.1 v_{12} - 1.0 v_{4} + 1.1 v_{5}\)
\(0 = - I_{V8} - 0.5 v_{13} + 0.5 v_{6}\)
\(0 = - I_{F1} - I_{L5}\)
\(0 = - 0.5 v_{1} - 0.2 v_{16} - 0.0001 v_{31} + 0.9501 v_{8} - 0.25 v_{9}\)
\(0 = - I_{L2} + I_{L6} - 0.1 v_{10} - 0.25 v_{8} + 0.35 v_{9}\)
\(0 = I_{V3} + I_{V4} + 0.225 v_{10} - 0.125 v_{11} - 0.1 v_{9}\)
\(0 = - I_{L4} - 0.125 v_{10} + v_{11} \cdot \left(2.0 s + 0.125\right) + v_{12} \left(- 2.0 s - 2.0\right) + 2.0 v_{13}\)
\(0 = - 2.0 s v_{11} + v_{12} \cdot \left(2.0 s + 0.1\right) - 0.1 v_{5}\)
\(0 = 1.53333333333333 v_{13} - 0.333333333333333 v_{14} - 0.2 v_{19} - 0.5 v_{30} - 0.5 v_{6}\)
\(0 = I_{F1} - 0.333333333333333 v_{13} + 0.666666666666667 v_{14} - 0.333333333333333 v_{20}\)
\(0 = I_{Ea1} + 0.2 v_{15}\)
\(0 = I_{L1} + 0.533333333333333 v_{16} - 0.333333333333333 v_{22} - 2.0 v_{5} - 0.2 v_{8}\)
\(0 = I_{Ea2} + I_{L4}\)
\(0 = - 2.0 s v_{23} + v_{18} \cdot \left(2.0 s + 0.333333333333333\right) - 0.333333333333333 v_{19}\)
\(0 = - 0.2 v_{13} - 0.333333333333333 v_{18} + 0.876190476190476 v_{19} - 0.2 v_{20} - 0.142857142857143 v_{23}\)
\(0 = - I_{V4} + I_{V5} - 0.333333333333333 v_{14} - 0.2 v_{19} + 0.533333333333333 v_{20}\)
\(0 = - I_{Ea1} - I_{L3} + 5.0 \cdot 10^{-5} v_{21} - 5.0 \cdot 10^{-5} v_{29}\)
\(0 = I_{L3} + I_{V1} - 0.333333333333333 v_{16} + 0.444444444444444 v_{22} - 0.111111111111111 v_{23}\)
\(0 = - I_{L1} + I_{V6} - 2.0 s v_{18} - 0.142857142857143 v_{19} - 0.111111111111111 v_{22} + v_{23} \cdot \left(2.0 s + 0.553968253968254\right) - 0.2 v_{24} - 0.1 v_{28}\)
\(0 = I_{V7} - 0.2 v_{23} + 0.4 v_{24} - 0.2 v_{32}\)
\(0 = I_{L2} - I_{V7} + 0.1 v_{25} - 0.1 v_{26}\)
\(0 = - I_{Ea2} - I_{H2} - 0.1 v_{25} + 0.1 v_{26}\)
\(0 = - I_{F2} + I_{H2} - I_{V6}\)
\(0 = - I_{V5} - 0.1 v_{23} + 0.433333333333333 v_{28} + 2.0 v_{5}\)
\(0 = - 5.0 \cdot 10^{-5} v_{21} + 0.00015 v_{29} - 0.0001 v_{30}\)
\(0 = I_{O1} - 0.5 v_{13} - 0.0001 v_{29} + 0.5001 v_{30}\)
\(0 = 0.00015 v_{31} - 5.0 \cdot 10^{-5} v_{32} - 0.0001 v_{8}\)
\(0 = I_{O2} - 0.2 v_{24} - 5.0 \cdot 10^{-5} v_{31} + 0.20005 v_{32}\)
\(10.0 = v_{22}\)
\(0 = v_{1}\)
\(0 = v_{10} - v_{3}\)
\(0 = v_{10} - v_{20}\)
\(0 = v_{20} - v_{28}\)
\(0 = v_{23} - v_{27}\)
\(0 = v_{24} - v_{25}\)
\(0 = - v_{6}\)
\(0 = I_{F1} - 2.0 I_{V2}\)
\(0 = v_{15} - 2.0 v_{2} - v_{21} + 2.0 v_{7}\)
\(0 = - 3.0 I_{V2} + v_{4}\)
\(0 = - 1.0 I_{L1} s - 1.6 I_{L2} s + v_{16} - v_{23}\)
\(0 = - 1.6 I_{L1} s - 4.0 I_{L2} s + v_{25} - v_{9}\)
\(0 = - 2.0 I_{L3} s - 0.632455532033676 I_{L4} s - v_{21} + v_{22}\)
\(0 = - 0.632455532033676 I_{L3} s - 5.0 I_{L4} s - v_{11} + v_{17}\)
\(0 = - 1.0 I_{L5} s - v_{7}\)
\(0 = - 2.0 I_{L6} s - v_{2} + v_{9}\)
\(0 = I_{F2} - 2.0 I_{V2}\)
\(0 = - 2.0 v_{10} + v_{17} - v_{26} + 2.0 v_{9}\)
\(0 = - 3.0 I_{V2} - v_{26} + v_{27}\)
\(0 = v_{29}\)
\(0 = v_{31}\)
Solve for voltages and currents.
= solve(NE,X) U_ac
12.5.3 Plot the voltage at node 10
= U_ac[v21] H
= fraction(H) #returns numerator and denominator
num, denom
# convert symbolic to numpy polynomial
= np.array(Poly(num, s).all_coeffs(), dtype=float)
a = np.array(Poly(denom, s).all_coeffs(), dtype=float)
b = (a, b) system
#x = np.linspace(0.01*2*np.pi, 10*2*np.pi, 1000, endpoint=True)
= np.logspace(-2, 1, 300, endpoint=False)*2*np.pi
x = signal.bode(system, w=x) # returns: rad/s, mag in dB, phase in deg w, mag, phase
Load the csv file of node 10 voltage over the sweep range and plot along with the results obtained from SymPy.
= 'test_8.csv' # data from LTSpice
fn = np.genfromtxt(fn, delimiter=',') LTSpice_data
# initaliaze some empty arrays
= np.zeros(len(LTSpice_data))
frequency = np.zeros(len(LTSpice_data)).astype(complex)
voltage
# convert the csv data to complez numbers and store in the array
for i in range(len(LTSpice_data)):
= LTSpice_data[i][0]
frequency[i] = LTSpice_data[i][1] + LTSpice_data[i][2]*1j voltage[i]
Plot the results.
Using
np.unwrap(2 * phase) / 2)
to keep the pahse plots the same.
= plt.subplots()
fig, ax1 'magnitude, dB')
ax1.set_ylabel('frequency, Hz')
ax1.set_xlabel(
20*np.log10(np.abs(voltage)),'-r') # Bode magnitude plot
plt.semilogx(frequency, /(2*np.pi), mag,'-b') # Bode magnitude plot
plt.semilogx(w
='y')
ax1.tick_params(axis#ax1.set_ylim((-30,20))
plt.grid()
# instantiate a second y-axes that shares the same x-axis
= ax1.twinx()
ax2 = 'tab:blue'
color
2*np.angle(voltage)/2) *180/np.pi,':',color=color) # Bode phase plot
plt.semilogx(frequency, np.unwrap(/(2*np.pi), phase,':',color='tab:red') # Bode phase plot
plt.semilogx(w
'phase, deg',color=color)
ax2.set_ylabel(='y', labelcolor=color)
ax2.tick_params(axis#ax2.set_ylim((-5,25))
'Magnitude and phase response')
plt.title( plt.show()
= plt.subplots()
fig, ax1 'magnitude difference')
ax1.set_ylabel('frequency, Hz')
ax1.set_xlabel(
0:-1], np.abs(voltage[0:-1])-10**(mag/20),'-r') # Bode magnitude plot
plt.semilogx(frequency[#plt.semilogx(w/(2*np.pi), mag,'-b') # Bode magnitude plot
='y')
ax1.tick_params(axis#ax1.set_ylim((-30,20))
plt.grid()
# instantiate a second y-axes that shares the same x-axis
= ax1.twinx()
ax2 = 'tab:blue'
color
0:-1], np.unwrap(2*np.angle(voltage[0:-1])/2) *180/np.pi - phase,':',color=color) # Bode phase plot
plt.semilogx(frequency[#plt.semilogx(w/(2*np.pi), phase,':',color='tab:red') # Bode phase plot
'phase difference, deg',color=color)
ax2.set_ylabel(='y', labelcolor=color)
ax2.tick_params(axis#ax2.set_ylim((-5,25))
'Difference between LTSpice and Python results')
plt.title( plt.show()
The SymPy and LTSpice results overlay each other, but not to the same precision as in previous tests.
0:-1] frequency[
array([0.01 , 0.01023293, 0.01047129, 0.01071519, 0.01096478,
0.01122018, 0.01148154, 0.01174898, 0.01202264, 0.01230269,
0.01258925, 0.0128825 , 0.01318257, 0.01348963, 0.01380384,
0.01412538, 0.0144544 , 0.01479108, 0.01513561, 0.01548817,
0.01584893, 0.0162181 , 0.01659587, 0.01698244, 0.01737801,
0.01778279, 0.01819701, 0.01862087, 0.01905461, 0.01949845,
0.01995262, 0.02041738, 0.02089296, 0.02137962, 0.02187762,
0.02238721, 0.02290868, 0.02344229, 0.02398833, 0.02454709,
0.02511886, 0.02570396, 0.02630268, 0.02691535, 0.02754229,
0.02818383, 0.02884032, 0.02951209, 0.03019952, 0.03090295,
0.03162278, 0.03235937, 0.03311311, 0.03388442, 0.03467369,
0.03548134, 0.03630781, 0.03715352, 0.03801894, 0.03890451,
0.03981072, 0.04073803, 0.04168694, 0.04265795, 0.04365158,
0.04466836, 0.04570882, 0.04677351, 0.04786301, 0.04897788,
0.05011872, 0.05128614, 0.05248075, 0.05370318, 0.05495409,
0.05623413, 0.05754399, 0.05888437, 0.06025596, 0.0616595 ,
0.06309573, 0.06456542, 0.06606934, 0.0676083 , 0.0691831 ,
0.07079458, 0.0724436 , 0.07413102, 0.07585776, 0.07762471,
0.07943282, 0.08128305, 0.08317638, 0.0851138 , 0.08709636,
0.08912509, 0.09120108, 0.09332543, 0.09549926, 0.09772372,
0.1 , 0.1023293 , 0.10471285, 0.10715193, 0.10964782,
0.11220185, 0.11481536, 0.11748976, 0.12022644, 0.12302688,
0.12589254, 0.12882496, 0.13182567, 0.13489629, 0.13803843,
0.14125375, 0.14454398, 0.14791084, 0.15135612, 0.15488166,
0.15848932, 0.16218101, 0.16595869, 0.16982437, 0.17378008,
0.17782794, 0.18197009, 0.18620871, 0.19054607, 0.19498446,
0.19952623, 0.20417379, 0.20892961, 0.21379621, 0.21877616,
0.22387211, 0.22908677, 0.23442288, 0.23988329, 0.24547089,
0.25118864, 0.25703958, 0.2630268 , 0.26915348, 0.27542287,
0.28183829, 0.28840315, 0.29512092, 0.30199517, 0.30902954,
0.31622777, 0.32359366, 0.33113112, 0.33884416, 0.34673685,
0.35481339, 0.36307805, 0.37153523, 0.3801894 , 0.38904514,
0.39810717, 0.40738028, 0.41686938, 0.42657952, 0.43651583,
0.44668359, 0.45708819, 0.46773514, 0.47863009, 0.48977882,
0.50118723, 0.51286138, 0.52480746, 0.5370318 , 0.54954087,
0.56234133, 0.57543994, 0.58884366, 0.60255959, 0.616595 ,
0.63095734, 0.64565423, 0.66069345, 0.67608298, 0.69183097,
0.70794578, 0.72443596, 0.74131024, 0.75857758, 0.77624712,
0.79432823, 0.81283052, 0.83176377, 0.85113804, 0.87096359,
0.89125094, 0.91201084, 0.9332543 , 0.95499259, 0.97723722,
1. , 1.02329299, 1.04712855, 1.07151931, 1.0964782 ,
1.12201845, 1.14815362, 1.17489755, 1.20226443, 1.23026877,
1.25892541, 1.28824955, 1.31825674, 1.34896288, 1.38038426,
1.41253754, 1.44543977, 1.47910839, 1.51356125, 1.54881662,
1.58489319, 1.6218101 , 1.65958691, 1.69824365, 1.73780083,
1.77827941, 1.81970086, 1.86208714, 1.90546072, 1.9498446 ,
1.99526231, 2.04173794, 2.08929613, 2.13796209, 2.18776162,
2.23872114, 2.29086765, 2.34422882, 2.39883292, 2.45470892,
2.51188643, 2.57039578, 2.63026799, 2.6915348 , 2.7542287 ,
2.81838293, 2.8840315 , 2.95120923, 3.01995172, 3.09029543,
3.16227766, 3.23593657, 3.31131121, 3.38844156, 3.4673685 ,
3.54813389, 3.63078055, 3.71535229, 3.80189396, 3.89045145,
3.98107171, 4.07380278, 4.16869383, 4.26579519, 4.36515832,
4.46683592, 4.5708819 , 4.67735141, 4.78630092, 4.89778819,
5.01187234, 5.12861384, 5.2480746 , 5.37031796, 5.49540874,
5.62341325, 5.75439937, 5.88843655, 6.02559586, 6.16595002,
6.30957344, 6.45654229, 6.60693448, 6.76082975, 6.91830971,
7.07945784, 7.2443596 , 7.41310241, 7.58577575, 7.76247117,
7.94328235, 8.12830516, 8.31763771, 8.51138038, 8.7096359 ,
8.91250938, 9.12010839, 9.33254301, 9.54992586, 9.77237221])
/(2*np.pi) w
array([0.01 , 0.01023293, 0.01047129, 0.01071519, 0.01096478,
0.01122018, 0.01148154, 0.01174898, 0.01202264, 0.01230269,
0.01258925, 0.0128825 , 0.01318257, 0.01348963, 0.01380384,
0.01412538, 0.0144544 , 0.01479108, 0.01513561, 0.01548817,
0.01584893, 0.0162181 , 0.01659587, 0.01698244, 0.01737801,
0.01778279, 0.01819701, 0.01862087, 0.01905461, 0.01949845,
0.01995262, 0.02041738, 0.02089296, 0.02137962, 0.02187762,
0.02238721, 0.02290868, 0.02344229, 0.02398833, 0.02454709,
0.02511886, 0.02570396, 0.02630268, 0.02691535, 0.02754229,
0.02818383, 0.02884032, 0.02951209, 0.03019952, 0.03090295,
0.03162278, 0.03235937, 0.03311311, 0.03388442, 0.03467369,
0.03548134, 0.03630781, 0.03715352, 0.03801894, 0.03890451,
0.03981072, 0.04073803, 0.04168694, 0.04265795, 0.04365158,
0.04466836, 0.04570882, 0.04677351, 0.04786301, 0.04897788,
0.05011872, 0.05128614, 0.05248075, 0.05370318, 0.05495409,
0.05623413, 0.05754399, 0.05888437, 0.06025596, 0.0616595 ,
0.06309573, 0.06456542, 0.06606934, 0.0676083 , 0.0691831 ,
0.07079458, 0.0724436 , 0.07413102, 0.07585776, 0.07762471,
0.07943282, 0.08128305, 0.08317638, 0.0851138 , 0.08709636,
0.08912509, 0.09120108, 0.09332543, 0.09549926, 0.09772372,
0.1 , 0.1023293 , 0.10471285, 0.10715193, 0.10964782,
0.11220185, 0.11481536, 0.11748976, 0.12022644, 0.12302688,
0.12589254, 0.12882496, 0.13182567, 0.13489629, 0.13803843,
0.14125375, 0.14454398, 0.14791084, 0.15135612, 0.15488166,
0.15848932, 0.16218101, 0.16595869, 0.16982437, 0.17378008,
0.17782794, 0.18197009, 0.18620871, 0.19054607, 0.19498446,
0.19952623, 0.20417379, 0.20892961, 0.21379621, 0.21877616,
0.22387211, 0.22908677, 0.23442288, 0.23988329, 0.24547089,
0.25118864, 0.25703958, 0.2630268 , 0.26915348, 0.27542287,
0.28183829, 0.28840315, 0.29512092, 0.30199517, 0.30902954,
0.31622777, 0.32359366, 0.33113112, 0.33884416, 0.34673685,
0.35481339, 0.36307805, 0.37153523, 0.3801894 , 0.38904514,
0.39810717, 0.40738028, 0.41686938, 0.42657952, 0.43651583,
0.44668359, 0.45708819, 0.46773514, 0.47863009, 0.48977882,
0.50118723, 0.51286138, 0.52480746, 0.5370318 , 0.54954087,
0.56234133, 0.57543994, 0.58884366, 0.60255959, 0.616595 ,
0.63095734, 0.64565423, 0.66069345, 0.67608298, 0.69183097,
0.70794578, 0.72443596, 0.74131024, 0.75857758, 0.77624712,
0.79432823, 0.81283052, 0.83176377, 0.85113804, 0.87096359,
0.89125094, 0.91201084, 0.9332543 , 0.95499259, 0.97723722,
1. , 1.02329299, 1.04712855, 1.07151931, 1.0964782 ,
1.12201845, 1.14815362, 1.17489755, 1.20226443, 1.23026877,
1.25892541, 1.28824955, 1.31825674, 1.34896288, 1.38038426,
1.41253754, 1.44543977, 1.47910839, 1.51356125, 1.54881662,
1.58489319, 1.6218101 , 1.65958691, 1.69824365, 1.73780083,
1.77827941, 1.81970086, 1.86208714, 1.90546072, 1.9498446 ,
1.99526231, 2.04173794, 2.08929613, 2.13796209, 2.18776162,
2.23872114, 2.29086765, 2.34422882, 2.39883292, 2.45470892,
2.51188643, 2.57039578, 2.63026799, 2.6915348 , 2.7542287 ,
2.81838293, 2.8840315 , 2.95120923, 3.01995172, 3.09029543,
3.16227766, 3.23593657, 3.31131121, 3.38844156, 3.4673685 ,
3.54813389, 3.63078055, 3.71535229, 3.80189396, 3.89045145,
3.98107171, 4.07380278, 4.16869383, 4.26579519, 4.36515832,
4.46683592, 4.5708819 , 4.67735141, 4.78630092, 4.89778819,
5.01187234, 5.12861384, 5.2480746 , 5.37031796, 5.49540874,
5.62341325, 5.75439937, 5.88843655, 6.02559586, 6.16595002,
6.30957344, 6.45654229, 6.60693448, 6.76082975, 6.91830971,
7.07945784, 7.2443596 , 7.41310241, 7.58577575, 7.76247117,
7.94328235, 8.12830516, 8.31763771, 8.51138038, 8.7096359 ,
8.91250938, 9.12010839, 9.33254301, 9.54992586, 9.77237221])
0:-1] - w/(2*np.pi) frequency[
array([ 0.00000000e+00, -3.98986399e-17, 3.46944695e-18, 3.46944695e-17,
-5.03069808e-17, -3.46944695e-17, -2.94902991e-17, 1.73472348e-18,
-3.12250226e-17, -1.90819582e-17, 2.42861287e-17, -3.98986399e-17,
2.60208521e-17, -3.12250226e-17, -5.03069808e-17, -3.98986399e-17,
2.77555756e-17, 2.94902991e-17, 2.08166817e-17, -1.04083409e-17,
-3.46944695e-17, 0.00000000e+00, -6.93889390e-18, -4.16333634e-17,
-5.55111512e-17, -2.77555756e-17, -3.46944695e-17, 2.42861287e-17,
2.77555756e-17, -5.55111512e-17, 0.00000000e+00, 6.93889390e-18,
0.00000000e+00, -2.42861287e-17, -3.12250226e-17, 0.00000000e+00,
-2.77555756e-17, -2.77555756e-17, 3.46944695e-18, -1.04083409e-17,
3.46944695e-18, -4.16333634e-17, -1.73472348e-17, -5.20417043e-17,
-5.89805982e-17, -3.12250226e-17, -5.89805982e-17, -5.20417043e-17,
-5.89805982e-17, -3.46944695e-18, -9.02056208e-17, -2.77555756e-17,
-1.38777878e-17, -5.55111512e-17, -6.24500451e-17, -4.85722573e-17,
-4.16333634e-17, -6.24500451e-17, -2.77555756e-17, -4.85722573e-17,
-3.46944695e-17, -6.24500451e-17, -4.16333634e-17, -5.55111512e-17,
-1.11022302e-16, -9.71445147e-17, -1.11022302e-16, -1.11022302e-16,
-1.52655666e-16, -1.17961196e-16, -1.45716772e-16, -8.32667268e-17,
-1.59594560e-16, -6.93889390e-17, -1.52655666e-16, -1.11022302e-16,
-9.71445147e-17, -9.71445147e-17, -1.80411242e-16, -1.17961196e-16,
-1.24900090e-16, -1.66533454e-16, -2.08166817e-16, -1.80411242e-16,
-1.24900090e-16, -2.08166817e-16, -1.80411242e-16, -1.80411242e-16,
-1.52655666e-16, -1.94289029e-16, -2.35922393e-16, -2.35922393e-16,
-1.80411242e-16, -2.77555756e-16, -2.35922393e-16, -2.91433544e-16,
-2.63677968e-16, -2.91433544e-16, -2.91433544e-16, -2.63677968e-16,
-3.05311332e-16, -4.16333634e-16, 4.16333634e-17, -6.52256027e-16,
-5.13478149e-16, -3.60822483e-16, -2.91433544e-16, 2.77555756e-17,
-3.19189120e-16, -1.66533454e-16, -7.49400542e-16, -4.16333634e-16,
-7.21644966e-16, -3.88578059e-16, -5.27355937e-16, -4.71844785e-16,
-7.21644966e-16, -7.21644966e-16, -8.04911693e-16, -1.11022302e-16,
-3.33066907e-16, -9.71445147e-16, -1.02695630e-15, -4.16333634e-16,
-5.55111512e-16, -3.05311332e-16, -3.60822483e-16, -7.49400542e-16,
-7.49400542e-16, -5.82867088e-16, -9.99200722e-16, -9.43689571e-16,
-9.71445147e-16, -1.24900090e-15, -1.27675648e-15, -9.71445147e-16,
-1.36002321e-15, -1.30451205e-15, -1.11022302e-15, -1.11022302e-15,
-1.05471187e-15, -1.33226763e-15, -1.16573418e-15, -1.55431223e-15,
-1.60982339e-15, -1.38777878e-15, -1.55431223e-15, -1.55431223e-15,
-1.60982339e-15, -1.05471187e-15, -1.94289029e-15, -1.22124533e-15,
-1.11022302e-15, -1.55431223e-15, -1.66533454e-15, -1.49880108e-15,
-1.38777878e-15, -1.55431223e-15, -2.27595720e-15, -1.66533454e-15,
-2.33146835e-15, -1.83186799e-15, -2.55351296e-15, -1.77635684e-15,
-2.16493490e-15, -2.27595720e-15, -2.16493490e-15, -2.05391260e-15,
-2.27595720e-15, -2.22044605e-15, -2.22044605e-15, -2.77555756e-15,
-2.55351296e-15, -2.66453526e-15, -2.55351296e-15, -3.10862447e-15,
-2.88657986e-15, -2.99760217e-15, -2.77555756e-15, -3.21964677e-15,
-3.33066907e-15, -3.66373598e-15, -4.10782519e-15, -3.88578059e-15,
-3.66373598e-15, -3.99680289e-15, -4.32986980e-15, -4.77395901e-15,
-4.99600361e-15, -4.99600361e-15, -4.66293670e-15, -4.55191440e-15,
-4.88498131e-15, -4.32986980e-15, -4.44089210e-15, -5.44009282e-15,
-5.66213743e-15, -4.99600361e-15, -5.88418203e-15, -5.66213743e-15,
-5.99520433e-15, -4.66293670e-15, -9.54791801e-15, -7.10542736e-15,
-5.10702591e-15, -2.88657986e-15, -2.88657986e-15, -9.10382880e-15,
-3.10862447e-15, -1.11022302e-14, -7.54951657e-15, -3.77475828e-15,
-7.32747196e-15, -3.33066907e-15, -5.10702591e-15, -4.21884749e-15,
-7.99360578e-15, -7.32747196e-15, -8.65973959e-15, -1.13242749e-14,
-1.42108547e-14, -9.54791801e-15, -1.13242749e-14, -1.44328993e-14,
-1.62092562e-14, -1.26565425e-14, -1.42108547e-14, -7.54951657e-15,
-1.84297022e-14, -1.55431223e-14, -1.06581410e-14, -9.76996262e-15,
-1.86517468e-14, -1.24344979e-14, -1.15463195e-14, -1.99840144e-14,
-1.24344979e-14, -2.30926389e-14, -1.99840144e-14, -2.08721929e-14,
-1.95399252e-14, -2.48689958e-14, -2.13162821e-14, -1.68753900e-14,
-1.64313008e-14, -2.48689958e-14, -2.53130850e-14, -2.70894418e-14,
-2.66453526e-14, -2.17603713e-14, -2.93098879e-14, -2.39808173e-14,
-3.10862447e-14, -2.75335310e-14, -2.62012634e-14, -2.66453526e-14,
-3.41948692e-14, -2.35367281e-14, -3.28626015e-14, -2.48689958e-14,
-3.33066907e-14, -3.64153152e-14, -3.46389584e-14, -3.55271368e-14,
-4.08562073e-14, -3.99680289e-14, -4.17443857e-14, -4.08562073e-14,
-4.52970994e-14, -4.17443857e-14, -4.44089210e-14, -3.81916720e-14,
-4.88498131e-14, -4.70734562e-14, -4.88498131e-14, -5.15143483e-14,
-5.24025268e-14, -4.97379915e-14, -5.15143483e-14, -5.24025268e-14,
-5.68434189e-14, -5.59552404e-14, -5.68434189e-14, -5.95079541e-14,
-5.32907052e-14, -6.03961325e-14, -5.95079541e-14, -6.75015599e-14,
-6.57252031e-14, -6.92779167e-14, -6.39488462e-14, -7.46069873e-14,
-6.92779167e-14, -7.81597009e-14, -7.46069873e-14, -7.99360578e-14,
-7.63833441e-14, -8.34887715e-14, -8.88178420e-14, -9.23705556e-14])
abs(voltage[0:-1])-10**(mag/20) np.
array([-1.10671924e-06, -1.12132160e-06, -1.13521907e-06, -1.14837042e-06,
-1.16073483e-06, -1.17227210e-06, -1.18294262e-06, -1.19270739e-06,
-1.20152808e-06, -1.20936703e-06, -1.21618723e-06, -1.22195234e-06,
-1.22662672e-06, -1.23017529e-06, -1.23256359e-06, -1.23375777e-06,
-1.23372443e-06, -1.23243067e-06, -1.22984403e-06, -1.22593242e-06,
-1.22066405e-06, -1.21400742e-06, -1.20593125e-06, -1.19640444e-06,
-1.18539599e-06, -1.17287505e-06, -1.15881078e-06, -1.14317245e-06,
-1.12592933e-06, -1.10705074e-06, -1.08650608e-06, -1.06426481e-06,
-1.04029657e-06, -1.01457116e-06, -9.87058675e-07, -9.57729588e-07,
-9.26554902e-07, -8.93506268e-07, -8.58556142e-07, -8.21678031e-07,
-7.82846667e-07, -7.42038322e-07, -6.99231020e-07, -6.54404907e-07,
-6.07542555e-07, -5.58629422e-07, -5.07654102e-07, -4.54608985e-07,
-3.99490583e-07, -3.42300142e-07, -2.83044123e-07, -2.21734867e-07,
-1.58391140e-07, -9.30388975e-08, -2.57118593e-08, 4.35476721e-08,
1.14688172e-07, 1.87647997e-07, 2.62354710e-07, 3.38724218e-07,
4.16660003e-07, 4.96052209e-07, 5.76776962e-07, 6.58695502e-07,
7.41653336e-07, 8.25479569e-07, 9.09986104e-07, 9.94966973e-07,
1.08019766e-06, 1.16543452e-06, 1.25041422e-06, 1.33485323e-06,
1.41844752e-06, 1.50087211e-06, 1.58178091e-06, 1.66080648e-06,
1.73756001e-06, 1.81163126e-06, 1.88258868e-06, 1.94997959e-06,
2.01333036e-06, 2.07214677e-06, 2.12591435e-06, 2.17409880e-06,
2.21614648e-06, 2.25148491e-06, 2.27952330e-06, 2.29965302e-06,
2.31124827e-06, 2.31366646e-06, 2.30624880e-06, 2.28832069e-06,
2.25919220e-06, 2.21815830e-06, 2.16449927e-06, 2.09748074e-06,
2.01635393e-06, 1.92035553e-06, 1.80870764e-06, 1.68061756e-06,
1.53527750e-06, 1.37186406e-06, 1.18953770e-06, 9.87442109e-07,
7.64703358e-07, 5.20429049e-07, 2.53707263e-07, -3.63945709e-08,
-3.50830838e-07, -6.90579189e-07, -1.05664182e-06, -1.45004715e-06,
-1.87185136e-06, -2.32314011e-06, -2.80503044e-06, -3.31867259e-06,
-3.86525210e-06, -4.44599193e-06, -5.06215468e-06, -5.71504504e-06,
-6.40601236e-06, -7.13645340e-06, -7.90781530e-06, -8.72159888e-06,
-9.57936222e-06, -1.04827247e-05, -1.14333715e-05, -1.24330588e-05,
-1.34836197e-05, -1.45869710e-05, -1.57451218e-05, -1.69601825e-05,
-1.82343771e-05, -1.95700570e-05, -2.09697184e-05, -2.24360236e-05,
-2.39718274e-05, -2.55802111e-05, -2.72645240e-05, -2.90284384e-05,
-3.08760190e-05, -3.28118145e-05, -3.48409781e-05, -3.69694284e-05,
-3.92040674e-05, -4.15530793e-05, -4.40263476e-05, -4.66360462e-05,
-4.93974945e-05, -5.23304180e-05, -5.54608493e-05, -5.88240575e-05,
-6.24691539e-05, -6.64664225e-05, -7.09188148e-05, -7.59780462e-05,
-8.18540343e-05, -8.87210806e-05, -9.57931429e-05, -9.44902692e-05,
-5.31137497e-05, 4.50827102e-06, 3.65898637e-05, 5.41971212e-05,
6.57180738e-05, 7.44164704e-05, 8.16578091e-05, 8.80886358e-05,
9.40491357e-05, 9.97340360e-05, 1.05262621e-04, 1.10712162e-04,
1.16135148e-04, 1.21568752e-04, 1.27040312e-04, 1.32570659e-04,
1.38176214e-04, 1.43870362e-04, 1.49664377e-04, 1.55568074e-04,
1.61590271e-04, 1.67739139e-04, 1.74022472e-04, 1.80447903e-04,
1.87023083e-04, 1.93755853e-04, 2.00654386e-04, 2.07727346e-04,
2.14984039e-04, 2.22434585e-04, 2.30090107e-04, 2.37962945e-04,
2.46066913e-04, 2.54417608e-04, 2.63032771e-04, 2.71932741e-04,
2.81141011e-04, 2.90684903e-04, 3.00596428e-04, 3.10913342e-04,
3.21680478e-04, 3.32951414e-04, 3.44790582e-04, 3.57275915e-04,
3.70502212e-04, 3.84585377e-04, 3.99667801e-04, 4.15925175e-04,
4.33575101e-04, 4.52887991e-04, 4.74200765e-04, 4.97934052e-04,
5.24613580e-04, 5.54896582e-04, 5.89603865e-04, 6.29758078e-04,
6.76628018e-04, 7.31777754e-04, 7.97117381e-04, 8.74948958e-04,
9.67996427e-04, 1.07940145e-03, 1.21265870e-03, 1.37145548e-03,
1.55937464e-03, 1.77942394e-03, 2.03337695e-03, 2.32096092e-03,
2.63900690e-03, 2.98077187e-03, 3.33571053e-03, 3.68995488e-03,
4.02760852e-03, 4.33269791e-03, 4.59134992e-03, 4.79363233e-03,
4.93459136e-03, 5.01430396e-03, 5.03708520e-03, 5.01020093e-03,
4.94247382e-03, 4.84307518e-03, 4.72064936e-03, 4.58279036e-03,
4.43581352e-03, 4.28473612e-03, 4.13338407e-03, 3.98455977e-03,
3.84022718e-03, 3.70168830e-03, 3.56973811e-03, 3.44479360e-03,
3.32699725e-03, 3.21629761e-03, 3.11251086e-03, 3.01536662e-03,
2.92454182e-03, 2.83968496e-03, 2.76043342e-03, 2.68642544e-03,
2.61730809e-03, 2.55274256e-03, 2.49240722e-03, 2.43599936e-03,
2.38323584e-03, 2.33385305e-03, 2.28760638e-03, 2.24426949e-03,
2.20363323e-03, 2.16550468e-03, 2.12970593e-03, 2.09607307e-03,
2.06445507e-03, 2.03471275e-03, 2.00671787e-03, 1.98035217e-03,
1.95550656e-03, 1.93208036e-03, 1.90998057e-03, 1.88912122e-03,
1.86942281e-03, 1.85081173e-03, 1.83321976e-03, 1.81658367e-03,
1.80084475e-03, 1.78594848e-03, 1.77184417e-03, 1.75848464e-03,
1.74582596e-03, 1.73382721e-03, 1.72245017e-03, 1.71165919e-03,
1.70142097e-03, 1.69170434e-03, 1.68248016e-03, 1.67372114e-03,
1.66540169e-03, 1.65749783e-03, 1.64998704e-03, 1.64284818e-03])
10**(mag/20)
array([ 9.9368309 , 9.9344965 , 9.93208447, 9.92959228,
9.9270173 , 9.92435681, 9.92160797, 9.91876785,
9.9158334 , 9.91280145, 9.90966875, 9.90643189,
9.90308739, 9.89963161, 9.89606084, 9.89237121,
9.88855876, 9.88461942, 9.88054898, 9.87634315,
9.87199751, 9.86750756, 9.86286868, 9.85807617,
9.85312525, 9.84801103, 9.84272858, 9.83727288,
9.83163887, 9.82582143, 9.81981543, 9.81361567,
9.80721697, 9.80061414, 9.793802 , 9.78677538,
9.77952917, 9.77205827, 9.76435769, 9.75642247,
9.74824776, 9.73982882, 9.73116098, 9.72223973,
9.71306068, 9.70361956, 9.69391227, 9.68393484,
9.67368346, 9.66315448, 9.65234438, 9.6412498 ,
9.62986752, 9.61819442, 9.60622754, 9.59396395,
9.58140085, 9.56853546, 9.555365 , 9.5418867 ,
9.52809772, 9.51399514, 9.49957588, 9.48483667,
9.46977402, 9.45438411, 9.43866278, 9.42260544,
9.40620702, 9.38946189, 9.3723638 , 9.35490579,
9.33708014, 9.31887831, 9.30029079, 9.28130712,
9.26191576, 9.24210401, 9.22185797, 9.20116243,
9.18000084, 9.15835519, 9.13620596, 9.11353207,
9.09031079, 9.06651766, 9.04212648, 9.01710917,
8.99143578, 8.96507439, 8.93799106, 8.91014976,
8.88151234, 8.85203843, 8.82168543, 8.79040842,
8.75816013, 8.72489083, 8.69054834, 8.65507793,
8.61842226, 8.58052133, 8.54131243, 8.50073004,
8.45870581, 8.41516844, 8.37004367, 8.32325417,
8.27471946, 8.22435589, 8.17207649, 8.11779097,
8.06140556, 8.00282301, 7.94194245, 7.87865932,
7.8128653 , 7.74444823, 7.67329198, 7.59927641,
7.52227726, 7.44216608, 7.35881012, 7.27207224,
7.18181087, 7.08787986, 6.99012847, 6.88840121,
6.78253782, 6.67237318, 6.55773725, 6.43845495,
6.31434621, 6.1852258 , 6.05090339, 5.9111835 ,
5.76586547, 5.61474351, 5.45760681, 5.29423955,
5.12442118, 4.94792663, 4.76452673, 4.57398881,
4.37607755, 4.17055628, 3.9571888 , 3.73574227,
3.50599152, 3.26772591, 3.02076031, 2.76495377,
2.50024204, 2.22669807, 1.94465192, 1.65494965,
1.35957568, 1.06337143, 0.77965851, 0.55110752,
0.49424884, 0.6765313 , 0.98713649, 1.35185728,
1.74718689, 2.16530403, 2.60326938, 3.05996328,
3.53506402, 4.02865089, 4.54103069, 5.07265502,
5.62407851, 6.19593709, 6.78893698, 7.40384962,
8.0415103 , 8.70281921, 9.38874413, 10.10032444,
10.8386762 , 11.60499822, 12.40057898, 13.22680451,
14.08516713, 14.97727526, 15.90486414, 16.86980772,
17.87413175, 18.92002816, 20.00987078, 21.1462327 ,
22.33190522, 23.56991858, 24.8635647 , 26.21642191,
27.63238196, 29.11567929, 30.67092275, 32.30312966,
34.01776235, 35.82076674, 37.71861285, 39.71833641,
41.82758078, 44.05463752, 46.40848352, 48.89881162,
51.53605013, 54.33136527, 57.29663783, 60.4444027 ,
63.78773547, 67.34006562, 71.11488908, 75.12534556,
79.38361718, 83.90009606, 88.68226066, 93.73319743,
99.04971053, 104.61998566, 110.42082634, 116.41457419,
122.54597091, 128.73941985, 134.89733657, 140.90047865,
146.61120247, 151.88036575, 156.55796603, 160.50660464,
163.61574972, 165.81400794, 167.07667085, 167.42683301,
166.93005034, 165.68413107, 163.80659245, 161.42233677,
158.65341023, 155.61174403, 152.39492868, 149.08453393,
145.74626873, 142.43128694, 139.17807522, 136.01452316,
132.95992594, 130.02678437, 127.22234624, 124.54988153,
122.00971055, 119.60001655, 117.31747748, 115.1577502 ,
113.11583703, 111.18635946, 109.36376004, 107.6424488 ,
106.01690753, 104.48176211, 103.03183092, 101.66215549,
100.36801792, 99.14494885, 97.98872851, 96.89538292,
95.8611768 , 94.88260427, 93.95637819, 93.07941877,
92.2488418 , 91.46194705, 90.71620671, 90.00925431,
89.33887416, 88.70299121, 88.09966157, 87.52706355,
86.98348931, 86.46733704, 85.97710368, 85.51137818,
85.06883519, 84.64822921, 84.24838927, 83.86821382,
83.50666613, 83.16277001, 82.83560579, 82.52430663,
82.2280551 , 81.94608001, 81.67765346, 81.42208808,
81.17873453, 80.94697911, 80.72624158, 80.51597311])
0:-1] voltage[
array([ 9.93014466e+00-3.64435752e-01j, 9.92749968e+00-3.72758127e-01j,
9.92476347e+00-3.81247326e-01j, 9.92193298e+00-3.89905032e-01j,
9.91900507e+00-3.98732851e-01j, 9.91597646e+00-4.07732313e-01j,
9.91284377e+00-4.16904864e-01j, 9.90960349e+00-4.26251863e-01j,
9.90625200e+00-4.35774574e-01j, 9.90278554e+00-4.45474161e-01j,
9.89920024e+00-4.55351684e-01j, 9.89549210e+00-4.65408091e-01j,
9.89165699e+00-4.75644210e-01j, 9.88769067e+00-4.86060744e-01j,
9.88358874e+00-4.96658265e-01j, 9.87934670e+00-5.07437203e-01j,
9.87495993e+00-5.18397842e-01j, 9.87042368e+00-5.29540309e-01j,
9.86573309e+00-5.40864568e-01j, 9.86088316e+00-5.52370410e-01j,
9.85586881e+00-5.64057447e-01j, 9.85068483e+00-5.75925100e-01j,
9.84532595e+00-5.87972594e-01j, 9.83978676e+00-6.00198949e-01j,
9.83406179e+00-6.12602969e-01j, 9.82814550e+00-6.25183238e-01j,
9.82203227e+00-6.37938109e-01j, 9.81571643e+00-6.50865701e-01j,
9.80919225e+00-6.63963889e-01j, 9.80245399e+00-6.77230298e-01j,
9.79549586e+00-6.90662304e-01j, 9.78831209e+00-7.04257023e-01j,
9.78089690e+00-7.18011312e-01j, 9.77324451e+00-7.31921769e-01j,
9.76534920e+00-7.45984730e-01j, 9.75720530e+00-7.60196274e-01j,
9.74880718e+00-7.74552224e-01j, 9.74014930e+00-7.89048153e-01j,
9.73122622e+00-8.03679394e-01j, 9.72203259e+00-8.18441046e-01j,
9.71256319e+00-8.33327989e-01j, 9.70281293e+00-8.48334895e-01j,
9.69277688e+00-8.63456249e-01j, 9.68245026e+00-8.78686364e-01j,
9.67182843e+00-8.94019406e-01j, 9.66090697e+00-9.09449414e-01j,
9.64968161e+00-9.24970332e-01j, 9.63814826e+00-9.40576034e-01j,
9.62630304e+00-9.56260359e-01j, 9.61414222e+00-9.72017138e-01j,
9.60166226e+00-9.87840239e-01j, 9.58885981e+00-1.00372360e+00j,
9.57573163e+00-1.01966126e+00j, 9.56227466e+00-1.03564741e+00j,
9.54848593e+00-1.05167644e+00j, 9.53436260e+00-1.06774297e+00j,
9.51990185e+00-1.08384189e+00j, 9.50510094e+00-1.09996841e+00j,
9.48995709e+00-1.11611809e+00j, 9.47446751e+00-1.13228690e+00j,
9.45862928e+00-1.14847125e+00j, 9.44243938e+00-1.16466803e+00j,
9.42589455e+00-1.18087461e+00j, 9.40899130e+00-1.19708895e+00j,
9.39172583e+00-1.21330954e+00j, 9.37409393e+00-1.22953547e+00j,
9.35609097e+00-1.24576648e+00j, 9.33771175e+00-1.26200289e+00j,
9.31895052e+00-1.27824569e+00j, 9.29980082e+00-1.29449651e+00j,
9.28025544e+00-1.31075762e+00j, 9.26030634e+00-1.32703192e+00j,
9.23994457e+00-1.34332294e+00j, 9.21916016e+00-1.35963481e+00j,
9.19794208e+00-1.37597225e+00j, 9.17627815e+00-1.39234050e+00j,
9.15415492e+00-1.40874531e+00j, 9.13155765e+00-1.42519292e+00j,
9.10847019e+00-1.44168992e+00j, 9.08487493e+00-1.45824331e+00j,
9.06075269e+00-1.47486034e+00j, 9.03608272e+00-1.49154847e+00j,
9.01084253e+00-1.50831533e+00j, 8.98500792e+00-1.52516859e+00j,
8.95855285e+00-1.54211589e+00j, 8.93144941e+00-1.55916477e+00j,
8.90366777e+00-1.57632254e+00j, 8.87517607e+00-1.59359622e+00j,
8.84594045e+00-1.61099241e+00j, 8.81592492e+00-1.62851720e+00j,
8.78509134e+00-1.64617602e+00j, 8.75339942e+00-1.66397360e+00j,
8.72080658e+00-1.68191379e+00j, 8.68726801e+00-1.69999947e+00j,
8.65273653e+00-1.71823241e+00j, 8.61716263e+00-1.73661318e+00j,
8.58049441e+00-1.75514096e+00j, 8.54267752e+00-1.77381349e+00j,
8.50365515e+00-1.79262686e+00j, 8.46336797e+00-1.81157544e+00j,
8.42175416e+00-1.83065167e+00j, 8.37874929e+00-1.84984598e+00j,
8.33428637e+00-1.86914661e+00j, 8.28829576e+00-1.88853949e+00j,
8.24070520e+00-1.90800802e+00j, 8.19143975e+00-1.92753300e+00j,
8.14042176e+00-1.94709241e+00j, 8.08757088e+00-1.96666126e+00j,
8.03280403e+00-1.98621141e+00j, 7.97603536e+00-2.00571141e+00j,
7.91717628e+00-2.02512633e+00j, 7.85613541e+00-2.04441752e+00j,
7.79281861e+00-2.06354248e+00j, 7.72712894e+00-2.08245463e+00j,
7.65896671e+00-2.10110311e+00j, 7.58822943e+00-2.11943258e+00j,
7.51481189e+00-2.13738302e+00j, 7.43860612e+00-2.15488945e+00j,
7.35950145e+00-2.17188178e+00j, 7.27738455e+00-2.18828454e+00j,
7.19213943e+00-2.20401663e+00j, 7.10364753e+00-2.21899112e+00j,
7.01178776e+00-2.23311494e+00j, 6.91643657e+00-2.24628872e+00j,
6.81746802e+00-2.25840642e+00j, 6.71475387e+00-2.26935517e+00j,
6.60816367e+00-2.27901493e+00j, 6.49756489e+00-2.28725828e+00j,
6.38282298e+00-2.29395011e+00j, 6.26380158e+00-2.29894736e+00j,
6.14036258e+00-2.30209874e+00j, 6.01236631e+00-2.30324448e+00j,
5.87967169e+00-2.30221601e+00j, 5.74213640e+00-2.29883571e+00j,
5.59961707e+00-2.29291665e+00j, 5.45196945e+00-2.28426229e+00j,
5.29904863e+00-2.27266621e+00j, 5.14070924e+00-2.25791186e+00j,
4.97680567e+00-2.23977227e+00j, 4.80719227e+00-2.21800981e+00j,
4.63172363e+00-2.19237593e+00j, 4.45025475e+00-2.16261089e+00j,
4.26264133e+00-2.12844351e+00j, 4.06873997e+00-2.08959097e+00j,
3.86840843e+00-2.04575850e+00j, 3.66150584e+00-1.99663919e+00j,
3.44789295e+00-1.94191374e+00j, 3.22743233e+00-1.88125023e+00j,
2.99998860e+00-1.81430388e+00j, 2.76542862e+00-1.74071685e+00j,
2.52362166e+00-1.66011793e+00j, 2.27443956e+00-1.57212237e+00j,
2.01775690e+00-1.47633159e+00j, 1.75345107e+00-1.37233291e+00j,
1.48140236e+00-1.25969930e+00j, 1.20149403e+00-1.13798900e+00j,
9.13612295e-01-1.00674526e+00j, 6.17646301e-01-8.65495911e-01j,
3.13488046e-01-7.13752947e-01j, 1.03224968e-03-5.51012061e-01j,
-3.19823823e-01-3.76752086e-01j, -6.49180602e-01-1.90434374e-01j,
-9.87136500e-01+8.49792674e-03j, -1.33378827e+00+2.20620697e-01j,
-1.68923143e+00+4.46529800e-01j, -2.05356072e+00+6.86842186e-01j,
-2.42687065e+00+9.42197153e-01j, -2.80925611e+00+1.21325781e+00j,
-3.20081300e+00+1.50071274e+00j, -3.60163896e+00+1.80527793e+00j,
-4.01183409e+00+2.12769898e+00j, -4.43150177e+00+2.46875357e+00j,
-4.86074943e+00+2.82925439e+00j, -5.29968935e+00+3.21005230e+00j,
-5.74843949e+00+3.61204010e+00j, -6.20712426e+00+4.03615667e+00j,
-6.67587515e+00+4.48339171e+00j, -7.15483141e+00+4.95479101e+00j,
-7.64414043e+00+5.45146254e+00j, -8.14395808e+00+5.97458310e+00j,
-8.65444870e+00+6.52540591e+00j, -9.17578484e+00+7.10526914e+00j,
-9.70814658e+00+7.71560530e+00j, -1.02517204e+01+8.35795195e+00j,
-1.08066972e+01+9.03396352e+00j, -1.13732704e+01+9.74542454e+00j,
-1.19516317e+01+1.04942645e+01j, -1.25419673e+01+1.12825741e+01j,
-1.31444518e+01+1.21126239e+01j, -1.37592409e+01+1.29868847e+01j,
-1.43864617e+01+1.39080501e+01j, -1.50262016e+01+1.48790620e+01j,
-1.56784932e+01+1.59031390e+01j, -1.63432967e+01+1.69838072e+01j,
-1.70204774e+01+1.81249353e+01j, -1.77097788e+01+1.93307727e+01j,
-1.84107887e+01+2.06059925e+01j, -1.91228991e+01+2.19557381e+01j,
-1.98452554e+01+2.33856747e+01j, -2.05766957e+01+2.49020454e+01j,
-2.13156765e+01+2.65117328e+01j, -2.20601812e+01+2.82223243e+01j,
-2.28076092e+01+3.00421824e+01j, -2.35546409e+01+3.19805178e+01j,
-2.42970717e+01+3.40474641e+01j, -2.50296119e+01+3.62541515e+01j,
-2.57456410e+01+3.86127752e+01j, -2.64369112e+01+4.11366525e+01j,
-2.70931871e+01+4.38402596e+01j, -2.77018112e+01+4.67392353e+01j,
-2.82471816e+01+4.98503338e+01j, -2.87101297e+01+5.31913006e+01j,
-2.90671842e+01+5.67806387e+01j, -2.92897134e+01+6.06372151e+01j,
-2.93429433e+01+6.47796495e+01j, -2.91848625e+01+6.92253997e+01j,
-2.87650504e+01+7.39894451e+01j, -2.80234982e+01+7.90824409e+01j,
-2.68895534e+01+8.45082046e+01j, -2.52811980e+01+9.02603864e+01j,
-2.31049835e+01+9.63182052e+01j, -2.02570849e+01+1.02641209e+02j,
-1.66260886e+01+1.09163180e+02j, -1.20982512e+01+1.15785598e+02j,
-6.56599046e+00+1.22371504e+02j, 5.98375510e-02+1.28741185e+02j,
7.83390002e+00+1.34671712e+02j, 1.67576876e+01+1.39902748e+02j,
2.67607906e+01+1.44150888e+02j, 3.76864428e+01+1.47133555e+02j,
4.92866464e+01+1.48601035e+02j, 6.12316183e+01+1.48371977e+02j,
7.31354694e+01+1.46364732e+02j, 8.45953480e+01+1.42616090e+02j,
9.52364709e+01+1.37281327e+02j, 1.04752893e+02+1.30614627e+02j,
1.12935023e+02+1.22934819e+02j, 1.19679300e+02+1.14585156e+02j,
1.24980932e+02+1.05896254e+02j, 1.28914709e+02+9.71585621e+01j,
1.31610428e+02+8.86068182e+01j, 1.33228639e+02+8.04154962e+01j,
1.33940378e+02+7.27023271e+01j, 1.33912391e+02+6.55365258e+01j,
1.33297784e+02+5.89488641e+01j, 1.32231147e+02+5.29416272e+01j,
1.30826941e+02+4.74973540e+01j, 1.29180005e+02+4.25859215e+01j,
1.27367257e+02+3.81699485e+01j, 1.25449956e+02+3.42087092e+01j,
1.23476099e+02+3.06608327e+01j, 1.21482703e+02+2.74860673e+01j,
1.19497860e+02+2.46463564e+01j, 1.17542499e+02+2.21064279e+01j,
1.15631878e+02+1.98340498e+01j, 1.13776797e+02+1.78000677e+01j,
1.11984588e+02+1.59783050e+01j, 1.10259911e+02+1.43453840e+01j,
1.08605379e+02+1.28805050e+01j, 1.07022059e+02+1.15652100e+01j,
1.05509857e+02+1.03831468e+01j, 1.04067827e+02+9.31984288e+00j,
1.02694403e+02+8.36249510e+00j, 1.01387586e+02+7.49977708e+00j,
1.00145078e+02+6.72166566e+00j, 9.89643970e+01+6.01928575e+00j,
9.78429531e+01+5.38477261e+00j, 9.67781121e+01+4.81115026e+00j,
9.57672414e+01+4.29222443e+00j, 9.48077429e+01+3.82248866e+00j,
9.38970783e+01+3.39704196e+00j, 9.30327855e+01+3.01151673e+00j,
9.22124904e+01+2.66201572e+00j, 9.14339142e+01+2.34505680e+00j,
9.06948777e+01+2.05752474e+00j, 8.99933025e+01+1.79662889e+00j,
8.93272112e+01+1.55986611e+00j, 8.86947260e+01+1.34498836e+00j,
8.80940660e+01+1.14997409e+00j, 8.75235444e+01+9.73003272e-01j,
8.69815646e+01+8.12435303e-01j, 8.64666169e+01+6.66789610e-01j,
8.59772741e+01+5.34728519e-01j, 8.55121875e+01+4.15042144e-01j,
8.50700834e+01+3.06635007e-01j, 8.46497584e+01+2.08514209e-01j,
8.42500760e+01+1.19778925e-01j, 8.38699629e+01+3.96110911e-02j,
8.35084055e+01-3.27328823e-02j, 8.31644462e+01-9.79294848e-02j,
8.28371802e+01-1.56594681e-01j, 8.25257529e+01-2.09289776e-01j,
8.22293564e+01-2.56526663e-01j, 8.19472271e+01-2.98772513e-01j,
8.16786430e+01-3.36453982e-01j, 8.14229213e+01-3.69960980e-01j,
8.11794162e+01-3.99650064e-01j, 8.09475165e+01-4.25847480e-01j,
8.07266437e+01-4.48851911e-01j, 8.05162504e+01-4.68936944e-01j])
abs(voltage[0:-1]) np.
array([ 9.93682979, 9.93449538, 9.93208334, 9.92959113,
9.92701614, 9.92435564, 9.92160679, 9.91876666,
9.9158322 , 9.91280024, 9.90966753, 9.90643067,
9.90308616, 9.89963038, 9.89605961, 9.89236998,
9.88855753, 9.88461818, 9.88054775, 9.87634192,
9.87199629, 9.86750634, 9.86286747, 9.85807498,
9.85312406, 9.84800986, 9.84272742, 9.83727173,
9.83163774, 9.82582033, 9.81981434, 9.8136146 ,
9.80721593, 9.80061313, 9.79380101, 9.78677443,
9.77952824, 9.77205738, 9.76435683, 9.75642165,
9.74824698, 9.73982807, 9.73116028, 9.72223908,
9.71306007, 9.703619 , 9.69391176, 9.68393438,
9.67368306, 9.66315414, 9.6523441 , 9.64124958,
9.62986736, 9.61819433, 9.60622751, 9.593964 ,
9.58140097, 9.56853564, 9.55536526, 9.54188704,
9.52809814, 9.51399564, 9.49957646, 9.48483733,
9.46977476, 9.45438494, 9.43866369, 9.42260644,
9.4062081 , 9.38946306, 9.37236505, 9.35490712,
9.33708156, 9.31887981, 9.30029237, 9.28130878,
9.26191749, 9.24210582, 9.22185985, 9.20116438,
9.18000285, 9.15835726, 9.13620809, 9.11353425,
9.090313 , 9.06651991, 9.04212876, 9.01711147,
8.99143809, 8.96507671, 8.93799337, 8.91015205,
8.88151459, 8.85204065, 8.82168759, 8.79041052,
8.75816214, 8.72489275, 8.69055015, 8.65507961,
8.61842379, 8.5805227 , 8.54131362, 8.50073103,
8.45870657, 8.41516896, 8.37004393, 8.32325413,
8.27471911, 8.2243552 , 8.17207544, 8.11778952,
8.06140369, 8.00282069, 7.94193964, 7.878656 ,
7.81286144, 7.74444378, 7.67328692, 7.59927069,
7.52227086, 7.44215895, 7.35880221, 7.27206352,
7.18180129, 7.08786938, 6.99011703, 6.88838877,
6.78252434, 6.6723586 , 6.5577215 , 6.43843799,
6.31432797, 6.18520623, 6.05088243, 5.91116106,
5.76584149, 5.61471793, 5.45757954, 5.29421052,
5.1243903 , 4.94789381, 4.76449188, 4.57395184,
4.37603835, 4.17051472, 3.95714477, 3.73569563,
3.50594213, 3.26767358, 3.02070485, 2.76489495,
2.50017957, 2.2266316 , 1.944581 , 1.65487367,
1.35949382, 1.06328271, 0.77956271, 0.55101303,
0.49419572, 0.67653581, 0.98717308, 1.35191148,
1.74725261, 2.16537845, 2.60335104, 3.06005137,
3.53515807, 4.02875062, 4.54113595, 5.07276573,
5.62419464, 6.19605866, 6.78906402, 7.40398219,
8.04164848, 8.70296308, 9.3888938 , 10.10048001,
10.83883779, 11.60516596, 12.40075301, 13.22698496,
14.08535416, 14.97746902, 15.90506479, 16.87001544,
17.87434674, 18.92025059, 20.01010087, 21.14647066,
22.33215128, 23.570173 , 24.86382773, 26.21669384,
27.6326631 , 29.11596998, 30.67122334, 32.30344057,
34.01808403, 35.82109969, 37.71895764, 39.71869369,
41.82795129, 44.0550221 , 46.40888319, 48.89922754,
51.53648371, 54.33181816, 57.29711203, 60.44490063,
63.78826008, 67.34062052, 71.11547868, 75.12597531,
79.38429381, 83.90082784, 88.68305777, 93.73407238,
99.05067853, 104.62106507, 110.422039 , 116.41594564,
122.54753028, 128.74119927, 134.89936995, 140.90279961,
146.61384148, 151.88334652, 156.56130174, 160.5102946 ,
163.61977733, 165.81834064, 167.0812622 , 167.43162664,
166.93498493, 165.68914538, 163.81162953, 161.42734698,
158.65835271, 155.6165871 , 152.39964933, 149.08911672,
145.75070454, 142.43557168, 139.18220861, 136.01850772,
132.96376616, 130.03048605, 127.22591598, 124.55332632,
122.01303754, 119.60323285, 117.32058999, 115.16076557,
113.11876157, 111.18919914, 109.36652047, 107.64513523,
106.01952484, 104.48431485, 103.03432333, 101.66459149,
100.37040115, 99.1472827 , 97.99101611, 96.89762719,
95.86338043, 94.88476978, 93.9585079 , 93.08151484,
92.25090626, 91.46398177, 90.71821342, 90.01123466,
89.34082967, 88.70492329, 88.10157155, 87.52895267,
86.98535873, 86.46918785, 85.9789369 , 85.51319477,
85.07063603, 84.65001516, 84.25016111, 83.8699723 ,
83.50841196, 83.16450384, 82.83732824, 82.52601829,
82.22975652, 81.94777172, 81.67933594, 81.4237618 ,
81.18039993, 80.94863661, 80.72789157, 80.51761595])