Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function with the header [x] = myLU(L, U, b) which solves LUx=b for a gi

ID: 3735717 • Letter: W

Question

Write a function with the header [x] = myLU(L, U, b) which solves LUx=b for a given lower triangular matrix L, upper triangular matrix U, and right hand side vector b. This is easy. The function body should only have two lines of code consisting of calls to two of the functions you wrote earlier.

4. which solves LUx-b for a given 5 Points write a function with the header [x] lower triangular matrix L, upper triangular matrix U, and right hand side vector b = myLU (L, U, b) T his is easy The function body should only have two lines of code consisting of calls to two of the functions you wrote earlier Test Case 2.0000 4.0000 6.0000 8.0000 10.0000 1.0000 2.0000 3.0000 4.0000 5.0000

Explanation / Answer

Solution:

The required function is given below:

function:

function [x] = myLU(L,U,b)

x=inv(L*U)*b;

end

Output:

>> L= [1 1 2; 2 5 8; 3 1 1]

L =

1 1 2
2 5 8
3 1 1

>> U= [2 1 1; 3 2 5; 1 0 1]

U =

2 1 1
3 2 5
1 0 1

>> b=[1; 2; 3]

b =

1
2
3

>> x= myLU(L, U, b)

x =

0.5000
0.5000
-0.5000

>>

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote