0% found this document useful (0 votes)
37 views

Math. System of Linear Equations Solved With Matrix Inversion Method, in Excel and in VBA

This document discusses solving systems of linear equations through matrix algebra. It provides examples of solving a 2x2, 3x3, and 4x4 system using Excel and Visual Basic for Applications (VBA) functions. The VBA functions take the coefficient matrix and constant vector as inputs and return the solution vector.

Uploaded by

JMV
Copyright
© © All Rights Reserved
Available Formats
Download as XLS, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Math. System of Linear Equations Solved With Matrix Inversion Method, in Excel and in VBA

This document discusses solving systems of linear equations through matrix algebra. It provides examples of solving a 2x2, 3x3, and 4x4 system using Excel and Visual Basic for Applications (VBA) functions. The VBA functions take the coefficient matrix and constant vector as inputs and return the solution vector.

Uploaded by

JMV
Copyright
© © All Rights Reserved
Available Formats
Download as XLS, PDF, TXT or read online on Scribd
You are on page 1/ 7

Solution of linear systems

1. Solution of a two equations linear system

2. Solution of a three equations linear system

3. Solution of a four equations linear system


1. Solution of a two equations linear system.

System to be solved
x1 + x2 = 8
2*x1 + 4*x2 = 100

Solution in Exel spreadsheet Solution in VBA using the function:


A*X= B X= MatrixMultiplication_Ainv_B(A00, A01,
X= Ainv*B
A(0, 0) = 1 A00 =
A= 1 1 A(0, 1) = 1 A01 =
2 4 A(1, 0) = 2 A10 =
A(1, 1) = 4 A11 =
B= 8
100 B(0, 0) = 8 B00 =
B(1, 0) = 100 B10 =
X= -34
42 X= =TRANSPOSE(MatrixMultiplication_Ai
X= #VALUE!
#VALUE!
Rev. cjc. 10.03.2017
Return

g the function:
ltiplication_Ainv_B(A00, A01, A10, A11, B00, B10)

1
1
2
4

8
100

OSE(MatrixMultiplication_Ainv_B(L11, L12,L13, L14, L16, L17))


2. Solution of a three equations linear system.

System to be solved
x1 + 5*x2 - 7*x3 = 6 Solution in VBA using the function:
2*x1 + 4*x2 + 8*x3 = 34 X =Transpose(MatrixMultiplication_3x3_AAinv_BB(A0
3*x1 + 6*x2 + 9*x3 = 42
AA00 = 1
Solution in Exel spreadsheet AA01 = 5
AA * X = BB AA02 = -7
X= Ainv*B AA10 = 2
AA11 = 4
AA = 1 5 -7 AA12 = 8
2 4 8 AA20 = 3
3 6 9 AA21 = 6
AA22 = 9
BB = 6 BB00 = 6
34 BB10 = 34
42 BB20 = 42

X= -9.67 #VALUE!
7.33 X= #VALUE!
3.0 #VALUE!
Rev. cjc. 10.03.2017
Return

n VBA using the function:


(MatrixMultiplication_3x3_AAinv_BB(A00, A01, A02, A10, A11, A12, A20, A21, A22, B00, B10, B20))
3. Solution of a four equations linear system.
System to be solved
x1 + 5*x2 - 7*x3 + x4 = 6
2*x1 + 4*x2 + 8*x3 - x4 = 34
3*x1 + 6*x2 + 9*x3 = 42
x1 - 4*x2 + 8*x3 - 2*x4 = -5 Solution in VBA using the fu
MatrixMultiplication_4x4(A00, A01, A02, A03, A10

Solution in Exel spreadsheet


AC * X = BC AC00 =
X= ACinv*BC AC01 =
1 5 -7 1 AC02 =
AC = 2 4 8 -1 AC03 =
3 6 9 0 AC10 =
1 -4 8 -2 AC11 =
AC12 =
6 AC13 =
BC = 34 AC20 =
42 AC21 =
-5 AC22 =
AC23 =
-4.1 AC30 =
X= 5.6 AC31 =
2.3 AC32 =
-1.3 AC33 =
Rev. cjc. 10.03.2017

Return

Solution in VBA using the function:


MatrixMultiplication_4x4(A00, A01, A02, A03, A10, A11, A12, A13, A20, A21, A22, A23,AC30,AC31,AC32,Ac33, B00, B10, B20, B30)

1 BC00 = 6
5 BC10 = 34
-7 BC20 = 42
1 BC30 = -5
2
4
8 #VALUE!
-1 X= #VALUE!
3 #VALUE!
6 #VALUE!
9
0
1
-4
8
-2

You might also like