Title: Solving Scale Linear Systems Example system
1Solving Scale Linear Systems (Example system)
- Lecture 17
- CAAM 420
- Fall 2004
2First Brief Reintroduction to Linear Systems
- First we will use an example physical system to
construct a set of 5 couple linear equations in 5
unknowns. - We will seek a solution using Matlab
- Later we will consider generalizations to larger
systems (with correspondingly more unknowns to
find).
3Circuit Problem
5W
1W
4W
6W
3W
7W
-
30V
1W
2W
Problem Find the current running through each
closed loop
4Circuit Problem
5W
1W
4W
DC Battery Resistor (resistance in
ohms) Resistance free wire
6W
3W
7W
-
30V
2W
1W
Notation
5Circuit Problem
5W
1W
4W
6W
3W
7W
30V
1W
2W
Find the current (in amperes) traveling in the
shown closed loops
6Kirchoffs Second Law
- Kirchoff's 2nd Law states that for any closed
loop path around a circuit the sum of the voltage
gains and voltage drops equals zero. In the
circuit shown, there is a voltage gain for each
electron traveling through the voltage source and
a voltage drop across the resistor.
7Loop 1 Balance
Consider LOOP 1
5W
1W
4W
6W
I2
3W
7W
I1
30V
I3
2W
1W
The gain is 30V. The loop 1 loss (by Ohms law)
is The gain due to current from loop 2 is The
gain due to current from loop 3 is Kirchoffs
2nd law states gainloss, gt
8All Loop Balances
5
5W
1W
4W
6W
3W
4
2
7W
30V
1
1W
2W
3
9Rearranging Linear System
Arranging unknown Loop currents on lefthand side
and known voltage sources on right hand side
Divide through by Ohms
10Final System
Simplifying the coefficients
Matrix form
11Final Form
- Negating both sides
- This is the enemy.
- We will create systems with a larger number of
degrees of freedom later on.
12Solution (by Matlab)
1.08A
5W
Solution
1W
4W
6W
1.97A
2.74A
3W
8.19A
7W
5.46A
30V
1W
2W
13Note
- It is important that at least one loop has
aresistor that lies only on that loop (i.e. at
least one resistor lying on a wire not shared by
two loops). - Otherwise the entire circuit will short circuit
around the boundary of the entire circuit.. - For example
9
9
8
8
1W
1W
4W
4W
6W
6W
4
5
4
5
3W
3W
7W
7W
-
1
-
1
1W
2
3
1W
2
3
2W
2W
14Class Exercise
a) Create a non-trivial circuit with 15 sub
loops. Use a range of resistor values between 1
and 10. b) Solve for loop currents with
Matlab c) Draw a diagram indicating current
along each segment of circuit (to two significant
figures). d) Verify Kerchoffs first law (look
it up) by checking the sum of currents at three
of the wire intersections. e) Count the number
of non-zeros of your 15x15 matrix and report the
amount of fill (i.e. number of non-zeros/225) f)
Include print out of matlab window used for
matrix solution.
15Circuit Problem Enlarged
9
8
1W
5W
2W
1W
4W
6W
4
5
3W
7W
1
-
10V
2
3
1W
5W
2W
1W
4W
6W
11
15
3W
7W
7
-
20V
12
17
1W
5W
2W
1W
4W
6W
6
16
3W
7W
Problem Find the current running through each
closed loop
-
30V
10
14
13
2W
1W
16Shortcut to Loop Current Matrix
9
8
1W
5W
2W
1W
4W
6W
4
5
3W
7W
1
-
10V
2
3
1W
5W
- To obtain the nth row of the
- Matrix
- The diagonal entry is equal to the sum of the
resistances on the nth loop - There is an off diagonal entry foreach neighbor
of the loop which is equal toa)
sum(resistances) on shared wire if loop
currents are in opposite direction b)
sum(resistances) on shared wire if loop
currents are in the same direction
2W
1W
4W
6W
11
15
3W
7W
7
-
20V
12
17
1W
5W
2W
1W
4W
6W
6
16
3W
7W
-
30V
10
14
13
2W
1W
179
8
1W
5W
2W
1W
4W
6W
4
5
3W
7W
1
-
2
3
1W
5W
2W
1W
4W
6W
11
15
3W
7W
7
-
12
17
1W
5W
2W
1W
4W
6W
6
16
3W
7W
-
10
14
13
2W
1W
18Using Sparse Matrices in Matlab
row,column,entry
19Run bigcircuit
- Create the list of non-zeros
- Convert the list to Matlabs sparse matrix format
- Convert the sparse matrix to a full matrix (just
for viewing)
20Counting the Non-Zeros with nnz
- We can use Matlabs built in nnz function to find
the number of non-zeros
i.e. there are only 58 non-zero entries out of
17x17289 possible
21Sparse Matrices
- When the fill ratio of a matrix is small (i.e.
very few non-zero entries in the matrix) we can
use an alternative to storing all the entries in
the matrix. - Next time we will discuss different ways to store
the non-zero entries, omitting the zeros. - We will then review available libraries designed
to allow manipulation of sparse matrices.