The following text is broken into several sections. Most are simply explanatory. You may skip directly to SCAM, a MATLAB® tool for deriving and solving circuit equations symbolically if you are not interested in the theory.

Solving a set of equations that represents a circuit is straightforward, if not always easy. However, developing that set of equations is not so easy. The two commonly taught methods for forming a set of equations are the node voltage (or nodal) method and the loop-current (or mesh) method. I will briefly describe each of these, and mention their benefits and disadvantages. If you are interested in a more thorough introduction to these methods, I suggest that you do a web search for an appropriate tutorial. I will end with a discussion of a third method, Modified Nodal Analysis, that has some unique benefits. Among its benefits is the fact that it lends itself to algorithmic solution -- the ultimate goal of these pages is to describe how to use a MATLAB program for generating a set of equations representing the circuit that can be solved symbolically. If you are only interested in using that program you may go directly to the page using the tabs above.

Circuits discussed herein are simple resistive circuits with independent voltage and current sources. Dependent sources can be added in a straightforward way, but are not considered here.

To apply the node voltage method to a circuit with *n* nodes (with *m* voltage sources), perform the following steps (after Rizzoni).

- Selective a reference node (usually ground).
- Name the remaining n-1 nodes and label a current through each passive element and each current source.
- Apply Kirchoff's current law to each node
*not*connected to a voltage source. - Solve the system of
*n-1-m*unknown voltages.

Consider the circuit shown below

Steps 1 and 2 have already been applied. To apply step 3:

\[\eqalign{ i_1 + i_2 &= i_3 \\ i_1 &= \frac{v_a - v_b}{R_1},\quad i_2 = \frac{v_c - v_b}{R_2},\quad i_3 = \frac{v_b}{R_3} \\ {v_a} &= V_1,\quad {v_c} = V_2 \\ &so \\ \frac{v_a - v_b}{R_1} + \frac{v_c - v_b}{R_2} &= \frac{v_b}{R_3} \\ \frac{V_1 - v_b}{R_1} + \frac{V_2 - v_b}{R_2} &= \frac{v_b}{R_3} } \]

In this case there is only one unknown; plugging in
numbers and solving the circuit we get $v_b = 24$.

The node-voltage method is generally straightforward to apply, but becomes a bit more difficult if one or more of the voltage sources is not grounded.

Consider the circuit shown below.

Clearly this circuit is the same as the one shown above, with
V1 and R_{1} interchanged. Now we write the equations:

The difficulty arises because the voltage source V_{1} is no longer
identical to one of the node voltages. Instead we have

Note that the last line is the same as that from the previous circuit, but to
solve the circuit we had to first solve for v_{a}. This procedure
wasn't difficult, but required a little cleverness, and will be a bit different
for each circuit layout. Another way to handle this problem is to use the
concept of a supernode, which complicates the rules for setting up the equations
(DeCarlo/Lin). However, the supernode concept handles the case of a non-grounded voltage source
without any need for solving intermediate equations, as we did here.

The examples chosen here were simple but illustrated the basic techniques of nodal analysis. It also illustrated one of the difficulties with the technique, setting up equations with a floating voltage source. The technique of modified nodal analysis, introduced later, also has no difficulties when presented with floating voltage sources.

The mesh current method is, not surprisingly, similar to the node voltage method. We will define a "mesh" as an open "window" in the schematic drawing. Note that this method requires some modification to work with "non-planar" circuits (non-planar circuits are those that cannot be drawn without wires that cross each other without touching). The rules below follow those in Rizzoni.

To apply the loop current method to a circuit with *n* meshes (and with *m* current sources), perform the following steps.

- Define each mesh and its corresponding current. This is easiest with a consistent method, e.g. all unknown currents are clockwise, all know currents follow direction on current source.
- Apply Kirchoff's voltage law to each loop
*not*containing a current source. - Solve the system of
*n-m*unknown voltages.

Consider the circuit from Example 1, with mesh currents defined.

We can apply KVL to both loops

\[\eqalign{ V_1 - {i_1}{R_1} - \left( {i_1 - i_2} \right){R_3} &= 0 \\ \left( {i_1 - i_2} \right){R_3} - {i_2}{R_2} - V_2 &= 0 \\ } \]Since there are two equations and two unknowns we can solve by substitution or by matrix methods. To solve by matrix methods we rewrite the equations

\[\eqalign{ \left( {R_1 + R_3} \right){i_1} - {R_3}{i_2} &= V_1 \\ - {R_3}{i_1} + \left( {R_2 + R_3} \right){i_2} &= V_2 \\ or \\ \left[ {\begin{array}{*{20}{c}} {\left( {R_1 + R_3} \right)}&{ -R_3} \\ { - R_3}&{\left( {R_2 + R_3} \right)} \end{array}} \right]\left[ {\begin{array}{*{20}{c}} {i_1} \\ {i_2} \end{array}} \right] &= \left[ {\begin{array}{*{20}{c}} {V_1} \\ {V_2} \end{array}} \right] \\ } \]

Solving for the two unknown currents we get

\[i_1 = 4 \\ i_2 = 1\]While floating voltage sources tended to complicate the formulation of circuit equations when using the node voltage method, neither the presence of current sources or voltage sources complicates the loop current method.

The choice between the node voltage method and the loop current method is often made on the basis of the circuit at hand. For the example chosen, there was only one independent node but two independent loops. Therefore the node voltage method would be expected to be easier. The situation shown below is the opposite, with two nodes, but only one loop; hence the loop current method is preferable.

For this circuit you would draw three loops, but two of them go through known current sources - so you would only need one equation. Nodal analysis would require two equations, one each for the voltage on each side of R3.

The next document introduces a modified nodal analysis (MNA) method that is amenable to computer solution.

© Copyright 2005 to 2019 Erik Cheever This page may be freely used for educational purposes.

Erik Cheever Department of Engineering Swarthmore College