Sys of Linear Eqn
Sys of Linear Eqn
using MATLAB
3x + 2y - z = 6 3 2 -1 x 6
Convert it to its
-2x + 2y + z = 3 -2 2 1 y = 3
x+ y+z=4 1 1 1 z 4
Matrix Form
System of Linear
Equations in x, y, z.
A . X = B
Compute the
Inverse Matrix
4x-2y+6z=8
2x+8y+2z=4
6x+10y+3z=0
Solution Using the rules of linear algebra demonstrated earlier, the above system of equations
can be written in the matrix form AX=B or in the form XC=D:
Use [A,B] =
Declare the equationsTo
2x+y+z=2 system of syms x y z equationsToMatrix
eqn1 = 2*x + y + z == 2; Matrix
−x+y−z=3 ([eqn1, eqn2,
eqn2 = -x + y - z == 3;
x+2y+3z=−10 eqn3], [x, y, z])
eqn3 = x + 2*y + 3*z == to convert
equation
the
s -10;
equations
into the form
AX = B
A =
Use linsolve
[ 2, 1, 1]
X 3 to solve AX =
[ -1, 1, -1]
Y = 1
X = linsolve(A,B) B [ 1, 2, 3]
Z -5
B =
2
3
-10
REFERENCE
- AMOS GILAT :INTRODUCTION TO MATLAB
- B.ADRIAN AND B.MOSHE :INTRODUCTION TO MATLAB
- STEPHEN J.CHAPMAN :MATLAB PROGRAMMING FOR ENGINEERS