Modified Nodal Analysis (MNA): The Algorithm Behind Circuit Solvers

Why Plain Nodal Analysis Needed an Upgrade

Classical nodal analysis works beautifully until a circuit contains an ideal voltage source. The method writes every branch current as conductance times a voltage difference, but an ideal voltage source has no defined resistance — its current is whatever the rest of the circuit demands. Hand analysis patches this with supernodes, but that trick is awkward to automate. A program would have to detect floating sources, restructure the matrix, and special-case each topology. Modified Nodal Analysis (MNA) removes the special cases entirely, which is exactly why SPICE, Lcapy, and essentially every serious circuit simulator are built on it.

The core insight of MNA is simple: when an element's current cannot be expressed in node voltages, promote that current to a new unknown. The system grows by one row and one column per such element, but it stays fully systematic. No human judgment, no supernode bookkeeping — just a mechanical stamping procedure that any solver can run.

The Block Structure of the MNA System

MNA assembles a single linear system Ax=zA x = z. The unknown vector xx is partitioned into node voltages vv and the extra source currents jj. This deliberate enlargement of the unknown set is the entire trick: rather than forcing every current to be a function of voltages, MNA simply admits the troublesome currents as first-class variables and lets the linear solver determine them along with the voltages. The matrix AA that results has a characteristic four-block form:

[GBCD][vj]=[ie]\begin{bmatrix} G & B \\ C & D \end{bmatrix} \begin{bmatrix} v \\ j \end{bmatrix} = \begin{bmatrix} i \\ e \end{bmatrix}

Each block has a precise meaning:

  • GG is the (N1)×(N1)(N-1)\times(N-1) conductance matrix built exactly as in ordinary nodal analysis: diagonal entries are the sum of conductances at a node, off-diagonal entries are the negated shared conductances.
  • BB is the (N1)×M(N-1)\times M incidence matrix linking each voltage source's current to the nodes it touches. Entries are +1+1, 1-1, or 00.
  • CC enforces the source constraints. For independent sources it equals BTB^{\mathsf T}, which is why the matrix is symmetric for purely passive networks plus independent voltage sources.
  • DD is normally zero, but becomes nonzero for controlled sources and other elements that couple currents to currents.

On the right, ii holds independent current-source injections at each node, and ee holds the values of the independent voltage sources.

The Stamp Approach

MNA never builds the matrix by staring at the whole circuit. Instead it visits each element once and adds — stamps — that element's fixed contribution into the appropriate rows and columns. Because stamps simply accumulate, element order does not matter and the algorithm is trivially parallelizable. A practical consequence worth appreciating is that the same routine that builds a two-node toy circuit scales without modification to an integrated circuit with millions of nodes; only the loop count changes, never the logic. The table below lists the canonical stamps for a resistor between nodes pp and qq, an independent current source, an independent voltage source with current index kk, and a transconductance source.

ElementRows / columns touchedStamp added
Resistor RR (p–q)Gpp,Gqq,Gpq,GqpG_{pp}, G_{qq}, G_{pq}, G_{qp}+1R+\tfrac{1}{R} on diagonals, 1R-\tfrac{1}{R} off-diagonals
Current source IsI_s (into p)ip,iqi_p, i_q+Is+I_s at pp, Is-I_s at qq
Voltage source VsV_s (+ at p)Bpk,Bqk,Ckp,Ckq,ekB_{pk}, B_{qk}, C_{kp}, C_{kq}, e_kBpk=+1,  Bqk=1B_{pk}=+1,\;B_{qk}=-1, same for CC, and ek=Vse_k = V_s
VCCS gmg_m (control x–y)Gpx,Gpy,Gqx,GqyG_{px}, G_{py}, G_{qx}, G_{qy}±gm\pm g_m coupling output nodes to control nodes

Worked Example: Source, Two Resistors, Three Unknowns

Take a voltage source Vs=5VV_s = 5\,\text{V} whose positive terminal is node 1 and whose negative terminal is ground. R1=1ΩR_1 = 1\,\Omega connects node 1 to node 2, and R2=4ΩR_2 = 4\,\Omega connects node 2 to ground. The unknowns are the two node voltages plus the source current jVj_{V}, for three equations total. Using conductances G1=1SG_1 = 1\,\text{S} and G2=0.25SG_2 = 0.25\,\text{S}, the stamps assemble into:

[G1G11G1G1+G20100][V1V2jV]=[00Vs]\begin{bmatrix} G_1 & -G_1 & 1 \\ -G_1 & G_1 + G_2 & 0 \\ 1 & 0 & 0 \end{bmatrix} \begin{bmatrix} V_1 \\ V_2 \\ j_V \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ V_s \end{bmatrix}

The top-left 2×22\times 2 block is the GG matrix; the rightmost column is BB (the source enters node 1 with +1+1); the bottom row is C=BTC = B^{\mathsf T} enforcing V1=VsV_1 = V_s. Plugging in numbers:

[11111.250100][V1V2jV]=[005]\begin{bmatrix} 1 & -1 & 1 \\ -1 & 1.25 & 0 \\ 1 & 0 & 0 \end{bmatrix} \begin{bmatrix} V_1 \\ V_2 \\ j_V \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 5 \end{bmatrix}

The bottom row gives V1=5V_1 = 5 immediately. Row 2 then yields 5+1.25V2=0-5 + 1.25\,V_2 = 0, so V2=4VV_2 = 4\,\text{V}. Finally row 1 returns the source current jV=V2V1=1Aj_V = V_2 - V_1 = -1\,\text{A}. The negative sign reflects the chosen reference direction: the source actually delivers 1A1\,\text{A} into the network, which matches (V1V2)/R1=(54)/1=1A(V_1 - V_2)/R_1 = (5-4)/1 = 1\,\text{A} flowing through R1R_1. The complete solution is V1=5VV_1 = 5\,\text{V}, V2=4VV_2 = 4\,\text{V}, jV=1Aj_V = -1\,\text{A}.

Reading the Solved System

One feature that makes MNA so practical is that the answer vector hands you more than just node voltages. The current variables jj that were introduced to handle voltage sources are genuine unknowns in the solution, so the source currents fall out directly — no separate post-processing step is required to find how much current each voltage source delivers. In the worked example the solver returned jVj_V alongside the node voltages in a single solve. This is a real advantage over plain nodal analysis with supernodes, where the source current has to be recovered afterward by writing an extra KCL equation. In a large simulation, that bookkeeping difference compounds across thousands of elements.

It also explains why MNA matrices are not always symmetric. A network of resistors and independent voltage sources produces a symmetric AA because C=BTC = B^{\mathsf T}. The moment you add a dependent source — the kind that appears in every transistor small-signal model — the controlling relationship populates rows that are no longer the transpose of the corresponding columns, and the symmetry is deliberately broken. Far from being a defect, that asymmetry is how the matrix records the directional nature of controlled sources, where the controlling port and the controlled port play different roles.

Frequency Domain and Why Solvers Love MNA

Replacing conductances with admittances Y(s)Y(s) turns the same machinery into an AC or transient solver. A capacitor stamps sCsC and an inductor stamps 1/(sL)1/(sL) exactly where a resistor would stamp 1/R1/R. The matrix entries become functions of ss, and solving symbolically produces a transfer function. Because the structure never changes — only the stamps' contents do — one code path handles DC, AC, and symbolic analysis. That uniformity, plus the natural sparsity inherited from the circuit graph, is the reason MNA dominates real solver implementations.

Common Mistakes

  1. Treating the source-current row as a KCL equation. The bottom CC rows are constraint equations (VpVq=VsV_p - V_q = V_s), not current balances. Confusing them produces a singular matrix.
  2. Including the ground node in the matrix. The reference node is removed; its row and column are deleted. Keeping it leaves the system rank-deficient.
  3. Wrong sign in the BB column. The +1+1 goes on the source's positive terminal and 1-1 on the negative. Swapping them flips the computed source current.
  4. Forgetting that controlled sources fill DD. A current-controlled source couples one current variable to another, producing nonzero DD entries and breaking symmetry — that is expected, not an error.

Related Tutorials

Related Tutorials

Analysis Methods

Nodal Analysis Step by Step

A complete guide to nodal analysis: identify nodes, choose a ground, write KCL equations, handle voltage sources with supernodes, and solve.

Analysis Methods

Mesh Analysis Step by Step

Master mesh analysis: define mesh currents, write KVL equations, handle current sources with supermeshes, and solve a complete example.

Analysis Methods

Transfer Functions in Circuit Analysis

Learn what H(s) represents, how to derive transfer functions from nodal analysis, identify poles and zeros, and work through an RC example.

Back to All Tutorials