Mesh-Current Analysis
A battery charger, a car's lighting harness and a resistive heater with two supplies all share one feature: several voltage sources and few nodes, wired as loops side by side. Nodal analysis still works, but every voltage source needs a known node or a supernode. Mesh-current analysis is the mirror-image method: unknown loop currents instead of node voltages, and Kirchhoff's voltage law instead of the current law. For planar circuits driven mostly by voltage sources it often gives fewer equations.
The idea
A planar circuit can be drawn on paper without crossing wires. Its meshes are the windows of that drawing: loops that contain no other loop. Assign each mesh a mesh current circulating around it, conventionally clockwise. Every branch current is then a mesh current or a difference of two:
- a branch on the outside of the drawing belongs to one mesh and carries that mesh current;
- a branch shared by meshes and carries (in the direction of ).
KCL is satisfied automatically, because each mesh current enters and leaves every node it passes. So only KVL remains, one equation per mesh. A circuit with branches and nodes has meshes.
The method
- Check the circuit is planar; mark each window with a clockwise mesh current.
- Around each mesh, in the direction of its current, add the voltage drops: across a shared resistor, across an outer one, for a source entered at its terminal, for one entered at (a rise). Set the sum to zero.
- Collect into and solve.
- Recover branch currents and node voltages; check with KCL or a power balance.
For resistors and independent voltage sources the matrix is again written by inspection:
The structure is the dual of nodal analysis: resistance for conductance, mesh for node, voltage source for current source. Linear Systems covers the solving.
Worked example
Given: the circuit above: (+ at the top), , shared, , (+ at the top).
Find: the mesh currents, the current in and the voltage of the middle top node.
Solve: work in , mA and V. Mesh 1, clockwise from the bottom left: rise through , drops in and . Mesh 2, clockwise from the middle: drops in (with ), , and entered at its terminal:
, so and . The negative sign just means mesh 2 circulates counter-clockwise. carries downwards, so .
Check: from the left, ; from the right, . Power: delivers , delivers ; resistors take . Balanced.
In Python
The first part solves the example; the second builds the mesh matrix of a three-section resistor ladder (all , at the input) from a list of "which meshes does each resistor touch", the same stamping idea as in nodal analysis.
import numpy as np
R = np.array([[6.0, -4.0], [-4.0, 6.0]]) # kOhm
v = np.array([12.0, -9.0]) # V
i1, i2 = np.linalg.solve(R, v) # mA
print(f"i1 = {i1:.3f} mA, i2 = {i2:.3f} mA, I(R2) = {i1 - i2:.3f} mA, v_m = {4*(i1 - i2):.3f} V")
# Ladder: R1 top, R2 shunt, R3 top, R4 shunt, R5 top, R6 shunt (all 1 kOhm), 10 V source in mesh 1
branches = [("R1", 1.0, [0]), ("R2", 1.0, [0, 1]), ("R3", 1.0, [1]),
("R4", 1.0, [1, 2]), ("R5", 1.0, [2]), ("R6", 1.0, [2])]
n = 3
Rm = np.zeros((n, n))
for name, r, meshes in branches:
for p in meshes:
Rm[p, p] += r
if len(meshes) == 2:
p, q = meshes
Rm[p, q] -= r; Rm[q, p] -= r
vm = np.array([10.0, 0.0, 0.0])
im = np.linalg.solve(Rm, vm)
print("R matrix (kOhm):"); print(Rm)
print("mesh currents (mA):", np.round(im, 4))
print(f"output across R6: {float(im[2]) * 1.0:.4f} V")i1 = 1.800 mA, i2 = -0.300 mA, I(R2) = 2.100 mA, v_m = 8.400 V
R matrix (kOhm):
[[ 2. -1. 0.]
[-1. 3. -1.]
[ 0. -1. 3.]]
mesh currents (mA): [6.1538 2.3077 0.7692]
output across R6: 0.7692 V
The signal shrinks by roughly a factor of 3 per section: the last mesh current is , a fraction that appears because .
Interactive: the two-mesh circuit
In the netlist lab, the current through is in SPICE's sign convention. Lower below and changes sign: stops delivering power and starts absorbing it, as a battery being charged does.
At the defaults the lab shows and the resistor currents , and ( is drawn from m to b, so its is flowing from b to m). Each volt of changes by , so gives and gives (clockwise, absorbing).
Guided lab: two supplies, one shared resistor
Hand calculation. As above: , , ; delivers .
Simulation. The lab above, or an ngspice deck with the same five lines and op.
What you would measure. Use two bench supplies with common negative terminals, and , both with a limit, and 1 % resistors. Measure to ground () and the voltage across each resistor; divide by the measured resistance to get currents rather than breaking the circuit for an ammeter. Expect across and across , each within about . The small current in is the sensitive one: a 1 % error in alone moves it by about , nearly 3 % of its value.
Hazards and safe setup. 12 V maximum, current-limited; dissipation is at most (in ). Most bench supplies cannot sink current: if a component change makes positive, is driven above its setting and the reading is wrong. Keep above or add a load across it.
Pitfalls
- Inconsistent directions. Keep every mesh current clockwise; then every off-diagonal entry is negative (for resistor-only sharing).
- Wrong sign on a source. Entering at is a drop ( on the "drops" side); entering at is a rise.
- Shared branches. The current in a shared resistor is , not or .
- Non-planar circuits. Mesh analysis needs a planar drawing; for a non-planar circuit use nodal analysis or a general loop analysis (Supermeshes, and Choosing Nodal or Mesh).
- Current sources. A current source in a branch fixes a mesh current or a difference of two; that case is the next lesson.
Practice
- Repeat the worked example with . Which source absorbs power now?
- A circuit has 7 branches and 5 nodes. How many mesh equations and how many nodal equations would you write?
- Write the mesh matrix by inspection for two meshes sharing a resistor, with outer resistance in mesh 1 and in mesh 2.
Answer
- : , . is positive (clockwise), so current enters at its terminal: absorbs .
- Meshes: . Nodes: (fewer if voltage sources fix some).
- .
Test yourself
Which law does mesh analysis write as its equations?
- KCL at every node
- KVL around every mesh
- Ohm's law only
- Tellegen's theorem
Meshes 1 and 2 share a resistor, with and , both clockwise. The current in the shared resistor in the direction of is…
How many independent mesh equations does a planar circuit with 9 branches and 6 nodes need?
- 3
- 4
- 5
- 9
With all mesh currents clockwise, the off-diagonal entries of the mesh resistance matrix (resistors and independent voltage sources only) are…
- positive
- zero
- negative or zero
- equal to the diagonal