## 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, *V _{1}*, and we label the corresponding source

*V*(names are arbitrary, but must be unique).

_{V1}### Step 3: Label Remaining Nodes

Now we label all remaining nodes in the circuit except the reference. In the example there are two, *V _{n1}* and

*V*.

_{n2}### 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 *I _{1}* 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, *V _{n1}* and

*V*in the example.

_{n2}At *V _{n1}* we get (sum of all currents entering the node equals sum of currents exiting):

Similar for *V _{n2}*:

### 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, *R _{1}*,

*R*,

_{2}*R*,

_{3}*R*,

_{4}*I*.

_{1}We also have

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}\).

### Step 7: Substitute Element Currents in KCL Equations

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

Let’s make this a bit nicer by grouping the unknowns (*V _{n1}* and

*V*) on the left side and the known terms on the right:

_{n2}### Step 8: Solve

Now we can solve for the unknown node voltages, *V _{n1}* and

*V*in the example. First, rearrange terms to cast the equations as a linear algebra problem:

_{n2}Note how 1/*R _{4}* 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[0]
```

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 *I _{R4}* through resistor

*R*is

_{4}Numerical result: *I _{R4}* = -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.