C1 · Lesson 19 · Sources and equivalents lab
Fitting a Thevenin model to measurements, sweeping for maximum power, checking superposition, and a dependent-source amplifier stage, in Python
Lessons 14 to 17 replaced real sources and whole networks with two numbers, a Thevenin voltage and resistance, and used them to find load voltages, superposed contributions and the load that takes the most power. On the bench those two numbers come from measurements, which are noisy and more than two. In this lab you'll fit a Thevenin model to data by least squares, find the best load by sweeping, check superposition numerically, and analyze an emitter follower's dependent-source model, which leads into lesson 21.
- A source's terminal voltage falls along the straight line ; a resistive load forces . Where the lines cross is the operating point.
- The sliders set the source and the load. Make the load equal to and the operating point sits at half the open-circuit voltage and half the short-circuit current, where the power, the rectangle under the point, is largest.
- The readouts give the operating point and the load power.
Predict
A bench supply's voltage is measured at four load currents: 12.10 V at 0 A, 12.00 V at 1 A, 11.90 V at 2 A and 11.60 V at 5 A. What's its internal resistance?
0.1 Ω. The voltage falls 0.1 V for every amp, so = 0.1 Ω and = 12.10 V. A least-squares line through all four points finds the same values and averages out measurement noise, without ever shorting the supply.
Name it
Fitting a Thevenin model
A linear source obeys . Given several measured (I, V) pairs, a least-squares straight-line fit returns the intercept and the slope . With noisy data, more points narrow the uncertainty; with a nonlinear source, the fit's residuals show where the linear model fails.
Sweeping for maximum power
The power into a load is . Sweeping over a logarithmic grid and keeping the largest P finds the maximum at , as lesson 17 proved. The peak is broad: within a factor of two either side, the power stays above 89% of the maximum.
Superposition, numerically
For a node fed by several sources through resistors , with to ground, . Setting all but one source to zero and summing the results must give the same v, to rounding: a quick test of any linear-circuit code.
A dependent-source stage
An emitter follower, modeled with a dependent current source β, a source resistance and a load , has
and seen from the load, the source resistance shrinks to . Solving the model's equations numerically, with a test source where needed, reproduces all three.
Worked example
Fit a Thevenin model to the bench supply's readings: (0 A, 12.10 V), (1 A, 12.00 V), (2 A, 11.90 V), (5 A, 11.60 V).
Show the solution
- Fit the line. The points lie exactly on a line, with slope −0.10 V/A and intercept 12.10 V.
- Read off the model. So = 12.10 V and = 0.10 Ω.
- Short-circuit current. though the supply would current-limit long before.
- Noisy readings. With noisy readings, a least-squares fit uses all of them; the uncertainty in shrinks as the spread of currents grows, which is why such tests use the widest current range the source safely allows.
Answer the supply is 12.10 V behind 0.10 Ω.
Worked example
A 5 V source has 50 Ω inside. Sweep the load: what's the power at 25, 50 and 100 Ω?
Show the solution
- Load power. With 5 V behind 50 Ω,
- At 25 Ω.
- At 50 Ω. the maximum.
- At 100 Ω.
- A flat peak. Halving or doubling the load costs only 11%. That flat peak is why "matched" loads in practice are often off by tens of percent with little loss.
- The cost of a match. A matched load wastes half the source's power: at 50 Ω the source itself dissipates 125 mW too.
Answer the load gets 111 mW at 25 Ω, 125 mW at 50 Ω (the maximum) and 111 mW at 100 Ω.
Worked example
An emitter follower has β = 100, source resistance 1 kΩ and load 1 kΩ. Find its input resistance, voltage gain and output resistance.
Show the solution
- Input resistance.
- Voltage gain.
- Output resistance. Looking back from the load, the 1 kΩ source resistance appears divided by β + 1: or 9.8 Ω with the 1 kΩ load in parallel.
- What the stage is for. It turns a 1 kΩ source into a 10 Ω one at nearly unity gain, which is its whole purpose: a buffer.
Answer the input resistance is 102 kΩ, the voltage gain 0.990, and the output resistance 9.9 Ω (9.8 Ω with the load in parallel).
Check
Step 1. Write thevenin_fit(I, V) returning (Vth, Rth) from a least-squares straight-line fit of measured voltages V against currents I.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 2. Write best_load(Vth, Rth) returning the load, among 2001 values spaced logarithmically from Rth/100 to 100 Rth, that takes the most power.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 3. Write node_voltage(sources, Rg) for a node fed by a list of (V, R) sources with Rg to ground, and superposed(sources, Rg) returning the sum of each source's contribution with the others set to zero.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 4. Write follower(beta, Rs, RL) returning (Rin, gain, Rout) for the emitter-follower model: solve for the base current with a 1 V input, then find the output resistance by driving the output with a test current, input source shorted.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 5. Write pulse_resistance(t, v, i_low, i_high, t_on, t_off) estimating a battery's internal resistance from a voltage record during a current pulse: average v before t_on, average v between t_on and t_off, and divide the drop by the current step.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
A source reads 12 V at 0.5 A and 0.5 V less at 8 A.
(a)
What's its Thevenin resistance?
Write units the way you normally would: 1.5 Ω, 1500 mΩ and 0.0015 kΩ are the same answer.
(b)
What's its Thevenin voltage?
Check
A source of 5 V behind 8 Ω drives a matched load. How much power does the load get?
Write units the way you normally would: 1.5 mW, 1500 µW and 0.0015 W are the same answer.
Check
Sources of 5, 2 and 4 V each feed a node through 10 kΩ, and 1 × 10 kΩ connects it to ground. What's the node voltage?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
An emitter follower has β = 100, source resistance 5 kΩ and load 2 kΩ.
(a)
What's its input resistance?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
(b)
What's its voltage gain?
Explain why
Why does fitting a line to several load measurements give a better Thevenin model than using just two of them?
Each voltage reading carries some noise, from the meter and from small changes in the source. With only two points, any error in either one goes straight into the slope, which is , and the error is magnified when the two currents are close together. A least-squares line through many points, spread over a wide range of currents, averages the noise down: random errors partly cancel, and the slope is pinned by the points far apart. The fit also exposes trouble a two-point calculation hides: if the points curve away from a straight line, the source isn't linear over that range, and a single Thevenin model doesn't describe it.
Practice
Keep practicing
6 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.