Analysis of Mesh Circuit Using Linear Algebra

advertisement
Analysis of Mesh Circuit
Using Linear Algebra
Submitted By:
Md. Anowar Hossain
Researcher No: 75654
Submitted To:
Dr. Yacine Benhadid
1
Abstract
An interesting application of linear algebra can be found in electrical
engineering and specifically electrical networks. I have found that linear
algebra is a useful tool in analyzing electric circuits in terms of organization
and saving time.
In this report, I have included examples how to analyze a circuit using linear
algebra and solved it by using Gaussian Elimination, LU Decomposition and
SOR (Successive Over Relaxation) method and determined Eigenvalues and
Eigenvectors using Shifted Inverse Power method, Deflation method and
Jacobi method.
Background
A simple electric circuit consists of voltage sources, wire with current
running through it, and various types of resistors that cause a voltage drop in
the circuit. In order to tell how much the voltage drops across a resistor, one
must use Ohm’s law. This law simply states that V = IR
Where, V = Voltage across the resistor (volts),
I = Current through the resistor (amperes) and
R = Resistance of the resistor (ohms).
When analyzing an electric circuit, there are many techniques that may be
used. One simple technique uses the idea of Kirchhoff’s voltage law (KVL).
Kirchhoff’s voltage law states that “the algebraic sum of the voltages around
any closed path in a circuit is identically zero for all time”. In order to use
Kirchhoff’s voltage law, the method of mesh current analysis must be used
to examine the circuit.
In order to analyze the circuit, Kirchhoff’s voltage law must be applied to
each mesh. It is important to note that if a resistor is shared by two meshes,
the voltage across this resistor is (current in mesh being analyzed – current
in other mesh) x (resistance).
After summing the voltages around a circuit with 5 meshes, there will be 5
equations with 5 unknowns. One way to solve this would be to solve each
equation in terms of one variable and then substitute into the others. This
method would work, but would be far too time consuming. This is where
linear algebra comes in. Using Ohm’s law, each equation can be written in
the form RI = V
(similar to Ax = b).
Putting these equations into matrices and solve for each current by using the
matrix equation RI = V. By solving the augmented matrix, values of I1, I2, I3,
I4 and I5 can be found. The matrix equation can be very useful when large
circuits with many loops are to be analyzed.
In order to analyze the simple circuit below (find the amount of current
flowing in each loop), the technique of mesh analysis will be combined with
the use of linear algebra.
Model Circuit
The equations in the model are given by:
Mesh 1: I1R1 + (I1 – I2) R6 + (I1 – I4) R7 = V
Mesh 2: (I2 - I1) R6 + I2 R2 + (I2 - I3) R5 = 0
Mesh 3: I3R3 + I3R4 + (I3 – I2) R5 = 0
Mesh 4: (I4 – I1) R7 + (I4 – I5) R4 + I4R10 + I4R8 = 0
Mesh 5: (I5 – I4) R4 + I5R11 = 0
V = 120V, R1 = 2, R2 = 5, R3 = 2, R4 = 4, R5 = 3, R6 = 1R7 =
3R8 = 6R9 = 5 R10 = 2R11 = 8
Step 1:
The first step in solving this problem is to write the sum of voltages around
each loop. (In this case, I arbitrarily choose current direction as clockwise).
The voltage sums of each loop must equal zero, thus giving the following
equations:
Mesh 1: 6I1 – I2 + 0I3 – 3I4 + 0I5 = 120
Mesh 2: -I1 + 9I2 - 3I3 + 0I4 + 0I5 = 0
Mesh 3: 0I1 – 3I2 + 9I3 + 0I4 + 0I5 = 0
Mesh 4: -3I1 + 0I2 + 0I3 + 15I4 - 4I5 = 0
Mesh 5: 0I1 + 0I2 + 0I3 – 5I4 + 13I5 = 0
Step 2:
Putting the five equations into matrix form Ax = b. In this case, values of
resistance will make up the coefficient matrix, current will be the unknown
x, and voltages will be the product of resistances and currents. The three
equations from above will have the form RI = V. Once the mesh equations
are put into matrices, they will look like:
6
-1
0
-3
0
-1
9
-3
0
0
0
-3
9
0
0
-3
0
0
15
-5
0
0
0
-4
13
I1
I2
I3
I4
I5
120
0
=
0
0
0
Solving the system using Gaussian Elimination:
6 -1 0 -3 0
-1 9 -3 0 0
Ab = 0 -3 9 0 0
-3 0 0 15 -4
0 0 0 -5 13
120
0
0
0
0
Matlab Command:
>> Ab=[6 -1 0 -3 0 120;-1 9 -3 0 0 0;0 -3 9 0 0 0;-3 0 0 15 -4 0;0 0 0 -5 13 0];
>> gauss(Ab)
Which gives upper triangular matrix,
M=
6.0000 -1.0000
0
-3.0000
0
120.0000
0
8.8333 -3.0000 -0.5000
0
20.0000
0
0
7.9811 -0.1698
0
6.7925
0
0
0
13.4681 -4.0000 61.2766
0
0
0
0
11.5150 22.7488
Using backward substitution, gives the solution:
I1 = 23.0484 A,
I2 = 2.8811 A,
I3 = 0.9604 A,
I4 = 5.1365 A,
I5 = 1.9756 A
Solving the system using LU Decomposition
A =
6
-1
0
-3
0
-1 0
9 -3
-3 9
0 0
0 0
-3 0
0 0
0 0
15 -4
-5 13
Matlab Command:
>>A=[6 -1 0 -3 0;-1 9 -3 0 0;0 -3 9 0 0;-3 0 0 15 -4;0 0 0 -5 13];
>>LU(A)
1.0000
0
0
0
0
-0.1667 1.0000
0
0
0
0
-0.3396 1.0000
0
0
-0.5000 -0.0566 -0.0213 1.0000
0
0
0
0 -0.3712 1.0000
= L
6.0000 -1.0000
0
-3.0000
0
0
8.8333 -3.0000 -0.5000
0
0
0
7.9811 -0.1698
0
=U
0
0
0
13.4681 -4.0000
0
0
0
0
11.5150
Using Ly=b and Ux=y
1.0000
0
0
0
0
-0.1667 1.0000
0
0
0
0
-0.3396 1.0000
0
0
-0.5000 -0.0566 -0.0213 1.0000
0
0
0
0 -0.3712 1.0000
y1
120
y2
0
y3 = 0
0
y4
0
y5
>>b=[120;0;0;0;0];
>>y=inv(L)*b
Gives the solution, y1 = 120
y2 = 20
y3 = 6.7925
y4 = 61.2766
y5 = 22.7488
6.0000 -1.0000
0
-3.0000
0
I1
120
20
0
8.8333 -3.0000 -0.5000
0
I2
= 6.7925
0
0
7.9811 -0.1698
0
I3
61.2766
0
0
0
13.4681 -4.0000 I4
22.7488
0
0
0
0
11.5150 I5
>>I=inv(U)*y
Gives the solution,
I1 = 23.0484 A
I2 = 2.8811 A
I3 = 0.9604 A
I4 = 5.1365 A
I5 = 1.9756 A
Solving the System using SOR method
A=
b=
6 -1 0 -3 0
-1 9 -3 0 0
0 -3 9 0 0
-3 0 0 15 -4
0 0 0 -5 13
120
0
0
0
0
>> A=[6 -1 0 -3 0;-1 9 -3 0 0;0 -3 9 0 0;-3 0 0 15 -4;0 0 0 -5 13];
>> b=[120;0;0;0;0];
>> N=100;
>> sor(A, b, N)
It gives the solution on 7 iterations (W = 1.0628)I1 = 23.0484 A
I2 = 2.8811 A
I3 = 0.9604 A
I4 = 5.1365 A
I5 = 1.9756 A
Finding Eigenvalues and Eigenvectors:
Eigenvalues of matrix A are:
19.0196
4.4967
6.2619
10.1315
12.0903
Power Method:
Using an initial vector x0 = [1,1,1,1,1]T , the approximation of the dominant
Eigenvalue of matrix A after 20 iterations is 19.0196 and the corresponding
eigenvector is [-0.1760, 0.0193, -0.0058, 0.7572, -0.6288]T
Matlab Command:
>> A=[6 -1 0 -3 0;-1 9 -3 0 0;0 -3 9 0 0;-3 0 0 15 -4;0 0 0 -5 13];
>> x=[1,1,1,1,1]';
>> tol=1e-10;
>> maxiter=20;
>> [lambda,v,relerr,niter] = Powermethod(A,x,tol,maxiter)
Inverse Power Method:
Using an initial vector x0 = [0,1,2,3,4]T , the approximation of the dominant
Eigenvalue of matrix A-1 after 10 iterations is 4.4980 and the corresponding
eigenvector is [0.8294, 0.3550, 0.2453, 0.3055, 0.1805]T.
Matlab Command:
>> A=[6 -1 0 -3 0;-1 9 -3 0 0;0 -3 9 0 0;-3 0 0 15 -4;0 0 0 -5 13];
>> x=[0,1,2,3,4]';
>> tol=1e-10;
>> maxiter=10;
>> [lambda,v,relerr,niter] = InvPowerMethod(A,x,tol,maxiter)
Shifted Inverse Power Method:
Using an initial vector x0 = [1,1,1,1,1]T and µ=6, the approximation of the
dominant Eigenvalue of matrix B-1 = (A-µI)-1 after 15 iterations is 19.0196
and the corresponding eigenvector is [-0.1759, 0.0193, -0.0058, 0.7571, 0.6289]T.
Matlab command:
>>A=[6 -1 0 -3 0;-1 9 -3 0 0;0 -3 9 0 0;-3 0 0 15 -4;0 0 0 -5 13];
>> s=19;
>> x=[1,1,1,1,1]';
>> tol=1e-10;
>> maxiter=15;
>> [lambda,v,relerr,niter] = ShiftInvPowerMethod(A,s,x,tol,maxiter)
Jacobi Method:
Jacobi method gives the matrix
D=
4.4956
0.0174
-0.0026
0.2906
-0.0455
0.0402
12.0898
0.0745
0.1229
0.0218
-0.0066
0.0865
6.2630
-0.1803
0.0946
-0.0230
0.0414
0.0001
19.0188
-0.9131
0.1396
0.0041
-0.0001
-0.0084
10.1328
Its diagonal elements are:
4.4956
12.0898
6.2630
19.0188
10.1328
Which are the Eigenvalues of the original matrix A.
Matlab Command:
>>A=[6 -1 0 -3 0;-1 9 -3 0 0;0 -3 9 0 0;-3 0 0 15 -4;0 0 0 -5 13];
>> JOBM(A)
Deflation Method:
Using the largest Eigenvalue 19.0196 and the corresponding Eigenvector
x1 = [-0.1760, 0.0193, -0.0058, 0.7572, -0.6288]T , Deflation method gives
the following Eigenvalues:
19.0196
4.4979
6.2617
12.0905
10.1335
and the corresponding eigenvectors are:
[-0.1759, 0.0193, -0.0058, 0.7571, -0.6289]T
[0.8414, 0.3359, 0.2238, 0.3097, 0.1821]T
[-0.3386, 0.6168, 0.6759, -0.1761, -0.1306]T
[-0.3264, -0.0478, 0.1269, 0.4655, 0.8114]T
[-0.1259, 0.7074, -0.6867, 0.0198, 0.1088]T
Matlab Command:
>> A=[6 -1 0 -3 0;-1 9 -3 0 0;0 -3 9 0 0;-3 0 0 15 -4;0 0 0 -5 13];
>> Lamda=19.0196;
>> XA=[-0.1760, 0.0193, -0.0058, 0.7572, -0.6288]';
>> DEFLATED(A,Lamda,XA)
>>[v,d]=eig(A)
Evaluation
I think that having knowledge of matrices and linear algebra is extremely
valuable in many fields of study. This project was a good chance to find out
how useful linear algebra is in many different areas of math and science.
The reason I choose only to discuss linear algebra in relation to Kirchhoff’s
voltage law and mesh current analysis is because I became extremely
familiar with mesh current analysis. I wanted to see how linear algebra could
relate to and expand my knowledge of a subject I already knew about. I
thought this would be more valuable to me, than to learn about a completely
new topic that I knew nothing of, and then write a report on that.
Related documents
Download