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

An upper triangular matrix is a square matrix with all zeros BELOW the diagonal

ID: 3735712 • Letter: A

Question

An upper triangular matrix is a square matrix with all zeros BELOW the diagonal elements. Write a function with header [x] = myBackwardSub(U, b) which solves Ax = b for x given an nxn upper triangular matrix A and an nx1 vector b. Use nested for loops, do not use built in Matlab functions inv, pinv, .

2. 5 Points An upper triangular matrix is a square matrix with all zeros BELOW the diagonal elements. Write a function with header [x]myBackwardSub (U, b) which solves Ax b for x given an xn upper triangular matrix A and an nxl vector b. Use nested for loops, do not use buil in Matlab functions inv, pinv, Test Case: > myBackwardSub (U, b2) X- 1.0000 2.0000 3.0000 4.0000 5.0000

Explanation / Answer

Solution:

The required function is given below:

function:

function [q]= myBackwardSub(c, d)

m=size(c); n=m(1);

st=0;

qt(n)=d(n,1)/c(n,n);

for i=1:n-1

for j=1:i

st= st+c(n-j,n)kqt(n-j+1);

end

qt(n-i)=(-st+d(n-i,1))/c(n-i,n-i);

st=0;

end

q= qt;

end

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