Question: Needed in Matlab: In Exercise 3, note that in general, matrix PA and not matrix A is being decomposed. When no row swapping has taken
Needed in Matlab:

In Exercise 3, note that in general, matrix PA and not matrix A is being decomposed. When no row swapping has taken place, matrix P is just the identity matrix. The linear system Ax = b then becomes PAx = Pb. The resulting matrix PA can then be forgotten as it is now represented as LU in the linear system to give LUX = Pb. (1) Write a function that takes in matrix A and vector b and uses the function in Exercise 3 to split matrix A into lower triangular matrix L and upper triangular matrix U, while also returning matrix P which has the information about row swapping that took place. Your function will solve the problem described in equation 1, by first performing a forward substitution to solve the equation Ly = Pb for y and then performing backward substitution in order to solve the equation Ux = y for x. Your code should also return the appropriate error message. The first line of your function should look like: function x = LUsolve (A,b) In Exercise 3, note that in general, matrix PA and not matrix A is being decomposed. When no row swapping has taken place, matrix P is just the identity matrix. The linear system Ax = b then becomes PAx = Pb. The resulting matrix PA can then be forgotten as it is now represented as LU in the linear system to give LUX = Pb. (1) Write a function that takes in matrix A and vector b and uses the function in Exercise 3 to split matrix A into lower triangular matrix L and upper triangular matrix U, while also returning matrix P which has the information about row swapping that took place. Your function will solve the problem described in equation 1, by first performing a forward substitution to solve the equation Ly = Pb for y and then performing backward substitution in order to solve the equation Ux = y for x. Your code should also return the appropriate error message. The first line of your function should look like: function x = LUsolve (A,b)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
