Node-Voltage Analysis
Reducing a circuit by series and parallel steps works until the circuit stops being a ladder. A sensor front end with two sources and a resistor bridging two branches has no series or parallel pair left to combine, yet you still need every voltage in it. Node-voltage analysis (nodal analysis) handles any such circuit with one routine: name the node voltages, write Kirchhoff's current law at each node, solve the linear system. It is the method SPICE is built on (Modified Nodal Analysis), and the one you will use most.
The idea
Pick one node as the reference (ground, node 0) and give every other node a voltage measured from it. Once the node voltages are known, every branch voltage is a difference of two of them and every resistor current follows from Ohm's law. So the node voltages are a complete set of unknowns, and there are only of them for nodes, usually far fewer than the branch currents.
KCL at each non-reference node gives one equation. With resistors written as conductances , the current leaving node through a resistor to node is , and through a resistor to ground .
The method, step by step
- Choose the reference node: usually the one with the most connections, or the negative terminal of the main source.
- Label the other nodes. A node tied to the reference by a voltage source alone has a known voltage (here ), so it is not an unknown.
- At each unknown node, write KCL as "sum of currents leaving through resistors = sum of source currents entering".
- Collect terms into matrix form and solve.
- Back-substitute for branch currents and check KCL at one node you did not use.
For a circuit of resistors and independent current sources the matrix has a pattern you can write by inspection:
is symmetric and, when every node has a resistive path to ground, positive definite, so the system always has one solution. A known node voltage (like ) moves to the right-hand side as a current into its neighbour.
Worked example
Given: the circuit above: at node a, (a to b), (b to ground), (b to c), (c to ground), into node c.
Find: , and the four resistor currents.
Solve: work in , mA and V (then and ). KCL at b and c:
In matrix form, with conductances in mS:
By Cramer's rule, and . Then
Check: KCL at c, not used in this form: . Power: the source delivers and delivers ; the resistors take . Balanced.
In Python: build G by inspection, then solve
The stamping rule above is easy to automate: every resistor adds its conductance to two diagonal entries and subtracts it from two off-diagonal ones. A matrix refresher is in Linear Systems and, in depth, Gaussian elimination.
import numpy as np
nodes = ["b", "c"]
idx = {n: k for k, n in enumerate(nodes)}
known = {"a": 12.0, "0": 0.0} # node voltages fixed by sources
resistors = [("R1", "a", "b", 1e3), ("R2", "b", "0", 4e3),
("R3", "b", "c", 1e3), ("R4", "c", "0", 2e3)]
current_sources = [("I1", "0", "c", 1e-3)] # current flows from first node to second, through the source
G = np.zeros((2, 2)); i = np.zeros(2)
for name, p, q, R in resistors:
g = 1 / R
for a, b in ((p, q), (q, p)):
if a in idx:
G[idx[a], idx[a]] += g
if b in idx: G[idx[a], idx[b]] -= g
else: i[idx[a]] += g * known[b] # known neighbour -> source term
for name, p, q, I in current_sources:
if q in idx: i[idx[q]] += I
if p in idx: i[idx[p]] -= I
np.set_printoptions(precision=4, suppress=True)
print("G (mS):\n", G * 1e3)
print("i (mA):", i * 1e3)
v = np.linalg.solve(G, i)
V = {**known, **{n: float(x) for n, x in zip(nodes, v)}}
print("v_b = %.4f V, v_c = %.4f V" % (V["b"], V["c"]))
for name, p, q, R in resistors:
print(f"{name}: {(V[p] - V[q]) / R * 1e3:7.3f} mA from {p} to {q}")G (mS):
[[ 2.25 -1. ]
[-1. 1.5 ]]
i (mA): [12. 1.]
v_b = 8.0000 V, v_c = 6.0000 V
R1: 4.000 mA from a to b
R2: 2.000 mA from b to 0
R3: 2.000 mA from b to c
R4: 3.000 mA from c to 0
Cross-check with SPICE
The same circuit as an ngspice deck. SPICE's current source I1 0 c 1m pushes 1 mA from node 0 through the source into node c, the same direction as in the figure.
cat > nodal.cir <<'EOF'
* Nodal example: 12 V source, four resistors, 1 mA current source
V1 a 0 DC 12
R1 a b 1k
R2 b 0 4k
R3 b c 1k
R4 c 0 2k
I1 0 c DC 1m
.control
op
print v(b) v(c) i(V1)
.endc
.end
EOF
ngspice -b nodal.cir 2>&1 | grep -E '^(v\(|i\()'v(b) = 8.000000e+00
v(c) = 6.000000e+00
i(v1) = -4.00000e-03
The source current is because SPICE measures it flowing into the + terminal: a source that delivers power reads negative.
Interactive: change a resistor and watch the nodes
The netlist lab solves the same circuit live. Move or and watch and move together: a change anywhere shifts every node, which is why the equations are coupled.
At the defaults the lab reads and . With the right branch is a plain divider fed from b.
Guided lab: verify the node voltages on the bench
Hand calculation. Use the values above, but replace the 1 mA current source with something every bench has: a second supply in series with a resistor. A source transformation (Source Transformation) shows that in parallel with equals in series with . So remove and connect from c to the + terminal of a second supply (its negative terminal on ground): and stay and . Only the current in changes, to , because is now part of the equivalent source.
Simulation. Run the deck with I1 and R4 replaced by R4 c x 2k and V2 x 0 DC 2; it prints the same two voltages.
What you would measure. Build it with 1 % resistors on a breadboard, set the supplies to and with the current limits at , and measure from the common ground to b and to c with a DMM. Expect and : about 1 % from the resistors plus the meter's 0.1 % or so (Accuracy, Precision and Measurement Uncertainty). Measure the supply voltages at the board, not at the supply's display.
Hazards and safe setup. Low voltage only (12 V and 2 V, current limited). The largest resistor dissipation is , in and in ( now takes ), far below a 0.25 W rating. Connect both supplies' negative terminals to the same ground rail. Note that the in flows into the supply's + terminal, and many bench supplies cannot sink current: put a resistor across that supply's terminals (it draws , so the supply delivers a net ) and the node voltages stay the same.
Pitfalls
- Mixed sign conventions within one equation. Pick "leaving = positive" (or "entering = positive") for a node and use it for every term.
- Forgetting the known node. A voltage source to ground fixes a node; writing KCL there adds an unknown source current you then have to eliminate.
- Wrong sign of a source current. A source pushing current into node goes on the right-hand side with a plus sign.
- Units. Mixing and in one equation is the most common arithmetic error. Work in , mA, V throughout, or in base units throughout.
- A floating node. A node connected only through capacitors or current sources has no DC solution; the matrix is singular.
Practice
- In the worked example, change to and solve for and .
- Write the conductance matrix by inspection for a ladder: into node 1, from 1 to ground, from 1 to 2, from 2 to ground. Solve it.
- Why is the conductance matrix symmetric in a circuit of resistors and independent sources, and what kind of element breaks the symmetry?
Answer
- mS, mA, : , .
- mS, mA, : , .
- A resistor between and adds to both and . A dependent source (for example a current controlled by a voltage elsewhere) adds an entry in one place only, so the matrix stops being symmetric (Supernodes and Dependent Sources).
Test yourself
A circuit has 5 nodes, one of which is the reference, and one voltage source connects a node directly to the reference. How many unknown node voltages are there?
- 5
- 4
- 3
- 2
In the conductance matrix, the diagonal entry is…
- the sum of the conductances connected to node
- minus the conductance between and ground
- the current into node
- always zero
SPICE reports i(v1) = -4.00000e-03 for a 12 V source. What does the minus sign mean?
- the source absorbs 48 mW
- 4 mA flows out of the + terminal into the circuit, so the source delivers power
- the source is reversed in the deck
- the solution did not converge
With and , what current flows through a resistor from b to c?