Question
1. Using MATLAB, develop an M-file to determine LU factorization of a square matrix with partial pivoting. That is, develop a function called mylu
1. Using MATLAB, develop an M-file to determine LU factorization of a square matrix with partial pivoting. That is, develop a function called mylu that is passed the square matrix [A] and returns the triangular matrices [L] and [U] and the permutation P. You are not to use MATLAB built-in function lu in your codes. Test your function by using it to solve a system of equations listed below in part 3. Confirm that your function is working properly by verifying that [L][U]=P[A] and by using the MATLAB built-in function lu. 2. Using MATLAB, develop an M-file to determine matrix inverse based on the LU factorization method above. That is, develop a function called myiny that is passed the square matrix [A] and utilizing codes of part 1 above to return the inversed matrix. You are not to use MATLAB built-in function inv or left-division in your codes. Test your function by using it to solve a system of equations listed below in part 3. Confirm that your function is working properly by verifying that [A][A]=[I] and by using the MATLAB built-in function inv. 3. Using MATLAB, develop an M-file for the Gauss-Seidel Method to solve the system of equations listed below until the percent relative error falls below s = 5%. x1+x2+5x3 = -21.5 -3x16x2 + 2x3 = -61.5 10x12x2 x3 = 27 - Hints: Your M-file codes for all 3 problems must be able to handle generally a square matrix of general size n x n (i.e. not just limited to the 3 x 3 matrix in the example above). Problem #3: Make sure the system matrix is diagonal dominant. 1| Page
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started