Kirchoff 's Voltage Law

download notebookDownload this example as a Mathematica notebook.

A circuit contains six nodes lettered A, B, C, D, E, and F. Let [Graphics:Images/kvl_gr_1.gif] be the voltage between nodes A and B with its positive reference at the first named node, here A. Find [Graphics:Images/kvl_gr_2.gif][Graphics:Images/kvl_gr_3.gif], and [Graphics:Images/kvl_gr_4.gif] if [Graphics:Images/kvl_gr_5.gif]=6V, [Graphics:Images/kvl_gr_6.gif]=-3V, [Graphics:Images/kvl_gr_7.gif]=-8V, [Graphics:Images/kvl_gr_8.gif]=4V, and  (a) [Graphics:Images/kvl_gr_9.gif]=1V  (b) [Graphics:Images/kvl_gr_10.gif]=1V [Graphics:Images/kvl_gr_11.gif]= 4V. (Dr. M Fogiel, Director, Staff of Research and Education Association, The Electric Circuits Problem Solver Problem 1.19.) (The figure was drawn using Quickroute 4.0.) 

[Graphics:Images/kvl_gr_12.gif] 
In order to find the voltages in the question, you need to write a KVL (Kirchoff's Voltage Law) equation around the loop which contains the unknown voltages. Mathematica can be used to simplify the equations and solve for the unknowns.  The expressions for each element are written in a list as shown below.  

In[1]:=eqn1={VAC==VAB+VBD+VDE+VEC,VAB==6V, VBD==-3V, VEC==4V, VDE==1V} 

Out[1]=[Graphics:Images/kvl_gr_15.gif] 

In[2]:= Solve[eqn1, VAC]  
Out[2]=[Graphics:Images/kvl_gr_17.gif] 

In the above equation we employ the Mathematica function Solve to reduce the equation, solving for the unknown component, [Graphics:Images/kvl_gr_18.gif].The double equal sign (==) represents a symbolic equation;  it tests whether the left-hand side (lhs) of the equation is equal to the right-hand side of the equation (rhs), and does not cause an explicit action. 

In[3]:= eqn2={VAD==VAB+VBD, VAB==6V, VBD==-3V}  

Out[3]=[Graphics:Images/kvl_gr_20.gif]  

In[4]:= v2=Solve[eqn2,VAD]  

Out4]= [Graphics:Images/kvl_gr_22.gif]  

In[5]:=eqn3={VAE==VBD+VDE,VAB==6V, VBD==-3V, VDE==1V}  
  

Out[5]=[Graphics:Images/kvl_gr_24.gif]  

In[6]:= v3 = Solve[eqn3, VAE]  
Out[6]=[Graphics:Images/kvl_gr_26.gif]  

In[7]:= eqn4={VAF==VAB+VBD+VDE+VEC+VCF, VAB==6V, VBD==-3V, VDE==1V, VEC==4V, VCF==-8V}  
Out[7]=[Graphics:Images/kvl_gr_28.gif]  

In[8]:= v4=Solve[eqn4, VAF]  
Out[8]=[Graphics:Images/kvl_gr_30.gif]  

It is possible to do all of the above in just a few less steps, again using the function Solve to obtain results for simultaneous equations, as shown in the following: 

In[9]:= eqn1= {VAC==VAB+VBD+VDE+VEC, VAD==VAB+VBD, VAE==VAB+VBD+VDE,VAF==VAB+VBD+VDE+VEC+VCF,VAB==6V, VBD==-3V, VEC==4V, VDE==1V}  

Out[9]={VAC==VAB+VBD+VDE+VEC, VAD==VAB+VBD, VAE==VAB+VBD+VDE,VAF==VAB+VBD+VDE+VEC+VCF,VAB==6V, VBD==-3V, VEC==4V, VDE==1V}  

In[10]:= Solve[eqn1, {VAC, VAD, VAE, VAF}]  

Out[10]=[Graphics:Images/kvl_gr_34.gif]  

The answer is given in the form of a Mathematica rule, these rules are useful in substituting answers into other expressions.  The Mathematica function N can be used to obtain the numerical values for the expressions,  and the Out[%]function  is a global object that is assigned to be the value produced on the n[Graphics:Images/kvl_gr_35.gif] (last) output line.   

In[11]:= N[%]  
Out[11]=[Graphics:Images/kvl_gr_37.gif]