Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

1. Suppose you use the following MATLAB function to compute the L 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. function [L, U, P] -ludecomp(A,n) P eye(n) ; eye (n); = for i 1:n-1 = [val , pos] -max(abs (A(i:n, pivotindex - pos + i - 1; 1))); if pivotindex - i tmp = A(i, i:n); A(1, 1:n) = A(pivotindex, 1:1); A(pivotindex, i:n) - tmp - P(i, 1:n); PCi, 1:n) = P(pivot index, 1:n); P(pivot index, 1:n) = tmp ; tmp -L(i, 1:i-1); L(i, 1:i-1) -L(pivotindex, 1:i-1); L(pivot index, 1:1-1) = tmp; tmp ; end factors A(i+1 :n,1)/A(i, i); L(1+1 :n,1) -factors ; A(1+1 :n, 1+1 : n) -A(i+1 : n, A(i+1 : n , i) = zeros(n-1, 1); 1+1 : n) factors#A (i , +1:n); _ end 1. Suppose you use the following MATLAB function to compute the L 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. function [L, U, P] -ludecomp(A,n) P eye(n) ; eye (n); = for i 1:n-1 = [val , pos] -max(abs (A(i:n, pivotindex - pos + i - 1; 1))); if pivotindex - i tmp = A(i, i:n); A(1, 1:n) = A(pivotindex, 1:1); A(pivotindex, i:n) - tmp - P(i, 1:n); PCi, 1:n) = P(pivot index, 1:n); P(pivot index, 1:n) = tmp ; tmp -L(i, 1:i-1); L(i, 1:i-1) -L(pivotindex, 1:i-1); L(pivot index, 1:1-1) = tmp; tmp ; end factors A(i+1 :n,1)/A(i, i); L(1+1 :n,1) -factors ; A(1+1 :n, 1+1 : n) -A(i+1 : n, A(i+1 : n , i) = zeros(n-1, 1); 1+1 : n) factors#A (i , +1:n); _ end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions