Код: Выделить всё
import lcapy
from lcapy import s, expr
from IPython.display import display, Math
from sympy import symbols, collect, sqrt
import sympy as sp
# Define the circuit netlist with components
netlist = """
Iin 1 0
Cp 1 0 C
Rp 1 0 R
Lp 1 0 L
"""
# Create a Circuit object from the netlist
circuit = lcapy.Circuit(netlist)
s_model = circuit.s_model()
# Calculate the transfer function H = I_out / I_in
# H(s) = transfer from node 1 (current source) to ground (node 0)
# Calculate the output current I_out
I_out = s_model.current(1, 0) # Current through resistor Rp at node 1
# Calculate the input current I_in from the current source
I_in = s_model.Iin(1) # Current from the current source at node 1
# H(s) = I_out / I_in
H_final = I_out / I_in
# Display the transfer function H
display(Math(sp.latex(H_final)))
[img]https://i.sstatic.net /jBQvchFd.png[/img]
Подробнее здесь: https://stackoverflow.com/questions/791 ... l-rlc-tank
Мобильная версия