Question

Using MATLAB please.Recall the formula for backward substitution to solve the upper triangular system ain 011 0 012 022 bi b. alan ... 0 0 ann be

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Matlab code for the problem

function x = backward_substitution(A,b)

% Function to solve the upper triangular system Ax = b

n = length(b); % size of the system

x = zeros(n,1); % initilizing the x vector

for i = n:-1:1 % for loop to compute x_i

sum = 0; % variable to store the sum i+1 to n

for j = i+1:n % fo loop to compute the sum Aij*xj

sum = sum + A(i,j)*x(j); % computing the sum

end

x(i) = (b(i)-sum)/A(i,i); % computing the ith x value

end % end of for loop

end % end of function

Screen Print of the code

X 2 backward_substitution.m + function x = backward_substitution(A,b) % Function to solve the upper triangular system Ax = b

Screen Print of the output

COMMAND WINDOW >> A = [ 2, 0, 0; 1, 1, 0; 1, 2, 3] % the A matrix given A = 2 1 1 0 1 2 3 b = [6; 7; 15] % given b vector b

Add a comment
Know the answer?
Add Answer to:
Using MATLAB please. Recall the formula for backward substitution to solve the upper triangular system ain...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT