如何使用 UliEngineering 在 Python 中计算流过电阻的电流

你可以使用 UliEngineering Python 库,通过欧姆定律轻松计算流过电阻的电流:

current_through_resistor.py
from UliEngineering.Electronics.Resistors import *
from UliEngineering.EngineerIO import *

# 计算 5V 电压下 1kΩ 电阻的电流
current = current_through_resistor("5V", "1k")
print(f"Current through 1kΩ at 5V: {format_value(current, 'A')}")

# 计算 3.3V 电压下 100Ω 电阻的电流
current = current_through_resistor("3.3V", "100Ω")
print(f"Current through 100Ω at 3.3V: {format_value(current, 'A')}")

示例输出

current_through_resistor_output.txt
Current through 1kΩ at 5V: 5.00 mA
Current through 100Ω at 3.3V: 33.0 mA

电流通过欧姆定律计算:$I = \frac{V}{R}$

相关文章


Check out similar posts by category: Electronics, Python