如何在 PySpice 中创建电阻:最小示例
这会创建一个名为 R1 的电阻,其 + 引脚连接到节点 n1,- 引脚连接到 GND。电阻值设置为 1kΩ。
pyspice_resistor_example.py
r1 = circuit.R('R1', 'n1', circuit.gnd, 1@u_kΩ)完整示例:
pyspice_resistor_full_example.py
import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()
from PySpice.Probe.Plot import plot
from PySpice.Spice.Netlist import Circuit
from PySpice.Unit import *
circuit = Circuit("MyCircuit")
r1 = circuit.R('R1', 'n1', circuit.gnd, 1@u_kΩ)Check out similar posts by category:
Electronics, Python, SPICE
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow