{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MATLAB_LinearAlgebra

MATLAB_LinearAlgebra - Chapter 16 Numerical Linear Algebra...

Info icon This 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 7 5 1 2 3 4 0 3 0 x y z x y z x y z x y z + + = - + + = + + = - - = is a system of equations which can be represented as Ax = b where 1 4 7 -5 1 1 1 1 , = , = 2 3 4 0 1 1 3 0 x A x y b 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.
Image of page 1

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

View Full Document Right 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
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern