How to compute hysteresis threshold ratios in Python using UliEngineering
You can easily compute the hysteresis threshold ratios using the UliEngineering Python library:
hysteresis_threshold_ratios.py
from UliEngineering.Electronics.Hysteresis import hysteresis_threshold_ratios
# Compute threshold ratios for 10% hysteresis
low_ratio, high_ratio = hysteresis_threshold_ratios(0.10)
print(f"Low threshold ratio (10% hysteresis): {low_ratio:.4f}")
print(f"High threshold ratio (10% hysteresis): {high_ratio:.4f}")
# Compute threshold ratios for 20% hysteresis
low_ratio, high_ratio = hysteresis_threshold_ratios(0.20)
print(f"Low threshold ratio (20% hysteresis): {low_ratio:.4f}")
print(f"High threshold ratio (20% hysteresis): {high_ratio:.4f}")Example output
hysteresis_threshold_ratios_output.txt
Low threshold ratio (10% hysteresis): 0.4500
High threshold ratio (10% hysteresis): 0.5500
Low threshold ratio (20% hysteresis): 0.4000
High threshold ratio (20% hysteresis): 0.6000The hysteresis threshold ratios represent the lower and upper switching points as fractions of the input signal range. Hysteresis is used to prevent unwanted switching due to noise or signal fluctuations. The ratios determine where the output will switch states based on the input signal level.
The threshold ratios are computed using the formulas: $R_{low} = \frac{1 - h}{2}$ and $R_{high} = \frac{1 + h}{2}$, where $h$ is the hysteresis percentage (e.g., 0.10 for 10%). The lower threshold is set below the midpoint, while the upper threshold is set above the midpoint, creating a dead band where no switching occurs.
Related posts
- How to compute hysteresis threshold voltages in Python using UliEngineering
- How to compute hysteresis resistor in Python using UliEngineering
- How to compute RC time constant in Python using UliEngineering
Check out similar posts by category:
Electronics, Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow