TExcelTAD
Home › Circuit Theory & Network Analysis › Node-Voltage Analysis

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 v1,v2,…v_1, v_2, \ldots 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 N−1N - 1 of them for NN nodes, usually far fewer than the branch currents.

KCL at each non-reference node gives one equation. With resistors written as conductances G=1/RG = 1/R, the current leaving node kk through a resistor to node mm is G(vk−vm)G(v_k - v_m), and through a resistor to ground GvkG v_k.

+ - V1 12 V R1 1 kOhm R2 4 kOhm R3 1 kOhm R4 2 kOhm I1 1 mA a b c node 0 = reference (ground) i2 i1 i3 i4

The method, step by step

  1. Choose the reference node: usually the one with the most connections, or the negative terminal of the main source.
  2. Label the other nodes. A node tied to the reference by a voltage source alone has a known voltage (here va=12 Vv_a = 12\ \text{V}), so it is not an unknown.
  3. At each unknown node, write KCL as "sum of currents leaving through resistors = sum of source currents entering".
  4. Collect terms into matrix form G v=iG\,\mathbf{v} = \mathbf{i} and solve.
  5. 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:

Gkk=∑conductances touching node k,Gkm=−∑conductances between k and m,ik=∑source currents into kG_{kk} = \sum \text{conductances touching node } k, \qquad G_{km} = -\sum \text{conductances between } k \text{ and } m, \qquad i_k = \sum \text{source currents into } k

GG 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 vav_a) moves to the right-hand side as a current GvaG v_a into its neighbour.

Worked example

Given: the circuit above: V1=12 VV_1 = 12\ \text{V} at node a, R1=1 kΩR_1 = 1\ \text{k}\Omega (a to b), R2=4 kΩR_2 = 4\ \text{k}\Omega (b to ground), R3=1 kΩR_3 = 1\ \text{k}\Omega (b to c), R4=2 kΩR_4 = 2\ \text{k}\Omega (c to ground), I1=1 mAI_1 = 1\ \text{mA} into node c.

Find: vbv_b, vcv_c and the four resistor currents.

Solve: work in kΩ\text{k}\Omega, mA and V (then 1/kΩ=mS1/\text{k}\Omega = \text{mS} and mS⋅V=mA\text{mS} \cdot \text{V} = \text{mA}). KCL at b and c:

vb−121+vb4+vb−vc1=0node bvc−vb1+vc2=1node c\begin{aligned} \frac{v_b - 12}{1} + \frac{v_b}{4} + \frac{v_b - v_c}{1} &= 0 && \text{node b} \\ \frac{v_c - v_b}{1} + \frac{v_c}{2} &= 1 && \text{node c} \end{aligned}

In matrix form, with conductances in mS:

[2.25−1−11.5][vbvc]=[121]⇒det⁡G=2.25⋅1.5−1=2.375\begin{bmatrix} 2.25 & -1 \\ -1 & 1.5 \end{bmatrix} \begin{bmatrix} v_b \\ v_c \end{bmatrix} = \begin{bmatrix} 12 \\ 1 \end{bmatrix} \quad\Rightarrow\quad \det G = 2.25 \cdot 1.5 - 1 = 2.375

By Cramer's rule, vb=(12⋅1.5+1⋅1)/2.375=8.00 Vv_b = (12 \cdot 1.5 + 1 \cdot 1)/2.375 = 8.00\ \text{V} and vc=(2.25⋅1+1⋅12)/2.375=6.00 Vv_c = (2.25 \cdot 1 + 1 \cdot 12)/2.375 = 6.00\ \text{V}. Then

i1=12−81 kΩ=4 mA,i2=84 kΩ=2 mA,i3=8−61 kΩ=2 mA,i4=62 kΩ=3 mAi_1 = \frac{12 - 8}{1\ \text{k}\Omega} = 4\ \text{mA}, \quad i_2 = \frac{8}{4\ \text{k}\Omega} = 2\ \text{mA}, \quad i_3 = \frac{8 - 6}{1\ \text{k}\Omega} = 2\ \text{mA}, \quad i_4 = \frac{6}{2\ \text{k}\Omega} = 3\ \text{mA}

Check: KCL at c, not used in this form: i3+I1=2+1=3 mA=i4i_3 + I_1 = 2 + 1 = 3\ \text{mA} = i_4. Power: the source delivers 12 V⋅4 mA=48 mW12\ \text{V} \cdot 4\ \text{mA} = 48\ \text{mW} and I1I_1 delivers 6 V⋅1 mA=6 mW6\ \text{V} \cdot 1\ \text{mA} = 6\ \text{mW}; the resistors take 16+16+4+18=54 mW16 + 16 + 4 + 18 = 54\ \text{mW}. 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.

python · try it yourself
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.

bash · try it yourself
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 −4 mA-4\ \text{mA} 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 R3R_3 or I1I_1 and watch vbv_b and vcv_c move together: a change anywhere shifts every node, which is why the equations are coupled.

node voltages (to ground 0)a12.00 Vb8.000 Vc6.000 VnetlistV1 a 0 DC 12R1 a b 1kR2 b 0 4kR3 b c 1kR4 c 0 2kI1 0 c DC 1melement currents (node 1 to node 2 through it)V1a>0-4.00 mAR1a>b4.00 mAR2b>02.00 mAR3b>c2.00 mAR4c>03.00 mAI10>c1.00 mA

At the defaults the lab reads vb=8 Vv_b = 8\ \text{V} and vc=6 Vv_c = 6\ \text{V}. With I1=0I_1 = 0 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 V2V_2 in series with a resistor. A source transformation (Source Transformation) shows that 1 mA1\ \text{mA} in parallel with R4=2 kΩR_4 = 2\ \text{k}\Omega equals 2 V2\ \text{V} in series with 2 kΩ2\ \text{k}\Omega. So remove I1I_1 and connect R4R_4 from c to the + terminal of a second supply V2=2 VV_2 = 2\ \text{V} (its negative terminal on ground): vbv_b and vcv_c stay 8.00 V8.00\ \text{V} and 6.00 V6.00\ \text{V}. Only the current in R4R_4 changes, to (6−2)/2=2 mA(6 - 2)/2 = 2\ \text{mA}, because R4R_4 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 12.00 V12.00\ \text{V} and 2.00 V2.00\ \text{V} with the current limits at 20 mA20\ \text{mA}, and measure from the common ground to b and to c with a DMM. Expect 8.00±0.08 V8.00 \pm 0.08\ \text{V} and 6.00±0.06 V6.00 \pm 0.06\ \text{V}: 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 16 mW16\ \text{mW}, in R1R_1 and in R2R_2 (R4R_4 now takes 8 mW8\ \text{mW}), far below a 0.25 W rating. Connect both supplies' negative terminals to the same ground rail. Note that the 2 mA2\ \text{mA} in R4R_4 flows into the 2 V2\ \text{V} supply's + terminal, and many bench supplies cannot sink current: put a 470 Ω470\ \Omega resistor across that supply's terminals (it draws 4.3 mA4.3\ \text{mA}, so the supply delivers a net 2.3 mA2.3\ \text{mA}) 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 kk goes on the right-hand side with a plus sign.
  • Units. Mixing Ω\Omega and kΩ\text{k}\Omega in one equation is the most common arithmetic error. Work in kΩ\text{k}\Omega, 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

  1. In the worked example, change R2R_2 to 2 kΩ2\ \text{k}\Omega and solve for vbv_b and vcv_c.
  2. Write the conductance matrix by inspection for a ladder: 1 mA1\ \text{mA} into node 1, Ra=2 kΩR_a = 2\ \text{k}\Omega from 1 to ground, Rb=1 kΩR_b = 1\ \text{k}\Omega from 1 to 2, Rc=1 kΩR_c = 1\ \text{k}\Omega from 2 to ground. Solve it.
  3. Why is the conductance matrix symmetric in a circuit of resistors and independent sources, and what kind of element breaks the symmetry?
Answer
  1. G=[2.5−1−11.5]G = \begin{bmatrix} 2.5 & -1 \\ -1 & 1.5 \end{bmatrix} mS, i=(12,1)\mathbf{i} = (12, 1) mA, det⁡G=2.75\det G = 2.75: vb=(18+1)/2.75=6.91 Vv_b = (18 + 1)/2.75 = 6.91\ \text{V}, vc=(2.5+12)/2.75=5.27 Vv_c = (2.5 + 12)/2.75 = 5.27\ \text{V}.
  2. G=[1.5−1−12]G = \begin{bmatrix} 1.5 & -1 \\ -1 & 2 \end{bmatrix} mS, i=(1,0)\mathbf{i} = (1, 0) mA, det⁡G=2\det G = 2: v1=2/2=1.00 Vv_1 = 2/2 = 1.00\ \text{V}, v2=1/2=0.50 Vv_2 = 1/2 = 0.50\ \text{V}.
  3. A resistor between kk and mm adds −G-G to both GkmG_{km} and GmkG_{mk}. 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?

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

In the conductance matrix, the diagonal entry GkkG_{kk} is…

  1. the sum of the conductances connected to node kk
  2. minus the conductance between kk and ground
  3. the current into node kk
  4. always zero

SPICE reports i(v1) = -4.00000e-03 for a 12 V source. What does the minus sign mean?

  1. the source absorbs 48 mW
  2. 4 mA flows out of the + terminal into the circuit, so the source delivers power
  3. the source is reversed in the deck
  4. the solution did not converge

With vb=8 Vv_b = 8\ \text{V} and vc=6 Vv_c = 6\ \text{V}, what current flows through a 1 kΩ1\ \text{k}\Omega resistor from b to c?

  1. 14 mA14\ \text{mA}
  2. 8 mA8\ \text{mA}
  3. 2 mA2\ \text{mA}
  4. −2 mA-2\ \text{mA}