In this appendix, we will explain how to analyze general electrical circuits consisting of passive elements (resistors, capacitors, inductors) and independent sources (voltage and current sources). The methods we describe here are systematic approaches that can be applied to any circuit, regardless of its complexity. We will write out equations in matrix form, which is convenient for computer implementation and analysis. We also assume everything is in the Laplace domain, so all variables are functions of s.
The two prevalent approaches are nodal analysis and loop/mesh analysis. These are dual approaches, meaning that they are based on the same principles but focus on different variables. There is also a nice symmetry between them, which will become apparent through the form of the equations. Nodal analysis focuses on node voltages, while loop analysis focuses on loop currents.
We will assume the circuit contains n nodes and b branches.
There are three different types of variables that show up in nodal analysis:
Node voltages. The electric potential at each node in the circuit. Since voltage is a relative quantity, we choose one node to be the reference node (ground) and measure all other node voltages relative to this point. So there are n−1 unknown node voltages. We call the node voltages Vn.
Branch voltages. The voltage drop across each branch (circuit element). We call the branch voltages across passive elements V, across voltage sources Vv (which are known), and across current sources Vi. There is a total of b branch voltages.
Branch currents. The current flowing through each branch (circuit element). We call the branch currents through passive elements I, through voltage sources Iv, and through current sources Ii (which are known). There is a total of b branch currents.
We use three types of equations to relate these variables to each other.
Constitutive equations. These relate branch voltages to branch currents for each passive circuit element. Written in terms of a diagonal admittance matrix Y (the inverse of the impedance matrix Z), we have
Node-to-branch relationships. These relate node voltages to branch voltages. Each branch voltage can be expressed as the difference between the node voltages at its two terminals. Written in matrix form using the incidence matrices A, Av, and Ai (which describe how branches connect to nodes), we have
Kirchhoff’s Current Law (KCL). This states that the algebraic sum of currents exiting each node is zero. This is a statement of conservation of electric charge, and is a relationship between branch currents. Written in matrix form using the same incidence matrices A, Av, and Ai, we have
We solve this system of equations for Vn and Iv. Note that the right-hand side contains Ii and Vv, which are the known current source currents and voltage source voltages. Once we have Vn and Iv, we can back-substitute to find the remaining variables:
The system of equations (8) is the main result of nodal analysis. It’s a set of linear equations that can be solved using standard techniques (e.g., matrix inversion, LU decomposition, etc.) to find the unknown node voltages and voltage source currents. The matrix is square, and has dimension (n−1+bv)×(n−1+bv), where bv is the number of voltage sources in the circuit.
For a well-posed circuit this matrix is invertible and there is a unique solution. Otherwise, the circuit is ill-defined (e.g., contains contradictory sources).
In nodal analysis, we focused on node voltages as the primary unknowns. In loop analysis, we focus on loop currents as the primary unknowns. Loop currents are currents that circulate around loops of the circuit. There are many possible loops we can draw, but in general, we only need to consider a subset of them to fully describe the circuit. For a connected circuit with n nodes and b branches, the number of independent loops is
We can use any set of m independent loops for this analysis. Here, independent is meant in the linear algebra sense: no loop in the set can be expressed as a linear combination of the other loops. There are many possible choices of independent loops, but the two most common choices are “meshes” and “fundamental loops”.
A mesh is a loop that does not enclose any other loops. In planar circuits (circuits that can be drawn on a plane without crossing branches), meshes correspond to the faces of the graph formed by the circuit. Each mesh is bounded by branches, and the mesh current circulates around this boundary. This choice only works when the circuit is planar.
A fundamental loop is defined by a spanning tree of the circuit. A spanning tree is a subgraph that connects all the nodes without forming any loops. The branches not included in the spanning tree are called chords, and each chord defines a unique fundamental loop when added to the spanning tree. This choice works for any circuit, planar or not.
There are three different types of variables that show up in loop analysis:
Loop currents. The current circulating around each loop. We call the loop currents Im. There are a total of m loop currents.
Branch voltages. The voltage drop across each branch (circuit element). We call the branch voltages across passive elements V, across voltage sources Vv (which are known), and across current sources Vi. There is a total of b branch voltages.
Branch currents. The current flowing through each branch (circuit element). We call the branch currents through passive elements I, through voltage sources Iv, and through current sources Ii (which are known). There is a total of b branch currents.
We use three types of equations to relate these variables to each other.
Constitutive equations. These relate branch voltages to branch currents for each passive circuit element. Written in terms of a diagonal impedance matrix Z, we have
Mesh-to-branch relationships. These relate mesh currents to branch currents. Each branch current can be expressed as the sum of the mesh currents that pass through that branch. Written in matrix form using the loop incidence matrices B, Bv, and Bi (which describe how branches connect to loops), we have
Kirchhoff’s Voltage Law (KVL). This states that the algebraic sum of voltages around any closed loop in a circuit is zero. This is a statement of conservation of energy, and is a relationship between branch voltages. Written in matrix form using the same loop incidence matrices B, Bv, and Bi, we have
We solve this system of equations for Im and Vi. Note that the right-hand side contains Ii and Vv, which are the known current source currents and voltage source voltages. Once we have Im and Vi, we can back-substitute to find the remaining variables:
The system of equations (20) is the main result of loop analysis. It’s a set of linear equations that can be solved using standard techniques (e.g., matrix inversion, LU decomposition, etc.) to find the unknown loop currents and current source voltages. The matrix is square, and has dimension (m+bi)×(m+bi), where bi is the number of current sources in the circuit.
For a well-posed circuit this matrix is invertible and there is a unique solution.
Otherwise, the circuit is ill-defined (e.g., contains contradictory sources).
It’s clear from the above that nodal analysis and loop analysis are dual approaches. They are based on the same principles (KCL, KVL, constitutive equations, and incidence relationships), but they focus on different primary variables (node voltages vs. loop currents). The structure of the equations is very similar, with the main difference being the use of admittance matrices in nodal analysis and impedance matrices in loop analysis.
There is also a nice relationship between the incidence matrices used in each approach, which reflects the duality of the two methods.
From a computational standpoint, both methods are equally valid and lead to the same results. The choice between nodal and loop analysis often depends on the specific circuit being analyzed and personal preference. In terms of computational complexity, both methods typically result in solving a system of linear equations of similar size, so there is no significant difference in efficiency. However,
Nodal analysis requires solving (8), whose size is the number of nodes plus the number of voltage sources.
Loop analysis requires solving (20), whose size is the number of loops plus the number of current sources.
So, depending on the circuit topology and the number of sources of each type, one method may lead to a smaller system of equations than the other.
We will now solve a circuit using both nodal and loop analysis to illustrate the methods. As you will see, both methods are systematic and lead to the same final results, although might be error-prone for hand calculations on complex circuits.
Figure 1:Circuit with labeled nodes, meshes, and branches.
In the circuit above, we labeled nodes A,B,C,D and meshes a,b,c. We also have passive elements with impedances Zk (or admittance Yk=1/Zk) for k=1,…,5, one voltage source with voltage Vv (current Iv), and one current source with current Ii (voltage Vi). It is important in this method that branch voltages and currents be consistently defined; the current arrows always flow from + to − for voltages, so that a positive branch current flowing through a resistor would have a positive branch voltage.
The horizontal lines partition the matrices according to passive elements, voltage sources, and current sources.
We also have constitutive equations for the passive elements:
And that’s it! Equations (36), (37), (38) give the complete solution using loop analysis.
Let’s pick a variable at random and verify that both methods give the same answer. For example, let’s check branch voltage V4. We can start with the result from nodal analysis in Eq. (30), and substitute Zk=1/Yk:
Where in the last step we multiplied numerator and denominator by Z1Z2Z3Z4. This matches exactly the expression for V4 obtained from loop analysis in (38), confirming that both methods yield the same result.
We can also solve the circuit of Fig. Figure 1 using the alternative approach we described in the main text, which is a variant of the nodal method. This approach is more amenable to hand calculations, since it avoids the use of matrix algebra and is opportunistic: you only solve for what you need!
We start by writing constitutive equations for each passive branch and each voltage/current source directly in terms of node voltages and branch currents:
We can now take stock of our equations and variables. We have a total of 10 equations and 10 variables: VA,VB,VC,VD,I1,I2,I3,I4,I5,Iv. So we have a well-defined system that we can solve.
From here, we proceed differently depending on which variables we want to solve for.
If we care about node voltages, we would solve for each Ik in terms of VA,VB,VC,VD using (40), substitute into (41) to get equations only in terms of node voltages, and solve that system.
If we care about branch currents, we would eliminate the node voltages in (40) to obtain a reduced set of equations only involving currents. We would then augment our equations to include (41) and solve the resulting system.
In general, we can proceed systematically by eliminating each variable we don’t care about. This means (1) picking any equation that contains the variable, (2) rearranging it to solve for the variable, and (3) substituting the result into every other equation.
For example, if we didn’t care about I3, we could eliminate it by picking an equation that contains I3, say the KCL at junction C in (41). Rearranging gives: I3=I1−I4. Plugging this into every other equation that contains I3, our system of equations becomes:
We now have 9 equations and 9 variables: VA,VB,VC,VD,I1,I2,I4,I5,Iv. We can continue eliminating variables we don’t care about until we reach a system that only contains the variables of interest.
This approach can be efficient for hand calculations because we can pick the simplest equations when eliminating variables (to minimize algebra), and we only keep track of the variables we care about. However, it can also be error-prone if not done carefully, especially for complex circuits with many variables and equations.