MATLAB_LinearAlgebra

MATLAB_LinearAlgebra - Chapter 16 Numerical Linear Algebra...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Chapter 16 Numerical Linear Algebra 16.1 Sets of Linear Equations MATLAB was developed to handle problems involving matrices and vectors in an efficient way. One of the most basic problems of this type involves the solution of a system of linear equations. The built-in matrix algebra functions of MATLAB facilitate the process of establishing whether a solution exists and finding it when it does. For example, the 4 × 3 system below 4 75 1 23 40 30 xyz ++ =- ++= --= is a system of equations which can be represented as Ax = b where 14 7 -5 11 , = , = x A x yb z   =  -- To check if a unique solution exists, the MATLAB function ' rank ' can be used with the coefficient matrix A and the augmented matrix ( A|b ). If the ranks of both matrices are equal to the number of unknown variables, in this case 3, a unique solution exists. If the ranks are equal and less than 3, an infinite number of solutions exist, i.e. the system is underconstrained. Finally if the rank of A is one less than the rank of ( A|b ), the equations are inconsistent, i.e the system is overconstrained and there is no solution. Example 16.1.1 A=[1,4,7; 1,1,1; 2,3,4; 1 -1 -3]; b=[-5;1;0;0]; rA=rank(A) % Check rank of A rAb=rank([A b]) % Check rank of (A|b) rA = 2 rAb = 3 Since the ranks are unequal, the system of equations are inconsistent and no solution exists. Suppose the A (4,3) element were +3 instead of -3.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Example 16.1.2 A=[1,4,7; 1,1,1; 2,3,4; 1 -1 3]; b=[-5;1;0;0]; rA=rank(A) % Check rank of A rAb=rank([A b]) % Check rank of (A|b) rA = 3 rAb = 3 In this case, the ranks are both equal to the number of unknowns so there is a unique solution to the system. The solution can be determined by transforming the augmented matrix into an echelon form using the ' rref ' function, which stands for row reduced echelon form, a Gauss elimination type of solution. Example 16.1.3 format rat rref([A b]) ans = 1 0 0 13/6 0 1 0 -1/3 0 0 1 -5/6 0 0 0 0 From the echelon form of ( A|b ) the solution is given by x = 13/6, y = -1/3, z =-5/6 When the coefficient matrix A is square (same number of equations as unknowns) the MATLAB function ' det ' will also reveal whether there is a unique solution. A nonzero value implies a unique solution and a zero determinant indicates either none or an infinite number of solutions.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/29/2008 for the course MATH 222 taught by Professor Stecher during the Spring '08 term at Texas A&M.

Page1 / 9

MATLAB_LinearAlgebra - Chapter 16 Numerical Linear Algebra...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online