Question
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
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.
Using MATLAB, develop an M-file to determine matrix inverse based on the LU factorization method above. That is, develop a function called myinv 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]=[I] and by using the MATLAB built-in function inv.
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 = 5%.
Please solve all parts.
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]lU] 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 myinv 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][Al- 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 5% X1 + X2 + 5X3 -21.5 3X1-6X2 + 2X3 =-61.5 10X1 + 2X2-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)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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