TExcelTAD
Home › Circuit Theory & Network Analysis › Mesh-Current Analysis

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 pp and qq carries ip−iqi_p - i_q (in the direction of ipi_p).

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 BB branches and NN nodes has B−N+1B - N + 1 meshes.

+ - V1 12 V R1 2 kOhm R2 4 kOhm R3 2 kOhm + - V2 9 V m i1 i2

The method

  1. Check the circuit is planar; mark each window with a clockwise mesh current.
  2. Around each mesh, in the direction of its current, add the voltage drops: R(ip−iq)R(i_p - i_q) across a shared resistor, RipR i_p across an outer one, +V+V for a source entered at its ++ terminal, −V-V for one entered at −- (a rise). Set the sum to zero.
  3. Collect into R i=vR\,\mathbf{i} = \mathbf{v} and solve.
  4. 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:

Rpp=∑resistances around mesh p,Rpq=−∑resistances shared by meshes p and q,vp=∑source rises along pR_{pp} = \sum \text{resistances around mesh } p, \qquad R_{pq} = -\sum \text{resistances shared by meshes } p \text{ and } q, \qquad v_p = \sum \text{source rises along } p

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: V1=12 VV_1 = 12\ \text{V} (+ at the top), R1=2 kΩR_1 = 2\ \text{k}\Omega, R2=4 kΩR_2 = 4\ \text{k}\Omega shared, R3=2 kΩR_3 = 2\ \text{k}\Omega, V2=9 VV_2 = 9\ \text{V} (+ at the top).

Find: the mesh currents, the current in R2R_2 and the voltage vmv_m of the middle top node.

Solve: work in kΩ\text{k}\Omega, mA and V. Mesh 1, clockwise from the bottom left: rise through V1V_1, drops in R1R_1 and R2R_2. Mesh 2, clockwise from the middle: drops in R2R_2 (with i2−i1i_2 - i_1), R3R_3, and V2V_2 entered at its ++ terminal:

−12+2i1+4(i1−i2)=04(i2−i1)+2i2+9=0⇒[6−4−46][i1i2]=[12−9]\begin{aligned} -12 + 2 i_1 + 4 (i_1 - i_2) &= 0 \\ 4 (i_2 - i_1) + 2 i_2 + 9 &= 0 \end{aligned} \quad\Rightarrow\quad \begin{bmatrix} 6 & -4 \\ -4 & 6 \end{bmatrix} \begin{bmatrix} i_1 \\ i_2 \end{bmatrix} = \begin{bmatrix} 12 \\ -9 \end{bmatrix}

det⁡=36−16=20\det = 36 - 16 = 20, so i1=(12⋅6−4⋅9)/20=1.8 mAi_1 = (12 \cdot 6 - 4 \cdot 9)/20 = 1.8\ \text{mA} and i2=(6⋅(−9)+4⋅12)/20=−0.3 mAi_2 = (6 \cdot (-9) + 4 \cdot 12)/20 = -0.3\ \text{mA}. The negative sign just means mesh 2 circulates counter-clockwise. R2R_2 carries i1−i2=2.1 mAi_1 - i_2 = 2.1\ \text{mA} downwards, so vm=4⋅2.1=8.4 Vv_m = 4 \cdot 2.1 = 8.4\ \text{V}.

Check: from the left, vm=12−2⋅1.8=8.4 Vv_m = 12 - 2 \cdot 1.8 = 8.4\ \text{V}; from the right, vm=9−2⋅0.3=8.4 Vv_m = 9 - 2 \cdot 0.3 = 8.4\ \text{V}. Power: V1V_1 delivers 12⋅1.8=21.6 mW12 \cdot 1.8 = 21.6\ \text{mW}, V2V_2 delivers 9⋅0.3=2.7 mW9 \cdot 0.3 = 2.7\ \text{mW}; resistors take 2⋅1.82+4⋅2.12+2⋅0.32=6.48+17.64+0.18=24.3 mW2 \cdot 1.8^2 + 4 \cdot 2.1^2 + 2 \cdot 0.3^2 = 6.48 + 17.64 + 0.18 = 24.3\ \text{mW}. Balanced.

In Python

The first part solves the example; the second builds the mesh matrix of a three-section resistor ladder (all 1 kΩ1\ \text{k}\Omega, 10 V10\ \text{V} at the input) from a list of "which meshes does each resistor touch", the same stamping idea as in nodal analysis.

python · try it yourself
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 10/13 mA10/13\ \text{mA}, a fraction that appears because det⁡Rm=13\det R_m = 13.

Interactive: the two-mesh circuit

In the netlist lab, the current through V2V_2 is i2i_2 in SPICE's sign convention. Lower V2V_2 below 8 V8\ \text{V} and i2i_2 changes sign: V2V_2 stops delivering power and starts absorbing it, as a battery being charged does.

node voltages (to ground 0)a12.00 Vm8.400 Vb9.000 VnetlistV1 a 0 DC 12R1 a m 2kR2 m 0 4kR3 m b 2kV2 b 0 DC 9element currents (node 1 to node 2 through it)V1a>0-1.80 mAR1a>m1.80 mAR2m>02.10 mAR3m>b-300 uAV2b>0-300 uA

At the defaults the lab shows vm=8.4 Vv_m = 8.4\ \text{V} and the resistor currents 1.81.8, 2.12.1 and −0.3 mA-0.3\ \text{mA} (R3R_3 is drawn from m to b, so its −0.3 mA-0.3\ \text{mA} is 0.3 mA0.3\ \text{mA} flowing from b to m). Each volt of V2V_2 changes i2i_2 by −0.3 mA-0.3\ \text{mA}, so V2=8 VV_2 = 8\ \text{V} gives i2=0i_2 = 0 and V2=6 VV_2 = 6\ \text{V} gives i2=+0.6 mAi_2 = +0.6\ \text{mA} (clockwise, V2V_2 absorbing).

Guided lab: two supplies, one shared resistor

Hand calculation. As above: i1=1.80 mAi_1 = 1.80\ \text{mA}, IR2=2.10 mAI_{R2} = 2.10\ \text{mA}, vm=8.40 Vv_m = 8.40\ \text{V}; V2V_2 delivers 0.30 mA0.30\ \text{mA}.

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, 12.00 V12.00\ \text{V} and 9.00 V9.00\ \text{V}, both with a 20 mA20\ \text{mA} limit, and 1 % resistors. Measure vmv_m to ground (8.40±0.06 V8.40 \pm 0.06\ \text{V}) and the voltage across each resistor; divide by the measured resistance to get currents rather than breaking the circuit for an ammeter. Expect 3.60 V3.60\ \text{V} across R1R_1 and 0.60 V0.60\ \text{V} across R3R_3, each within about ±2 %\pm 2\,\%. The small current in V2V_2 is the sensitive one: a 1 % error in R2R_2 alone moves it by about 0.008 mA0.008\ \text{mA}, nearly 3 % of its value.

Hazards and safe setup. 12 V maximum, current-limited; dissipation is at most 17.6 mW17.6\ \text{mW} (in R2R_2). Most bench supplies cannot sink current: if a component change makes i2i_2 positive, V2V_2 is driven above its setting and the reading is wrong. Keep V2V_2 above 8 V8\ \text{V} or add a 1 kΩ1\ \text{k}\Omega 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 (+V+V on the "drops" side); entering at −- is a rise.
  • Shared branches. The current in a shared resistor is ip−iqi_p - i_q, not ipi_p or iqi_q.
  • 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

  1. Repeat the worked example with V2=3 VV_2 = 3\ \text{V}. Which source absorbs power now?
  2. A circuit has 7 branches and 5 nodes. How many mesh equations and how many nodal equations would you write?
  3. Write the mesh matrix by inspection for two meshes sharing a 10 Ω10\ \Omega resistor, with 20 Ω20\ \Omega outer resistance in mesh 1 and 30 Ω30\ \Omega in mesh 2.
Answer
  1. v=(12,−3)\mathbf{v} = (12, -3): i1=(72−12)/20=3.0 mAi_1 = (72 - 12)/20 = 3.0\ \text{mA}, i2=(−18+48)/20=1.5 mAi_2 = (-18 + 48)/20 = 1.5\ \text{mA}. i2i_2 is positive (clockwise), so current enters V2V_2 at its ++ terminal: V2V_2 absorbs 3⋅1.5=4.5 mW3 \cdot 1.5 = 4.5\ \text{mW}.
  2. Meshes: B−N+1=7−5+1=3B - N + 1 = 7 - 5 + 1 = 3. Nodes: N−1=4N - 1 = 4 (fewer if voltage sources fix some).
  3. [30−10−1040] Ω\begin{bmatrix} 30 & -10 \\ -10 & 40 \end{bmatrix}\ \Omega.

Test yourself

Which law does mesh analysis write as its equations?

  1. KCL at every node
  2. KVL around every mesh
  3. Ohm's law only
  4. Tellegen's theorem

Meshes 1 and 2 share a 4 kΩ4\ \text{k}\Omega resistor, with i1=1.8 mAi_1 = 1.8\ \text{mA} and i2=−0.3 mAi_2 = -0.3\ \text{mA}, both clockwise. The current in the shared resistor in the direction of i1i_1 is…

  1. 1.5 mA1.5\ \text{mA}
  2. 2.1 mA2.1\ \text{mA}
  3. −0.3 mA-0.3\ \text{mA}
  4. 1.8 mA1.8\ \text{mA}

How many independent mesh equations does a planar circuit with 9 branches and 6 nodes need?

  1. 3
  2. 4
  3. 5
  4. 9

With all mesh currents clockwise, the off-diagonal entries of the mesh resistance matrix (resistors and independent voltage sources only) are…

  1. positive
  2. zero
  3. negative or zero
  4. equal to the diagonal