Kirchoff 's Current Law with Matrices

download notebookDownload this example as a Mathematica notebook.

Solving a Simple KCL Equation

Using Matrix Methods solve for loop currents [Graphics:Images/kcl_gr_1.gif] in the network in thefigure.  (Dr. M. Fogiel, Director, Staff of Research and Education Association, The Electric Circuits Problem Solver, Problem 3.23). 
(Figure drawn using Quickroute 4.0) [Graphics:Images/kcl_gr_2.gif] 

Since there are four loops in the network, we can write four loop equations.  Starting from the left side and going counterclockwise, the equations are as shown below. 

In[1]:=  l1={1.5==5.11i1 - 0.71i2 - 3.25i4} 
Out[1]= {1.5==-0.71i2 - 3.25i4 + 5.11i1} 

In[2]:=l2 = {-1.3 == -0.71i1 + 1.86i2 - 0.92i3
Out[2]={-1.3 == 1.86i2 - 0.92i- 0.23i4 
0.71i1 }
To write the above notations in matrix form, you can either enter them as lists of lists or use the Mathematica Basic Input palettes. For arbitrary size matrix you can use the Input pull-down menu. 

The above output gives the result of the matrix as a lists of lists.  In solving for these matrices, the elimination needed to reduce the matrix can be done automatically. 

In[4]:=Solve[eqnL, {i1, i2, i3, i4}] 

Out[4]= {{i1->-2.04437, i2->-4.25588, i3->-4.92696, i4->-2.74617 

Solving for this type of matrix would be very tedious to do by hand and might lead to a lot of errors. But as shown, the result was obtained very simply using the Mathematica function Solve in one single line of code, plus results are given to a specified number of significant figures.  This was another simple example that  undergraduates may encounter in an introductory course in circuit analysis. It teaches the students the basic concepts in analyzing circuits.