Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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