Question: Please code the following in MATLAB. Thank you so much!! 4 LU Decomposition (4 points) In this part, you will write a function that performs

Please code the following in MATLAB. Thank you so much!!

Please code the following in MATLAB. Thank you so much!! 4 LUDecomposition (4 points) In this part, you will write a function that

4 LU Decomposition (4 points) In this part, you will write a function that performs LU decomposition without pivotig. We will deal with pivoting in the next part of the assignment Specification: function [L, U] my-lu(A) Input: an n x n square matrix A Output: L: an n n lower triangular matrix where the diagonal entries are all one, e.g.,*1 0where is a potentially nonzero element . U: an n x n upper triangular matrix. To get full credit, your function should handle the following case: Early termination Due to round-off error, there may exist free variables whose pivots are extremely small but not precisely zero. You should terminate your LU decomposition if the absolute value of a pivot is less than 10-12 The process of LU decomposition uses Gaussian elimination that transforms A to an upper triangular matrix U while recording the pivot multipliers in a lower triangular matrix L 1. Initialize L to the identity matrix, and U to A. You can use MATLAB's built-in function eye (n) 2. At the ith step, for each row k belowteh row, (a) Record the pivot multiplier to L at (k,i), ie., Lk.i = Uk,i/Ui,i as shown in Figure 2. Note that this fills in the ith column of L (b) Reduce the kth row of U using the pivot multiplier, i.e., Uk Uk(Un/U,JU where U, is the ith row 1 0 0-0 0 k-10 0 0 * * Figure 2: LU decomposition at the ith step

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!