-
Let's do this example of Kirchhoff's law.
-
We've got a circuit here that we're going
to first define all of our unknowns.
-
We'd like to find all
the currents in this circuit.
-
So here is the first current, I1.
-
Here is the second current, I2.
-
The third current, I3.
-
The fourth current, I4.
-
So the number of unknowns
that we have is N = 4.
-
I1, I2, I3, and I4.
-
How did I know which direction
to define these currents?
-
I didn't, I just guessed.
-
I typically guess left to right and
top to bottom.
-
Once I've guessed the direction of the
current though, I can write the polarity.
-
Where the plus goes on the tail of
the arrow and the minus goes on the tip.
-
Now that I have defined
the polarity of each of my arrows.
-
I need to be able to write four
equations for my four unknowns.
-
Lets begin by writing loop equations.
-
Here is loop number 1.
-
And what I am going to
do is start someplace,
-
here's where I am going
to choose to start.
-
As I move up through the loop,
-
I'm going to encounter minus,
plus, minus, and so on.
-
So -V1 + I1 R1 + I3 R3,
-
back to the same place, is equal to 0.
-
Now lets do another loop.
-
Each new loop has to pick up
some additional elements.
-
This loop is going to pick up R4 and V3.
-
So loop number 2, let's start in the same
place, and I'm going up through I3.
-
So it's -I3 R3 +
-
I4 R4- V3 is equal to 0.
-
Now let's do loop number 3.
-
I'm going to choose this loop, although
I certainly could also have done this
-
outside loop,
picking up all of the additional elements.
-
So loop number 3 is going to be,
let's start right here.
-
Let's go up through I4- I4 R4
-
+ I2 R2 + V2 is equal to 0.
-
Well, there's three equations for
my four unknowns, so
-
I need one additional equation.
-
Let's transfer over and
-
let's do a node equation now because
I've done all my possible loops.
-
I've picked up every element.
-
Well, here's a node.
-
That's an ordinary node.
-
That's not going to do me any
good in my equations, and
-
neither is this ordinary node.
-
Here's an extraordinary node,
however, this big red node,
-
and that's where I'm going
to do my current equation.
-
So what I'm going to do for
equation number four is I'm going to say,
-
all the currents coming in are equal
to all the currents going out.
-
Well, the current coming in as I1 and
the currents going out are I2, I3, and I4.
-
So here are my four equations for
four unknowns.
-
Now, let us convert these
to matrix equations.
-
So what I'm going to do, because I
have four equations and four unknowns.
-
I'm going to have a four by four
matrix equation where my unknowns I1,
-
I2, I3 and I4 are in this vector.
-
My matrix is gonna be right here, and
-
of course my constants
are gonna be on the other side.
-
For my convenience, I'm going to also
write my unknowns across the top so
-
that I can keep track of which
column I'm putting things in.
-
And I'm going to indicate which of
the equations make up each of my rows.
-
Now what I'm going to do,
is I'm going to look at my first row and
-
I'm going to see what's multiplied by I1,
which is R1.
-
What's multiplied by I2?
-
0.
-
What's multiplied by I3?
-
R3.
-
What's multiplied by R4?
-
0.
-
And then what would be on
the other side would be plus V1.
-
Now let's do equation two.
-
What's multiplied by I1?
-
0.
-
I2?
-
0.
-
13 and I4?
-
And then this needs to come
over to the other side.
-
Now let's do this equation.
-
What's multiplied by I1?
-
0.
-
I2, I3, and I4?
-
And then my constant coming over
to this side is a minus V2.
-
Now let's do our last equation.
-
I'm going to bring this over here so
-
I'll actually be programming
-I1 + I2 + I3 + I4.
-
So a -1 here, 1, 1, 1, and 0,
there's my matrix equation.
-
This equation is A x = b.
-
What I can do is solve this equation any
of three ways check out your appendix.
-
You can solve it out.
-
You can solve it by hand,
that's a lot of work.
-
You can put it in your calculator,
please practice that.
-
And you can also put it in Matlab.