l. (20 points) In the back substitution, one solves for x from Ux = b, where the
ID: 3210347 • Letter: L
Question
l. (20 points) In the back substitution, one solves for x from Ux = b, where the matrix U is upper of size n by n. Now, write a function performing the following kind of calculations (it is b, but is only a kind of matrix calculations). Given an upper triangular matrix 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 zi, first perform a one-step back-substitution of Uz = b from row triangular not for solving Ux = i, and obtain an intermediate solution denoted as ti. Then, zi is determined as follows: ti, if ti> 9i 9i, otherwise. Xi = Obtain the elements of z starting from the last element n to the first element z1. It is called a projected back solver. ·x = pback(U,b,g). . U is the upper triangular coefficient matrix. b is the right hand side vector. . g is the reference vector Here is an example of n = 3. 1 2 3 3Explanation / Answer
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
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.