# Solving for loop (mesh) curents.

#### project_science

Joined Sep 14, 2018
21
Hi,

I’m got a circuit that I need help with solving for the currents. I’ve used mesh analysis, and I can get the driving current, “I”, to the circuit. However, I cannot seem to correctly solve for the loop currents. I believe I’ve set up the equations correctly using KVL. However, when I try to solve in MATLAB, the loop currents don’t sum to the driving current.

Perhaps someone can find where my error(s)?

Thanks!

#### Attachments

• 420.2 KB Views: 13

#### WBahn

Joined Mar 31, 2012
26,321
You aren't using mesh currents at all. Your I, i1, and i2 are branch currents.

If i1 and i2 are mesh currents, then they are currents that are circulating around the entire mesh they are associated with. So your total current is equal to i1 and the current flowing downward in the 2 kΩ resistor is i1 - i2 because that resistor is shared by both meshes and so both mesh currents flow in it.

To show that i1 and i2 are mesh currents, it is traditional to show them as a circular current (drawn as a circle with a segment -- perhaps 90° -- missing and an arrow head showing the direction of circulation and then the label in the center of the circular arc.

Your loop equations are fine, but then it goes downhill from there. Your loop equations have THREE unknowns -- I, i1, and i2. So you need three equations to solve for them. The third equation is the KCL equation you have at the top, namely I=i1+i2. In setting up your matrix, you have 5 - I(1000) and somehow that magically turns into 3.0435. But you don't know that I = 1.96 mA at this point (if you do, then there is not point to setting up the loop equations to find i1 and i2 because you can solve for them much more easily from the original circuit by noting that the voltage across the 2 kΩ resistor is 3.04 V.

Finally, in your matrix equation to solve for X, if

A x = b

Don't you need

(A^-1) (A) x = (A^-1) x

Note that inverse(AB) is not the same as inverse(A)B.

#### project_science

Joined Sep 14, 2018
21
Hi WBahn,

Thank you for taking the time to answer my question and help with the problem. Because of your help, I’ve noticed a few errors I’ve made. I’ve updated my mesh analysis technique to now only include mesh currents, i1 and i2, as the updated (and abbreviated) image shows.

My loop equations were updated to remove the “I” from loop 1 in my original post, as well as to satisfy the currents across the middle 2k resistor, which are reflect in the updated image.

I also made an error on my MATLAB code, which has been corrected in the updated image.

However, when I solve for i1 and i2, they don’t appear to be correct. (Or am I wrong?)

As a side note, as you mentioned in my original post that I “magically” got the value of “I”. I actually solved for “I” by circuit reduction, as shown in the 4th circuit diagram in the original post.

However, I may have confused myself here, but I thought I was on the right path following your observations. When I add i1 + i2, it doesn’t equal 1.96mA (this is “I”, which I solved for in the original post by circuit reduction), but when rounded, they ARE equal. Or did I get that wrong?

Really looking forward to getting this correct soon!

#### Attachments

• 549.5 KB Views: 4