如何使用 Python 中的 UliEngineering 计算同相 OpAmp 放大器增益

在此示例中,我们将使用 UliEngineering 库计算同相 OpAmp 放大器的增益,给定两个反馈电阻值 R1R2

首先,安装 UliEngineering

现在我们可以使用 UliEngineering.Electronics.OpAmp 包中的 noninverting_amplifier_gain() 来转换温度单位: ***提示:***你可以向大多数 UliEngineering 函数传递数字(如 100e3)或字符串(如 100 kΩ)。SI 前缀如 km 会自动解码。

示例:

noninverting_gain_example.py
from UliEngineering.Electronics.OpAmp import noninverting_amplifier_gain

# Gain of a non-inverting amplifier with 100k & 10k feedback resistor
gain = noninverting_amplifier_gain(100e3, 10e3)
# gain = 11.0

# ... or you can use strings
gain = noninverting_amplifier_gain("100k", "10k")

# ... or strings with units
gain = noninverting_amplifier_gain("100kΩ", "10kΩ")

# You can also automatically format the result
from UliEngineering.EngineerIO import auto_format
print(auto_format(noninverting_amplifier_gain, "100k", "10k"))
# prints 11.0 V/V

Check out similar posts by category: Electronics, Python