1 00:00:01,760 --> 00:00:04,170 Let's do this example of Kirchhoff's law. 2 00:00:04,170 --> 00:00:08,220 We've got a circuit here that we're going to first define all of our unknowns. 3 00:00:08,220 --> 00:00:10,700 We'd like to find all the currents in this circuit. 4 00:00:10,700 --> 00:00:14,172 So here is the first current, I1. 5 00:00:14,172 --> 00:00:17,190 Here is the second current, I2. 6 00:00:17,190 --> 00:00:19,753 The third current, I3. 7 00:00:19,753 --> 00:00:22,221 The fourth current, I4. 8 00:00:22,221 --> 00:00:25,980 So the number of unknowns that we have is N = 4. 9 00:00:25,980 --> 00:00:30,084 I1, I2, I3, and I4. 10 00:00:30,084 --> 00:00:32,740 How did I know which direction to define these currents? 11 00:00:32,740 --> 00:00:34,460 I didn't, I just guessed. 12 00:00:34,460 --> 00:00:37,648 I typically guess left to right and top to bottom. 13 00:00:37,648 --> 00:00:41,504 Once I've guessed the direction of the current though, I can write the polarity. 14 00:00:41,504 --> 00:00:46,268 Where the plus goes on the tail of the arrow and the minus goes on the tip. 15 00:00:46,268 --> 00:00:49,470 Now that I have defined the polarity of each of my arrows. 16 00:00:49,470 --> 00:00:53,200 I need to be able to write four equations for my four unknowns. 17 00:00:53,200 --> 00:00:55,510 Lets begin by writing loop equations. 18 00:00:55,510 --> 00:00:56,625 Here is loop number 1. 19 00:00:57,695 --> 00:00:59,475 And what I am going to do is start someplace, 20 00:00:59,475 --> 00:01:01,210 here's where I am going to choose to start. 21 00:01:01,210 --> 00:01:03,655 As I move up through the loop, 22 00:01:03,655 --> 00:01:08,820 I'm going to encounter minus, plus, minus, and so on. 23 00:01:08,820 --> 00:01:12,610 So -V1 + I1 R1 + I3 R3, 24 00:01:12,610 --> 00:01:18,480 back to the same place, is equal to 0. 25 00:01:18,480 --> 00:01:19,622 Now lets do another loop. 26 00:01:19,622 --> 00:01:22,785 Each new loop has to pick up some additional elements. 27 00:01:22,785 --> 00:01:26,045 This loop is going to pick up R4 and V3. 28 00:01:26,045 --> 00:01:30,804 So loop number 2, let's start in the same place, and I'm going up through I3. 29 00:01:30,804 --> 00:01:34,891 So it's -I3 R3 + 30 00:01:34,891 --> 00:01:40,667 I4 R4- V3 is equal to 0. 31 00:01:40,667 --> 00:01:42,486 Now let's do loop number 3. 32 00:01:42,486 --> 00:01:46,351 I'm going to choose this loop, although I certainly could also have done this 33 00:01:46,351 --> 00:01:49,610 outside loop, picking up all of the additional elements. 34 00:01:49,610 --> 00:01:53,760 So loop number 3 is going to be, let's start right here. 35 00:01:53,760 --> 00:01:58,621 Let's go up through I4- I4 R4 36 00:01:58,621 --> 00:02:03,139 + I2 R2 + V2 is equal to 0. 37 00:02:03,139 --> 00:02:05,770 Well, there's three equations for my four unknowns, so 38 00:02:05,770 --> 00:02:07,700 I need one additional equation. 39 00:02:07,700 --> 00:02:09,340 Let's transfer over and 40 00:02:09,340 --> 00:02:13,060 let's do a node equation now because I've done all my possible loops. 41 00:02:13,060 --> 00:02:14,960 I've picked up every element. 42 00:02:14,960 --> 00:02:16,570 Well, here's a node. 43 00:02:16,570 --> 00:02:17,606 That's an ordinary node. 44 00:02:17,606 --> 00:02:20,002 That's not going to do me any good in my equations, and 45 00:02:20,002 --> 00:02:22,070 neither is this ordinary node. 46 00:02:22,070 --> 00:02:25,140 Here's an extraordinary node, however, this big red node, 47 00:02:25,140 --> 00:02:27,780 and that's where I'm going to do my current equation. 48 00:02:27,780 --> 00:02:31,420 So what I'm going to do for equation number four is I'm going to say, 49 00:02:31,420 --> 00:02:35,430 all the currents coming in are equal to all the currents going out. 50 00:02:35,430 --> 00:02:42,997 Well, the current coming in as I1 and the currents going out are I2, I3, and I4. 51 00:02:42,997 --> 00:02:46,100 So here are my four equations for four unknowns. 52 00:02:46,100 --> 00:02:49,095 Now, let us convert these to matrix equations. 53 00:02:49,095 --> 00:02:52,425 So what I'm going to do, because I have four equations and four unknowns. 54 00:02:52,425 --> 00:02:57,543 I'm going to have a four by four matrix equation where my unknowns I1, 55 00:02:57,543 --> 00:03:02,370 I2, I3 and I4 are in this vector. 56 00:03:03,640 --> 00:03:05,850 My matrix is gonna be right here, and 57 00:03:05,850 --> 00:03:08,430 of course my constants are gonna be on the other side. 58 00:03:08,430 --> 00:03:13,290 For my convenience, I'm going to also write my unknowns across the top so 59 00:03:13,290 --> 00:03:16,100 that I can keep track of which column I'm putting things in. 60 00:03:16,100 --> 00:03:20,570 And I'm going to indicate which of the equations make up each of my rows. 61 00:03:20,570 --> 00:03:24,090 Now what I'm going to do, is I'm going to look at my first row and 62 00:03:24,090 --> 00:03:28,280 I'm going to see what's multiplied by I1, which is R1. 63 00:03:28,280 --> 00:03:29,950 What's multiplied by I2? 64 00:03:29,950 --> 00:03:30,636 0. 65 00:03:30,636 --> 00:03:32,993 What's multiplied by I3? 66 00:03:32,993 --> 00:03:33,744 R3. 67 00:03:33,744 --> 00:03:35,344 What's multiplied by R4? 68 00:03:35,344 --> 00:03:36,055 0. 69 00:03:36,055 --> 00:03:40,974 And then what would be on the other side would be plus V1. 70 00:03:40,974 --> 00:03:42,417 Now let's do equation two. 71 00:03:42,417 --> 00:03:43,958 What's multiplied by I1? 72 00:03:43,958 --> 00:03:44,575 0. 73 00:03:44,575 --> 00:03:45,260 I2? 74 00:03:45,260 --> 00:03:46,093 0. 75 00:03:46,093 --> 00:03:48,794 13 and I4? 76 00:03:48,794 --> 00:03:51,590 And then this needs to come over to the other side. 77 00:03:52,920 --> 00:03:54,070 Now let's do this equation. 78 00:03:54,070 --> 00:03:55,485 What's multiplied by I1? 79 00:03:55,485 --> 00:03:56,620 0. 80 00:03:56,620 --> 00:04:00,030 I2, I3, and I4? 81 00:04:00,030 --> 00:04:04,560 And then my constant coming over to this side is a minus V2. 82 00:04:04,560 --> 00:04:05,980 Now let's do our last equation. 83 00:04:05,980 --> 00:04:09,466 I'm going to bring this over here so 84 00:04:09,466 --> 00:04:15,054 I'll actually be programming -I1 + I2 + I3 + I4. 85 00:04:15,054 --> 00:04:20,510 So a -1 here, 1, 1, 1, and 0, there's my matrix equation. 86 00:04:20,510 --> 00:04:24,589 This equation is A x = b. 87 00:04:24,589 --> 00:04:28,690 What I can do is solve this equation any of three ways check out your appendix. 88 00:04:28,690 --> 00:04:29,670 You can solve it out. 89 00:04:29,670 --> 00:04:32,090 You can solve it by hand, that's a lot of work. 90 00:04:32,090 --> 00:04:34,720 You can put it in your calculator, please practice that. 91 00:04:34,720 --> 00:04:36,150 And you can also put it in Matlab.