Sub topic 11
Checking Your Answer
This chapter assumes you can solve a nodal system for node voltages. You will test the result in two ways that do not depend on the matrix you built. A wrong answer usually comes from a sign error or a missing term in G or i. Re-solving the same equations cannot catch that, so the checks go back to the circuit itself.
Check 1: KCL at every node
Use the node voltages to compute each branch current directly from Ohm's law, then add the currents at each node. They must sum to zero, counting source currents.
The circuit is the one from earlier in the tutorial. A 2 A source feeds node 1. R1 = 4 Ω runs from node 1 to ground, R2 = 2 Ω from node 1 to node 2, and R3 = 6 Ω from node 2 to ground. The solution was V1 = 16/3 V and V2 = 4 V.
Branch currents:
- Through R1, from node 1 to ground: (16/3) / 4 = 4/3 A.
- Through R2, from node 1 to node 2: (16/3 − 4) / 2 = 2/3 A.
- Through R3, from node 2 to ground: 4 / 6 = 2/3 A.
At node 1, 2 A enters from the source and 4/3 + 2/3 = 2 A leaves. At node 2, 2/3 A enters through R2 and 2/3 A leaves through R3. Both nodes balance.
Check the ground node too. The currents returning to it are 4/3 A from R1 and 2/3 A from R3, which total the 2 A the source supplies. The reference node has no equation of its own, so this is the one balance your equations never forced.
Check 2: Power balance
Energy is conserved. The power delivered by the sources must equal the power absorbed by the resistors.
| Element | Formula | Power |
|---|---|---|
| R1 | V²/R = (16/3)² / 4 | 64/9 W |
| R2 | I²R = (2/3)² × 2 | 8/9 W |
| R3 | V²/R = 4² / 6 | 24/9 W |
| Resistors total | 96/9 = 32/3 W | |
| Current source | I × V1 = 2 × 16/3 | 32/3 W |
The totals match at about 10.667 W. A source delivers power when its current leaves the positive terminal. Here the 2 A source pushes current into node 1, which sits at +16/3 V, so it delivers power. Take the sign from the current direction and the voltage polarity, not from guesswork.
Automating both checks
The script computes branch currents from the circuit description, not from G, so it can expose a mistake in G.
import numpy as np
g1, g2, g3 = 1/4, 1/2, 1/6
G = np.array([[g1 + g2, -g2],
[-g2, g2 + g3]])
i = np.array([2.0, 0.0])
v = np.linalg.solve(G, i)
volt = np.concatenate(([0.0], v)) # index 0 is ground
branches = [(1, 0, 4.0), (1, 2, 2.0), (2, 0, 6.0)] # (from, to, ohms)
source_amps, source_node = 2.0, 1
# KCL: net current leaving each non-ground node must be zero.
net = np.zeros(3)
net[source_node] += source_amps # source pushes current in
for a, b, r in branches:
current = (volt[a] - volt[b]) / r # flows from a to b
net[a] -= current
net[b] += current
print("KCL residuals:", net[1:])
print("KCL ok:", np.allclose(net[1:], 0))
# Power balance.
p_resistors = sum((volt[a] - volt[b]) ** 2 / r for a, b, r in branches)
p_source = source_amps * volt[source_node]
print("Power:", p_resistors, p_source)
print("Power ok:", np.isclose(p_resistors, p_source))Both checks print True.
Common failures
- Wrong sign on a source. KCL may still balance if you flipped the source consistently. The power balance then shows the source absorbing power when it should deliver it.
- A missing resistor term. The diagonal of G is missing a conductance. The branch-current KCL check fails at that node.
- Wrong units. Mixing kΩ and Ω gives a 1000-fold error. Both checks may pass in the wrong scale, so compare against a rough estimate, such as a voltage divider, as well.
Exercise
In the circuit above, suppose you mistakenly used R3 = 3 Ω instead of 6 Ω in G and got V2 = 3.2 V and V1 = 5.6 V. Without re-solving, which check exposes the error, and what does it show when you use the true R3 = 6 Ω?
Show answer
The KCL check at node 2 exposes it. With R3 = 6 Ω, the current leaving node 2 through R3 is 3.2 / 6 ≈ 0.533 A. The current entering through R2 is (5.6 − 3.2) / 2 = 1.2 A. These differ by about 0.667 A, so node 2 does not balance and the voltages are wrong for the real circuit.