>
section 3 of 126 min read

3. Mesh Analysis: Systematic KVL

When the circuit gets more complex than two or three loops, doing KVL by hand becomes error-prone. Mesh analysis is a systematic procedure for KVL.

3.1 The procedure

  1. Identify all the independent meshes (a mesh is the smallest closed loop with no other loops inside; a planar circuit with bb branches and nn nodes has bn+1b - n + 1 meshes).
  2. Assign a mesh current to each mesh, all in the same direction (typically clockwise).
  3. Write KVL around each mesh, expressing voltage drops in terms of mesh currents. A shared branch carries the difference of the two mesh currents.
  4. Solve the resulting mm equations in mm unknowns.
  5. Recover branch currents from mesh currents.

The key conceptual move is treating each mesh's "circulating current" as a single variable. The actual current in any branch is the sum or difference of the mesh currents through it.

3.2 Worked example: two meshes, fully solved

Consider this two-mesh circuit, with a 12 V source on the left, a 6 V source on the right, and three resistors:

plaintext
          +────[R1=2Ω]─────●─────[R2=4Ω]────+
          │                │                │
        12 V              [R3=6Ω]          6 V
          │      I1 →      │      ← I2     │
          +─────────────────●─────────────────+
                          GND

Let I1I_1 circulate clockwise in the left mesh and I2I_2 circulate clockwise in the right mesh. Resistor R3R_3 is shared between them. The actual current going down through R3R_3 is I1I2I_1 - I_2 (positive if I1I_1 wins, negative otherwise).

KVL around mesh 1, walking clockwise from the bottom-left corner: rise of 12 V across the source, drop of I1R1I_1 R_1 across R1R_1, drop of (I1I2)R3(I_1 - I_2) R_3 across R3R_3, back to the start.

12I1R1(I1I2)R3=012 - I_1 R_1 - (I_1 - I_2) R_3 = 0 12=I1R1+(I1I2)R3=I1(R1+R3)I2R312 = I_1 R_1 + (I_1 - I_2) R_3 = I_1 (R_1 + R_3) - I_2 R_3 12=8I16I212 = 8 I_1 - 6 I_2

KVL around mesh 2, walking clockwise from the bottom of R3R_3: rise of (I1I2)R3(I_1 - I_2) R_3 across R3R_3 (we are walking against the assumed direction of (I1I2)(I_1 - I_2) from the perspective of mesh 2, so the sign flips), drop of I2R2I_2 R_2 across R2R_2, drop of 6 V across the source (we are walking from the - to the + terminal backwards, so this is a rise; let's be careful).

Let me redo mesh 2 carefully. In mesh 2 walking clockwise, we go up through R3R_3 (against the I1I2I_1 - I_2 direction we defined for R3R_3), so the voltage rises by (I1I2)R3(I_1 - I_2) R_3. Then we cross R2R_2 in the direction of I2I_2, so the voltage drops by I2R2I_2 R_2. Then we cross the 6 V source. Suppose its + terminal is on top; then walking down from + to - is a drop of 6 V.

(I1I2)R3I2R26=0(I_1 - I_2) R_3 - I_2 R_2 - 6 = 0 I1R3I2(R2+R3)=6I_1 R_3 - I_2 (R_2 + R_3) = 6 6I110I2=66 I_1 - 10 I_2 = 6

So we have a 2×2 system:

(86610)(I1I2)=(126)\begin{pmatrix} 8 & -6 \\ 6 & -10 \end{pmatrix} \begin{pmatrix} I_1 \\ I_2 \end{pmatrix} = \begin{pmatrix} 12 \\ 6 \end{pmatrix}

Solve. The determinant is 8(10)(6)6=80+36=448 \cdot (-10) - (-6) \cdot 6 = -80 + 36 = -44.

I1=12(10)(6)644=120+3644=84441.91 AI_1 = \frac{12 \cdot (-10) - (-6) \cdot 6}{-44} = \frac{-120 + 36}{-44} = \frac{-84}{-44} \approx 1.91 \text{ A}

I2=8661244=487244=24440.545 AI_2 = \frac{8 \cdot 6 - 6 \cdot 12}{-44} = \frac{48 - 72}{-44} = \frac{-24}{-44} \approx 0.545 \text{ A}

So I11.91I_1 \approx 1.91 A clockwise in the left mesh, I20.545I_2 \approx 0.545 A clockwise in the right mesh, and the current through R3R_3 (downward) is I1I21.36I_1 - I_2 \approx 1.36 A. The voltage across R3R_3 is 1.36×68.181.36 \times 6 \approx 8.18 V, with the top of R3R_3 being the higher potential.

You can sanity-check by computing power balance. Power delivered by the 12 V source: 12×1.9122.912 \times 1.91 \approx 22.9 W. Power absorbed by the 6 V source (it is being charged because current flows into its + terminal): 6×0.5453.276 \times 0.545 \approx 3.27 W. Power dissipated in resistors: 1.912×2+0.5452×4+1.362×67.30+1.19+11.1019.61.91^2 \times 2 + 0.545^2 \times 4 + 1.36^2 \times 6 \approx 7.30 + 1.19 + 11.10 \approx 19.6 W. Total absorbed: 19.6+3.2722.919.6 + 3.27 \approx 22.9 W. Matches the source. Good.

3.3 Mesh in matrix form

For an mm-mesh circuit, the result is always of the form Ri=v\mathbf{R} \mathbf{i} = \mathbf{v}, where R\mathbf{R} is an m×mm \times m symmetric resistance matrix (assuming all sources are independent and the circuit has no dependent sources or controlled sources). The diagonal entry RkkR_{kk} equals the sum of all resistances in mesh kk. The off-diagonal entry RjkR_{jk} equals the negative sum of resistances shared between mesh jj and mesh kk. The right-hand side v\mathbf{v} collects net source voltages around each mesh.

This pattern, "fill the matrix from the topology, fill the vector from the sources, solve," is exactly what SPICE simulators automate. Numpy can do the same:

python
import numpy as np
 
R = np.array([[8.0, -6.0],
              [6.0, -10.0]])
V = np.array([12.0, 6.0])
i = np.linalg.solve(R, V)
print(f"I1 = {i[0]:.3f} A,  I2 = {i[1]:.3f} A")
print(f"Current through R3 (downward) = {i[0]-i[1]:.3f} A")

For practice, write the same matrix for a four-mesh circuit and let numpy solve it. You will see how the topology of the circuit translates directly into the structure of the matrix.

3.4 Special cases

  • Current sources between meshes fix the difference of mesh currents. Use a "supermesh" treating both as one for KVL, then add Im1Im2=IsrcI_{m1} - I_{m2} = I_{src} as a constraint.
  • Dependent sources require an extra constraint equation for the controlling variable.
  • Non-planar circuits are awkward for mesh analysis; use nodal instead.

Mesh is rarely used in practice today; almost every modern simulator uses nodal analysis under the hood, because nodal scales better. But the mesh viewpoint shines for switching converters, where each "mesh" corresponds to one stage of energy storage and release. A buck converter has two meshes alternately closed by the transistor switch: one phase ramps current up through the inductor; the other phase rings the stored current out into the load. Mesh-style analysis sizes the inductor and capacitor for the desired ripple. We return to this in Chapter 4 (Pulse and Digital Circuits).