34201 3 8 3 marks Consider the uppertriangular linear system
-34201 -3 -8 3 marks) Consider the upper-triangular linear system AX = B where A = 0 5-3 2 and B and B 0 0 L0 3 (a) Open the file named BackSud.m in MATLAB\'s Edito. Complete the code for using backward substitution (Section 6.1 in text) to solve the system of equations and then run it in the Command Window State the solution in the space provided. Note: See MATLAB tutorial for defining matices, ete] (b) Check your code in pait (a) by entering AB in the Command Window
Solution
function x = backsub(A, b)
n = size(A, 2);
dim = size(b, 2);
% initialize
x = zeros(n, dim);
% solve
for i=n:-1:1
x(i, :) = ( b(i, :) - ( x(i+1:end, :)\' * A(i, i+1:end)\' )\' ) / A(i, i);
end
return;
