Objective

Find all voltages (and currents) in an electronic circuit.

Procedure

The method proceeds in several steps, illustrated below for the following example circuit: Step 1: Reference Node

Select a reference (ground) node. Any node can be chosen for this purpose. In this example, we choose the node at the bottom of the circuit diagram. Step 2: Label Nodes with Voltage set by Sources

Voltage sources set the voltage of the node they are connected to. In the example, there is only one source, V1, and we label the corresponding source VV1 (names are arbitrary, but must be unique). Step 3: Label Remaining Nodes

Now we label all remaining nodes in the circuit except the reference. In the example there are two, Vn1 and Vn2. Step 4: Label Element Voltages and Currents

Next we mark all element voltages and currents.

Start with the current. The direction is arbitrary (top to bottom, bottom to top, it won’t matter, but stick with your choice in subsequent steps). Then mark the element voltages following the passive sign convention, i.e. the voltage and current point in the “same” direction.

The element voltage for I1 is not marked in the example since it will not be needed in the calculations below. Same for the voltage source. There is no harm in marking those, too. Step 5: KCL Equations

Write KCL equations for all nodes with unknown voltage, Vn1 and Vn2 in the example.

At Vn1 we get (sum of all currents entering the node equals sum of currents exiting):

$I_{R1} = I_{R2} + I_{R4}$

Similar for Vn2:

$I_{I1} + I_{R4} = I_{R3}$

Step 6: Element Currents

Find expressions for all element currents in terms of voltage and element characteristics (e.g. Ohm’s law) for all circuit elements except voltage sources. In the example there are five, R1, R2, R3, R4, I1.

\begin{align} I_{R1} &= \frac{V_{R1}}{R_1} \\ I_{R2} &= \frac{V_{R2}}{R_2} \\ I_{R3} &= \frac{V_{R3}}{R_3} \\ I_{R4} &= \frac{V_{R4}}{R_4} \\ I_{I1} &= I_1 \vphantom{\frac{1}{R_3}} \end{align}

We also have

$V_{V1} = V_1$

Substitute element voltages with node voltages, e.g. $V_{R1}=V_{V1}-V_{n1}=V_{1}-V_{n1}$ and $V_{R2}=V_{n1}-0=V_{n1}$.

\begin{align} I_{R1} &= \frac{V_{1}-V_{n1}}{R_1} \\ I_{R2} &= \frac{V_{n1}}{R_2} \\ I_{R3} &= \frac{V_{n2}}{R_3} \\ I_{R4} &= \frac{V_{n1}-V_{n2}}{R_4} \\ I_{I1} &= I_1 \vphantom{\frac{1}{R_3}} \end{align}

Step 7: Substitute Element Currents in KCL Equations

Now we substitute the expressions derived in Step 6 into the KCL equations from Step 5.

\begin{align} \frac{V_{1}-V_{n1}}{R_1} &= \frac{V_{n1}}{R_2} + \frac{V_{n1}-V_{n2}}{R_4} \\[3mm] I_{1} + \frac{V_{n1}-V_{n2}}{R_4} &= \frac{V_{n2}}{R_3} \end{align}

Let’s make this a bit nicer by grouping the unknowns (Vn1 and Vn2) on the left side and the known terms on the right:

\begin{align} V_{n1}\left(\frac{1}{R_1}+\frac{1}{R_2}+\frac{1}{R_4}\right) &+ V_{n2}\left(-\frac{1}{R_4}\right)= \frac{V_1}{R_1} \\[3mm] V_{n1}\left(-\frac{1}{R_4}\right) &+ V_{n2}\left(\frac{1}{R_3}+\frac{1}{R_4}\right) = I_1 \\ \end{align}

Step 8: Solve

Now we can solve for the unknown node voltages, Vn1 and Vn2 in the example. First, rearrange terms to cast the equations as a linear algebra problem:

$\begin{bmatrix} \frac{1}{R_1}+\frac{1}{R_2}+\frac{1}{R_4} & -\frac{1}{R_4} \\ -\frac{1}{R_4} & \frac{1}{R_3}+\frac{1}{R_4} \end{bmatrix} \begin{bmatrix} V_{n1} \vphantom{\frac{1}{R_3}} \\ V_{n2} \vphantom{\frac{1}{R_3}} \end{bmatrix} = \begin{bmatrix} \frac{V_1}{R_1} \\ I_1 \end{bmatrix}$

Note how 1/R4 appears in four cells of the matrix, with positive and negative signs? The other resistors appear only once in the matrix since they are connected to either the reference node or the source. These observations are always true and and can be used to verify the calculations.

Then compute the solution using Gaussian Elimination (or let the computer do the work, here using sympy):

from sympy import *
init_printing(use_unicode=True)

R1, R2, R3, R4 = symbols('R1 R2 R3 R4')
Y = Matrix([[ 1/R1+1/R2+1/R4, -1/R4], [-1/R4, 1/R3+1/R4]])

V1, I1 = symbols('V1 I1')
b = Matrix([ V1/R1, I1 ])

Vn1, Vn2 = linsolve((Y, b)).args

Algebraic result:

>>> Vn1
R₂⋅(I₁⋅R₁⋅R + R₃⋅V + R₄⋅V)
─────────────────────────────────────
R₁⋅R + R₁⋅R + R₁⋅R + R₂⋅R + R₂⋅R
>>> Vn2
R₃⋅R₄⋅(I₁⋅(R₁⋅R + R₁⋅R + R₂⋅R) + R₂⋅V)
─────────────────────────────────────────────
-R₁⋅R₂⋅R + (R + R)(R₁⋅R + R₁⋅R + R₂⋅R)

Numerical result:

>>> values = {R1:1, R2:2, R3:3, R4:4, I1:0.5, V1:1}
>>>
>>> f"Vn1 = {Vn1.evalf(3, subs=values)} V"
Vn1 = 0.739 V
>>> f"Vn2 = {Vn2.evalf(3, subs=values)} V"
Vn2 = 1.17 V

Branch Currents

Sometimes we want to solve for branch currents. These are easily obtained from the node voltages and element equations. For example, the current IR4 through resistor R4 is

\begin{align} I_{R4} &= \frac{V_{R4}}{R_4} \\ &= \frac{V_{n1}-V_{n2}}{R_4} \end{align}

Numerical result: IR4 = -0.109 A.

Summary

Node voltage analysis can be used to determine voltages and currents from component values in electronic circuits.

Reference: Schaum’s Outline of Electric Circuits, Seventh Edition, Section 4.4.