7.1 Mesh Analysis

LEARNING OBJECTIVES


By the end of the section, you will be able to:
  • Write simultaneous linear equations in matrix form
  • Apply techniques of linear algebra to solve for current vector
  • Solve linear circuits by advanced mesh analysis methods

Kirchhoff’s rules of circuit analysis—at any junction, the sum of incoming currents equals the sum of outgoing currents; and, the potential difference around a closed loop is zero—are the necessary and sufficient conditions for determining the current through each component of any linear circuit—that is, any circuit composed only of elements that respond linearly to changes in current or voltage (such as Resistors, Capacitors and Inductors). Thus, the problem-solving strategy you learned in Kirchhoff’s Rules is sufficient to analyse any such circuit. However, that approach is inefficient and its steps are prone to human error—problems we’d like to mitigate in particular when applying the basic principles of circuit analysis to more complex circuits.

The mesh analysis techniques you learn in this section will not necessarily advance your knowledge of the physics of electrical circuits. Rather, the objective of this section is to provide a simpler and more straightforward approach to the analysis of planar circuits (also known as “meshes”). By the end of this section, you will see that it is possible to determine the current in all branches of a circuit in two easy steps: read off the components of a vector \mathbf{V} and a matrix \mathbf{R} simply by observation; solve for the vector of mesh currents \mathbf{I}=\mathbf{R}^{-1}\mathbf{V}. But before this useful result can be realised, we must first explore a few nuanced points to explain why the technique works.

We begin by modifying the problem-solving strategy from Kirchhoff’s Rules, adding a few particular requirements and removing some unneeded steps.


Problem-Solving Strategy: Mesh Analysis

  1. Draw mesh current loops, ensuring:
    1. each loop is unique; and
    2. all circuit elements—voltage sources, resistors, capacitors, inductors, etc. and short circuits—are covered by at least one loop.
  2. Apply loop rule as described in Kirchhoff’s Rules (particularly with reference to Figure 6.3.5) and solve simultaneous equations.
  3. Add or subtract mesh currents in branches that are covered by multiple loops, depending on the direction of each loop and the sign of each current calculated in step 2.

Referring back to the problem-solving strategy described in Kirchhoff’s Rules, you should see that we have removed three steps and replaced them with step 3 here. Rather than defining arbitrary currents at each junction, then using the loop rule to eliminate some of the current variables, we now skip straight to defining current loops, apply the loop rule, and solve directly for each mesh current. Then, as these may turn out to be positive or negative depending on the direction of the loops chosen arbitrarily in step 1, we add or subtract values as appropriate in branches covered by multiple mesh currents to find the actual current through each.

The tradeoff results in a small complication in step 2, which effectively absorbs the junction rule into the way we must apply the loop rule. However, when dealt with in a consistent manner (as we will do here) this is a minor complication.

Let us compare approaches by revisiting the problem from Example 6.3.1.

EXAMPLE 7.1.1


Calculating Current by the Mesh Analysis Approach

Find the currents flowing in the circuit in Figure 7.1.1.

(Figure 7.1.1)   \begin{gather*}.\end{gather*}

Figure 7.1.1 This circuit is a combination of series and parallel configurations of resistors and voltage sources. Redrawn from Figure 6.3.11, with current loops drawn for the purpose of mesh analysis.

Strategy

Referring to the mesh analysis problem-solving strategy above:

  1. Note that the mesh currents I_1 and I_2:
    1. are unique (i.e. I_1\neq I_2), and
    2. pass through every circuit element.
  2. Applying the loop rule means adding all the voltage rises and drops around each loop and setting the sum equal to zero. For each voltage source, and for each resistor encountered by only one mesh current, this is a straightforward application of the rules given by the map in Figure 6.3.5. But when more than one mesh current passes through a resistor, as with R_3 in this example, in each loop equation we must account for the fact that each mesh current contributes to the potential difference. Thus, e.g. in the case of I_1, the potential difference at R_3 is written as -R_3(I_1-I_2) (there is a voltage drop across R_3 due to I_1 pointing in the direction of travel around loop I_1, and a voltage rise due to I_2 pointing opposite the direction of travel).
  3. After solving simultaneous equations, we may find that I_1 or I_2 is negative, which would indicate that our initial choice of direction was incorrect. In fact, we know from Example 6.3.1 that I_1 points in the right direction and I_2 points in the wrong direction. Thus, the actual current—as opposed to our arbitrarily-defined mesh currents—is to the right in both the top and bottom branches, and to the left in the centre branch of the circuit. The actual current in the centre branch will therefore have magnitude I_1-I_2.

Solution

Applying the loop rule yields the following two equations for the unknown mesh currents, I_1 and I_2:

    \begin{eqnarray*}I_1\,\mathrm{:}&~&V_1-R_4I_1-R_3(I_1-I_2)+V_2-R_1I_1=0.\\I_2\,\mathrm{:}&~&-V_2-R_3(I_2-I_1)-R_6I_2-R_5I_2-V_3-R_2I_2=0.\end{eqnarray*}

And rearranging terms, we find

(7.1.1)   \begin{equation*}\begin{array}{lrl}I_1\,\mathrm{:}&-V_1-V_2=&-(R_1+R_3+R_4)I_1+R_3I_2,\\~&-1.10~\mathrm{V}=&-(4~\Omega)I_1+(1~\Omega)I_2,\\~&~&~\\I_2\,\mathrm{:}&V_2+V_3=&R_3I_1-(R_2+R_3+R_5+R_6)I_2,\\~&2.90~\mathrm{V}=&(1~\Omega)I_1-(9~\Omega)I_2.\end{array}\end{equation*}

Solving (e.g. multiplying the second equation by 4, adding the result to the first and solving for I_2) yields the expected result for the two mesh currents:

    \[I_1=0.20~\mathrm{A},~~~I_2=-0.30~\mathrm{A}.\]

Thus, the current in the bottom branch of the circuit must be -I_2=0.30~\mathrm{A} to the right, the current in the top branch must be I_1=0.20~\mathrm{A} to the right, and the current in the centre branch must be I_1-I_2=0.50~\mathrm{A} to the left.

Significance

We have arrived at the same result as in Example 6.3.1. This is not surprising, as the approach taken here is in fact mathematically equivalent to our previous approach.

However, we have simplified things by skipping the steps of labelling nodes, defining currents into and out of each junction, and applying the junction rule. In doing so, we’ve reduced the number of simultaneous equations that need to be solved, by precisely the number resulting from application of the junction rule (in this case, we went from three equations to two).

Skipping steps as we have done resulted in the following complication: when applying the loop rule, for the resistor R_3 that is adjacent to both loops, we picked up a term -R_3(I_1-I_2) for the potential difference with respect to the I_1 loop, and a term -R_3(I_2-I_1) for the potential difference with respect to the I_2 loop. The reason for this is simple: we have absorbed application of the junction rule into our application of the loop rule—i.e. both of Kirchhoff’s rules still generally apply in our analysis, we’ve just adjusted our approach. Thus, instead of defining a third current I_3, applying the junction rule to obtain I_3=I_1-I_2, then substituting into our loop rule expressions, we skip right to applying the loop rule for each mesh current and solve the system of fewer equations with fewer unknown variables.

Matrix Operations for Linear Circuit Analysis: Cramer’s Rule

Any system of linear equations can be written in matrix form, and by doing so one is able to apply techniques of linear algebra to efficiently compute solutions. For example, the system of equations found in Equation 7.1.1 can be rewritten as

(7.1.2)   \begin{eqnarray*}\left(\begin{array}{c}-V_1-V_2\\V_2+V_3\end{array}\right)&=&\left(\begin{array}{cc}-(R_1+R_3+R_4)&R_3\\R_3&-(R_2+R_3+R_5+R_6)\end{array}\right)\left(\begin{array}{c}I_1\\I_2\end{array}\right)\\\Rightarrow\left(\begin{array}{c}-1.10~\mathrm{V}\\2.90~\mathrm{V}\end{array}\right)&=&\left(\begin{array}{cc}-4~\Omega&1~\Omega\\1~\Omega&-9~\Omega\end{array}\right)\left(\begin{array}{c}I_1\\I_2\end{array}\right)\end{eqnarray*}

In general, the system of equations for an n-loop circuit will have the form \mathbf{V}=\mathbf{RI}, where \mathbf{V} and \mathbf{I} are n-dimensional column vectors and \mathbf{R} is an n\times n-matrix. When \mathbf{V} and \mathbf{R} are known, the elements of \mathbf{I} can be computed explicitly through a formula discovered by Gabriel Cramer (1704-1752), known as Cramer’s rule:

(7.1.3)   \begin{equation*}\mathbf{I}_i=\frac{\mathrm{det}(\mathbf{R}_i)}{\mathrm{det}(\mathbf{R})},\end{equation*}

where \mathbf{I}_i is the i-th element of \mathbf{I} and \mathbf{R}_i is the matrix formed by replacing the i-th column of \mathbf{R} with \mathbf{V}.

EXAMPLE 7.1.2


Applying Cramer’s Rule

Calculate the solution to the problem in Example 7.1.1 using Cramer’s rule.

Strategy

Apply Cramer’s rule (Equation 7.1.3) to the matrices in Equation 7.1.2 to determine the values of I_1 and I_2.

Solution

    \[I_1=\frac{\mathrm{det}(\mathbf{R}_1)}{\mathrm{det}(\mathbf{R})}=\frac{\left|\begin{array}{cc}-1.10~\mathrm{V}&1~\Omega\\2.90~\mathrm{V}&-9~\Omega\end{array}\right|}{\left|\begin{array}{cc}-4~\Omega&1~\Omega\\1~\Omega&-9~\Omega\end{array}\right|}=\frac{9.90~\mathrm{V}\cdot\Omega-2.90~\mathrm{V}\cdot\Omega}{36~\Omega^2-1~\Omega^2}=0.20~\mathrm{A},\]

    \[I_2=\frac{\mathrm{det}(\mathbf{R}_2)}{\mathrm{det}(\mathbf{R})}=\frac{\left|\begin{array}{cc}-4~\Omega&-1.10~\mathrm{V}\\1~\Omega&2.90~\mathrm{V}\end{array}\right|}{\left|\begin{array}{cc}-4~\Omega&1~\Omega\\1~\Omega&-9~\Omega\end{array}\right|}=\frac{-11.6~\mathrm{V}\cdot\Omega+1.10~\mathrm{V}\cdot\Omega}{35~\Omega^2-1~\Omega^2}=-0.30~\mathrm{A}.\]

Significance

Cramer’s rule indeed yields our previous result. The main advantage of this approach is the straightforward application of a rule that always provides an explicit result. The only requirement is that the rules for defining mesh current loops stated in the above problem-solving strategy are followed. In contrast, if identical mesh current loops were defined, the rows of \mathbf{R} would not be linearly independent and \mathbf{R} will be singular; and if the chosen loops did not cover all circuit elements, important information would be missing and the result would be incorrect.

Cramer’s rule is a very handy rule, particularly for students in test-situations, or for engineers working in the field who do not have access to computers. However, Cramer’s rule is computationally very inefficient for systems of more than three equations, so is generally not very useful for solving circuits with more than three loops. In that case, computer programs like MATLAB that can quickly invert matrices are very useful, as you will see below.

A Procedure for Reading \mathbf{R} and \mathbf{V} Directly from the Circuit

When working with many systems of equations, writing out equations with many terms whose signs depend on repeated application of a few rules, and rearranging terms to write those equations in a particular form, human error can be difficult to avoid. A useful strategy for mitigating such errors is to find a consistent simplifying procedure. Indeed, as we will now see, a very useful pattern becomes apparent simply by always drawing mesh current loops that all point in the same direction.

To begin, let us revisit what happened when writing the R_3-terms in the loop equations of Example 7.1.1. For both loops, the potential difference at R_3 had the form -R_3(I_i-I_j), where I_i was the mesh current in the loop of interest and I_j was the adjacent mesh current. Indeed, in general when all the mesh current loops of a circuit are defined as pointing in the same direction—i.e. either clockwise or counterclockwise—the potential differences across all resistors R_k located between adjacent mesh current loops are -R_k(I_i-I_j), where I_i is the mesh current in the loop of interest and I_j is the adjacent mesh current.

This is already a useful observation for mesh analysis, as it leads to the following set of rules for writing loop equations. Note that these rules can be used only when mesh current loops are defined as all pointing in the same direction. In this case, for any mesh current loop I_i, the potential difference across every voltage source and resistor will be:

  1. V when I_i flows through voltage source V from negative to positive,
  2. -V when I_i flows through voltage source V from positive to negative,
  3. -R_lI_i when only I_i flows through resistor R_l, and
  4. -R_k(I_i-I_j) when I_i and an adjacent mesh current loop I_j both flow through R_k.

While this set of rules may be useful, it is just one step towards a more useful result we will now observe upon applying these rules to write down the matrix equations for a reasonably large, five loop-circuit in Example 7.1.3. Namely, through this example we will observe a general set of rules to follow for “reading” the \mathbf{V} and \mathbf{R} matrices directly from the circuit diagram.

EXAMPLE 7.1.3


Matrix Equation of a Five Loop-Circuit

Write down the \mathbf{R} and \mathbf{V}-matrices for the circuit in Figure 7.1.2.

(Figure 7.1.2)   \begin{gather*}.\end{gather*}

Figure 7.1.2 A five loop-circuit with current loops all drawn in the clockwise-direction.

Strategy

Write the five loop equations by applying the four rules above to each resistor and voltage source in the circuit. Subtract voltage terms from each side, and factor each current variable from up to five terms (one for each mesh current). Write the linear system of equations in matrix form.

Solution

The five mesh current loop equations are:

    \begin{eqnarray*}I_1\,\mathrm{:}&~&0=-V_1-R_1(I_1-I_2)-R_3(I_1-I_3)-R_4(I_1-I_4).\\I_2\,\mathrm{:}&~&0=-V_2-R_1(I_2-I_1)-R_2I_2.\\I_3\,\mathrm{:}&~&0=V_2-R_3(I_3-I_1)-R_5(I_3-I_5).\\I_4\,\mathrm{:}&~&0=V_3-R_4(I_4-I_1).\\I_5\,\mathrm{:}&~&0=-V_3-R_5(I_5-I_3).\end{eqnarray*}

Rearranging terms, we find

    \[\begin{array}{rccccc}V_1=&-(R_1+R_3+R_4)I_1&+R_1I_2&+R_3I_3&+R_4I_4&+0,\\V_2=&R_1I_1&-(R_1+R_2)I_2&+0&+0&+0,\\-V_2=&R_3I_1&+0&-(R_3+R_5)I_3&+0&+R_5I_5,\\-V_3=&R_4I_1&+0&+0&-R_4I_4&+0,\\V_3=&0&+0&+R_5I_3&+0&-R_5I_5.\end{array}\]

Therefore,

    \[\mathbf{V}=\left(\begin{array}{c}V_1\\V_2\\-V_2\\-V_3\\V_3\end{array}\right)\]

    \[\mathbf{R}=\left(\begin{array}{ccccc}-(R_1+R_3+R_4)&R_1&R_3&R_4&0\\R_1&-(R_1+R_2)&0&0&0\\R_3&0&-(R_3+R_5)&0&R_5\\R_4&0&0&-R_4&0\\0&0&R_5&0&-R_5\end{array}\right)\]

Significance

When rearranging terms in the second step, a term was added explicitly for each mesh current, including 0 for each term not actually part of the sum, in anticipation of the next step.

Note the following patterns in the \mathbf{R} and \mathbf{V} matrices:

  1. V_i is negative the sum of voltage rises and drops due to voltage sources around each mesh current loop I_i.
  2. R_{ii} is negative the sum of the resistances of the resistors around mesh current loop I_i.
  3. R_{ij} is the sum of resistances of the resistors through which any mesh current loop I_j adjacent to I_i also passes.

We need to be careful not to draw conclusions too generally, as these patterns do not necessarily follow from the general mesh analysis procedure. Rather, this particular pattern is the result of two additional steps taken here: (i) all current loops were defined as pointing in the same direction (i.e. clockwise), and (ii) when rearranging loop equations the variables due to voltage sources were moved to the left-hand side of each loop equation, thus writing each loop equation in the form “negative of voltage supplied around each loop equals sum of voltage drops across resistors.”

Neither step (i) nor (ii) is required for mesh analysis. For example, mesh current I_j is allowed to be defined as pointing in the other direction, in which case all terms in column R_{ij} would be multiplied by -1. Similarly, the equation for loop I_i could instead be rearranged in the form “voltage supplied around each loop equals negative the sum of voltage drops across resistors.” In this case, both V_i and row R_{ij} would be multiplied by -1.

Because of the differences that could exist in the signs of terms in V_i and R_{ij}, it should be clear that without a consistent approach to mesh analysis it is very easy to make sign errors. In contrast, by choosing one approach and sticking with it, we see at once a clear pattern, i.e. the above list of three points, for reading the terms of \mathbf{V} and \mathbf{R} directly from the circuit.

The significance of our final observation in Example 7.1.3 is a great simplification to the computational procedure of mesh analysis. However, these simplifying steps are not strictly necessary, as circuit analysis can proceed very well by following the steps developed in Kirchhoff’s Rules which are more closely associated with the physics of electrical circuits. For instance, we must be careful not to draw any physical significance from the description of two opposing mesh currents flowing through a circuit branch; at the macroscopic level, there is only one real current in each branch, which is the sum of all mesh currents there.

Therefore, rather than gaining any further physical insight, here we have developed a straightforward procedure to minimise the number of steps and the potential for human error in the analysis of planar circuits. This result is so useful that we restate it here explicitly.


PROCEDURE FOR READING \mathbf{R} AND \mathbf{V} DIRECTLY FROM THE CIRCUIT

  1. Draw one mesh current loop inside each loop of the circuit.
  2. Work your way around each loop I_i, reading off terms V_i and R_{ij} as follows:
    1. V_i is the sum -V_a-V_b-\ldots for each voltage source V_a, V_b,\ldots that I_i passes from negative to positive, and +V_m+V_n+\ldots for each voltage source V_m, V_n,\ldots that I_i passes through from positive to negative,
    2. R_{ii} is the sum -R_a-R_b-\ldots for each resistor R_a, R_b,\ldots that I_i passes, and
    3. R_{ij}, i\neq j is the sum +R_m+R_n+\ldots for each resistor R_m, R_n,\ldots passed by a loop I_j adjacent to I_i.

CHECK YOUR UNDERSTANDING 7.1


Apply the above procedure to read off the terms of \mathbf{R} and \mathbf{V} directly from the following circuits. Note that you can check your results (and demonstrate the great simplification afforded by the procedure just stated) by following the steps taken in Example 7.1.3.

With our mesh analysis methods now in hand, it is time for a final example demonstrating the most common application: read the circuit matrices directly from the circuit, and use a computer to solve for the mesh currents.

EXAMPLE 7.1.4


Complete Circuit Analysis in Two Steps with MATLAB

Calculate the currents through each of the resistors and voltage sources in the circuit of Figure 7.1.3, and use the results to find the power dissipated by all resistors and power supplied by all voltage sources.

(Figure 7.1.3)   \begin{gather*}.\end{gather*}

Figure 7.1.3 A four loop-circuit with given values of resistors and voltage sources. This is a redrawing of the circuit shown in Figure 7.0.1.

Strategy

Apply the procedure for reading \mathbf{R} and \mathbf{V} directly from the circuit. For simplicity, disregard units inside the matrices, noting that the mesh currents in \mathbf{I} will have units of amps. Use MATLAB to calculate \mathbf{I}. Add or subtract results as appropriate to find the actual currents through each component of the circuit. Calculate power dissipated by resistors as I^2R and power supplied by voltage sources as IV.

Solution

    \[\mathbf{V}=\left(\begin{array}{c}V_1\\0\\-V_1+V_2\\-V_2\end{array}\right)=\left(\begin{array}{c}1\\0\\1\\-2\end{array}\right)\]

    \begin{eqnarray*}\mathbf{R}&\!\!\!=\!\!\!&\left(\begin{array}{cccc}-R_1&R_1&0&0\\R_1&-(R_1+R_2)&0&0\\0&0&-(R_3+R_4)&R_4\\0&0&R_4&-(R_4+R_5)\end{array}\right)\\&\!\!\!=\!\!\!&\left(\begin{array}{cccc}-1&1&0&0\\1&-3&0&0\\0&0&-8&5\\0&0&5&-12\end{array}\right).\end{eqnarray*}

Figure 7.1.3 shows the MATLAB code and output solution for \mathbf{I}.

(Figure 7.1.4)   \begin{gather*}.\end{gather*}

Figure 7.1.4 MATLAB code and output for Example 7.1.4 calculations.

The components of \mathbf{I} can be used to compute the current through each component of the circuit. Thus, we find:

  • I_{R_1}=1.000~\mathrm{A} to the right,
  • I_{R_2}=0.5000~\mathrm{A} upward,
  • I_{R_3}=0.0282~\mathrm{A} to the right,
  • I_{R_4}=I_{V_2}=0.1831~\mathrm{A} upward,
  • I_{R_5}=0.1549~\mathrm{A} downward,
  • I_{V_1}=1.4718~\mathrm{A} upward.

The power supplied by the voltage sources is

    \[P_{\mathrm{supplied}}=\sum_iI_{V_i}V_i=1.4718~\mathrm{W}+0.3662~\mathrm{W}=1.8380~\mathrm{W},\]

and the power dissipated over the resistors is

    \begin{eqnarray*}P_{\mathrm{dissipated}}&=&\sum_iI_{R_i}^2R_i\\&=&1.000~\mathrm{W}+0.5000~\mathrm{W}+0.0024~\mathrm{W}+0.1676~\mathrm{W}+0.1680~\mathrm{W}\\&=&1.8380~\mathrm{W}\end{eqnarray*}

Significance

By following the steps of mesh analysis developed in this section, analysis of planar circuits is straightforward. For two- and three-loop circuits, Cramer’s rule provides a quick means to calculate \mathbf{I} by hand; for circuits with four loops or more, it is best to use a computer to quickly calculate \mathbf{R}^{-1}.

License

Icon for the Creative Commons Attribution 4.0 International License

Introduction to Electricity, Magnetism, and Circuits Copyright © 2018 by Daryl Janzen is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.