How to compute resistor voltage divider ratio using Python

Use UliEngineering to compute the ratio of the voltage divider:

voltage_divider_ratio_example.py
from UliEngineering.Electronics.VoltageDivider import *

# This prints 0.9578544061302683
print(voltage_divider_ratio("2.2k", "50k"))
# In other words, the output voltage of a 2.2kOhm / 50kOhm voltage divider
# equals 0.9578544061302683 times the input voltage.

You can install UliEngineering using pip such as:

pip_install_uliengineering.sh
pip install -U UliEngineering

 


Check out similar posts by category: Electronics, Python