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

In the back substitution, one solves for x from Ux = b, where the matrix U is up

ID: 3196877 • Letter: I

Question

In the back substitution, one solves for x from Ux = b, where the matrix U is upper triangular of size n by n. Now, write a function performing the following kind of calculations (it is not for solving Ux = b, but is only a kind of matrix calculations). Given an upper triangular matrix U of size n × n, a column vector b of length n, and a column vector g of length n. Calculate a column vector x of length n. To determine xi, first perform a one-step back-substitution of Ux = b from row

i, and obtain an intermediate solution denoted as ti. Then, xi is determined as follows: {

ti, if ti>gi, xi =

gi , otherwise.
Obtain the elements of x starting from the last element xn to the first element x1. It is called a

projected back solver.

This need to be done on Matlab..I need to understand how to solve the back sub for a nxn matrix.

Explanation / Answer

The algorithm for Back-substitution:

Function x = pback(U,b)

% x = pback(L,b)

% Solves the nonsingular upper triangular system Ux = b.

% where U is n-by-n, b is n-by-1, and X is n-by-1.
n = length(b);
x = zeros(n,1);
for j=n:-1:2
x(j) = b(j)/U(j,j);
b(1:j-1) = b(1:j-1) - x(j)*U(1:j-1,j);
end
x(1) = b(1)/U(1,1);

The back substitution for a nxn matrix from given:

Function x = pback( U,b,g)
xn = bn/unn
for i = n - 1 . . . 1
s = bi
for j = i + 1. . . n
s = s-ui,j xj
end
xi = s/ui,i
end

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