Create a main MATLAB script that performs the tasks described below. 1 (25 point
ID: 3599009 • Letter: C
Question
Create a main MATLAB script that performs the tasks described below.
1 (25 points) Back-substitution: Write the user-defined function x - backsub(A,b) that implements the back-substitution algorithm. It solves system of equations represented by Ax = b, where "A" is a nxn upper triangular maxtrix, "X" is an nx1 vector of variables and “b" is a "nx1" vector representing the right hand side part of the system of equations. Algorithm: Then, for i=n-1 ,n-2, ,1 : Cii Solve the following system of equations using your backsub() function 4x^ - x, + 2x3 + 3x4 20 6x3 + 5x4 = 4 4Explanation / Answer
function X= backsub(A,b) l=length(b); X=zeros(l,1); X(l)=b(l)/A(l,l); for k=l-1:-1:1 X(k)=(b(k)-A(k,k+1:l)*X(k+1:l))/A(k,k); end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.