electricpy.voltdiv¶
- electricpy.voltdiv(Vin, R1, R2, Rload=None)[source]¶
Electrical Voltage Divider Function.
This function is designed to calculate the output voltage of a voltage divider given the input voltage, the resistances (or impedances) and the load resistance (or impedance) if present.
\[V_{out} = V_{in} * \frac{R_2}{R_1+R_2}\]\[V_{out}=V_{in}*\frac{R_2||R_{load}}{R_1+(R_2||R_{load})}\]- Parameters:
Vin (float) – The Input Voltage, may be real or complex
R1 (float) – The top resistor of the divider (real or complex)
R2 (float) – The bottom resistor of the divider, the one which the output voltage is measured across, may be either real or complex
Rload (float, optional) – The Load Resistor (or impedance), default=None
- Returns:
Vout – The Output voltage as measured across R2 and/or Rload
- Return type:
float
Examples
>>> import electricpy as ep >>> ep.voltdiv(Vin=12, R1=4, R2=8) 8.0 >>> ep.voltdiv(Vin=12, R1=6, R2=12, Rload=12) # R2 and Rload are parallel 6.0