Question: 1. Suppose you use the following MATLAB function to compute the LU decomposition of the matrix A defined in Pen-and-paper Problem 1. Write down actual

 1. Suppose you use the following MATLAB function to compute the

1. Suppose you use the following MATLAB function to compute the LU decomposition of the matrix A defined in Pen-and-paper Problem 1. Write down actual commands to be executed inside the function for tasks 1, 2, 3, 4 with i-1,2 and relate those commands to the changes in matrices P, L, A. [L, eye (n) ; eye (n) ; function U, P] = ludecomp (Am) P for i 1:n-1 = (val, pos] pivot index ))); -max(abs (A (1:n, = pos + 1-1; if pivotindexi tmp_ A(i, i:n) ; A(i, i:n) - A(pivotindex, i:n); A(pivot index, 1:n) tmp; tmp P(i, 1:n); P(i, 1:n) - P(pivotindex, 1:n); P(pivot index, 1 : n) = tmp; tmp =LO, 1:i-1); LO, 1:1-1) = L(pivot index, 1:i-1); L(pivot index, 1:1-1) -tmp ; end factors-A(i+1 :n,1)/A(i, i); L(i+1:n,i) - factors; A(1+1 : n, 1+1 : n) -A(+1 : n , A(i+1:n,i) - zeros(n-i,1); 1+1 : n) -factors#A(i, +1:n); end U- A end 1. Suppose you use the following MATLAB function to compute the LU decomposition of the matrix A defined in Pen-and-paper Problem 1. Write down actual commands to be executed inside the function for tasks 1, 2, 3, 4 with i-1,2 and relate those commands to the changes in matrices P, L, A. [L, eye (n) ; eye (n) ; function U, P] = ludecomp (Am) P for i 1:n-1 = (val, pos] pivot index ))); -max(abs (A (1:n, = pos + 1-1; if pivotindexi tmp_ A(i, i:n) ; A(i, i:n) - A(pivotindex, i:n); A(pivot index, 1:n) tmp; tmp P(i, 1:n); P(i, 1:n) - P(pivotindex, 1:n); P(pivot index, 1 : n) = tmp; tmp =LO, 1:i-1); LO, 1:1-1) = L(pivot index, 1:i-1); L(pivot index, 1:1-1) -tmp ; end factors-A(i+1 :n,1)/A(i, i); L(i+1:n,i) - factors; A(1+1 : n, 1+1 : n) -A(+1 : n , A(i+1:n,i) - zeros(n-i,1); 1+1 : n) -factors#A(i, +1:n); end U- A end

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!