# Circuit Theory/Simultaneous Equations/Example 4

Find everything. Solve with the source represented by the symbol $V_{s}$ and with the 100 ohm resistors represented by the symbol R and the 200 ohm resistors represented by the symbol 2R. Then solve numerically.

### Label

Looks like $V_{s}$ and a resistor are in series, and right most two resistors are in series, so they share the same currents.

### Loops

There are three loops. Remember that the + and - right now are not guessing the polarity of the answer, but are capturing the layout of the circuit.
There are no trivial loops (components in parallel).

### Junctions

There are two trivial junctions where series components share the same current. There are three non-trivial junctions which result in two junctions that can be used. The two choose to be used were at the top and labeled $J_{1}$ and $J_{2}$.

### Count Eq

We are being told that the resistor and voltage source have values, but to work towards a symbolic solution. But rather than the resistors all being a separate symbol, they are all have a value of R or 2R. So in terms of symbolic solutions, the goal is to use $R$ and $V_{s}$ to represent these "knowns."
$R=100ohms$ $V_{s}=1volt$ $V_{1}=?volt$ $V_{2}=?volt$ $V_{3}=?volt$ $V_{4}=?volt$ $V_{5}=?volt$ $V_{6}=?volt$ $i_{1}=?amp$ $i_{2}=?amps$ $i_{3}=?amps$ $i_{4}=?amps$ $i_{5}=?amp$
There are 11 unknowns. There are 6 equations from the resistors, 3 from the loops and 2 from the junctions. So the problem can be solved explicitly.

### Terminal Eq

$v_{1}=i_{1}*R$ $v_{2}=i_{2}*2R$ $v_{3}=i_{3}*R$ $v_{4}=i_{4}*2R$ $v_{5}=i_{5}*R$ $v_{6}=i_{5}*2R$

### Loop Eq

$L_{1}:v_{1}+v_{2}-V_{s}=0$ $L_{2}:v_{3}+v_{4}-V_{2}=0$ $L_{3}:v_{5}+v_{6}-V_{4}=0$

### Junction Eq

$J_{1}:i_{1}-i_{2}-i_{3}=0$ $J_{2}:i_{3}-i_{4}-i_{5}=0$

### Solve the Equations
#### Algebra

The algebra solution is massive, messy, hard to check and doesn't inspire anyone. Not going to attempt it.

#### Differential Equations

There are none in this problem, but three quarters of this course is going over circuits this complex with capacitors and inductors instead of resistors and looking at the differential equations.

#### Symbolic Computations
##### Wolfram Alpha

Wolfram Alpha doesn't work with more than 6 or 7 equations no matter what their form.

##### MuPad

MuPAD scaled up to 11 unknowns great. Cutting and pasting made the code typed (click on the link in the caption) much easier than it looks.

#### Numeric Solution

The goal is to do things at least two different ways, just to check work. Since not doing algebra, must create 11 by 11 matrix.
Steps to set up the solution:
* Substitute known values into the equations:
$v_{1}=i_{1}*100$ $v_{2}=i_{2}*200$ $v_{3}=i_{3}*100$ $v_{4}=i_{4}*200$ $v_{5}=i_{5}*100$ $v_{6}=i_{5}*200$ $v_{1}+v_{2}-1=0$ $v_{3}+v_{4}-v_{2}=0$ $v_{5}+v_{6}-v_{4}=0$ $i_{1}-i_{2}-i_{3}=0$ $i_{3}-i_{4}-i_{5}=0$
* Organize the equations so that unknowns are in columns, numbers to the right of the equal sign:
Skipping this section, going straight to the matrix. Typing 8 or 9 + 0 over and over again is silly.
* Create two matrices, one square and the other a column with the numbers that are on the right of the equal sign
The pattern has been established, the matrices are huge, repeating them over and over to show the matrix math is not necessary. Just writing the big matrix and going straight to MatLab.
* ${\begin{array}{|c|c|c|c|c|c|c|c|c|c|c||c|}i_{1}&i_{2}&i_{3}&i_{4}&i_{5}&v_{1}&v_{2}&v_{3}&v_{4}&v_{5}&v_{6}&=\\\hline 100&0&0&0&0&-1&0&0&0&0&0&0\\0&200&0&0&0&0&-1&0&0&0&0&0\\0&0&100&0&0&0&0&-1&0&0&0&0\\0&0&0&200&0&0&0&0&-1&0&0&0\\0&0&0&0&100&0&0&0&0&-1&0&0\\0&0&0&0&200&0&0&0&0&0&-1&0\\0&0&0&0&0&1&1&0&0&0&0&1\\0&0&0&0&0&0&-1&1&1&0&0&0\\0&0&0&0&0&0&0&0&-1&1&1&0\\1&-1&-1&0&0&0&0&0&0&0&0&0\\0&0&1&-1&-1&0&0&0&0&0&0&0\\\end{array}}$

### Simulate

Simulation matches.
Power Check
* $P=i*v$
* $P_{source}+P_{R1}+P_{R2}+P_{R3}+P_{R4}+P_{R5}+P_{R6}+P_{Vs}=0$
* $(0.004884)*0.4884+(0.002558)*0.5116+(0.002326)*0.2326+$
$(0.001395)*0.2791+(0.0009302)*.0930+(0.0009302)*0.1860+(-.004884)*1=0$
Adding up the resistive terms get $0.004884-.004884=0$
The current through the voltage supply is $-i_{1}=-0.004884$. It is negative because it was drawn out of the positive terminal and the computed value was 0.004884. This made the current positive in the $r_{1}$ terminal equation, but it is negative with respect to the power supply because of the drawing.
Negative power means is that the power supply was dumping energy into the circuit. Positive power means that energy is leaving the circuit. All of the resistive power was positive. The resistors are where power is leaving the circuit.

### Build Intuition

* At this point MuPAD and MatLab are taking just about the same amount of time to use.
* MuPAD attaches symbols to the answers .. creates a better context to interpret the answers
* MatLab (linear algebra) creates patterns in the input that help check for mistakes
* Confidence is building that the two ways are enough different, that when the answers match can assume have not made any mistakes
* The single 1 in the = column is enough to trigger all the currents and voltages in the solution. The one comes from a source. Multiple numbers in this column probably mean there are multiple sources.
* This circuit looks like course or most significant is on the left, and least significant (smallest) is on the right. Is almost a kind of display system.
* The simulation does this math also, but it uses a drawing as it's input, then follows the steps above. Even still, confidence in the simulation tool is building.