Question: 2. Write a code to solve Ax = b by the Gaussian elimination plus the backward substitution. (a) Write a MATLAB function x-BS(A, b), which

2. Write a code to solve Ax = b by the Gaussian elimination plus the backward substitution. (a) Write a MATLAB function x-BS(A, b), which implements the backward substitution algorithm. The upper triangular part of A contains all the coefficients and the lower triangular can be nonzero. Column vector b is the right-hand-side vector. Output x is the solution (b) Write a MATLAB function [A, b]=GE (A , b) which implements the Gaussian elimination algorithm (page 99). The input is the matrix A and the right-hand-side vector b. The upper triangular part of the output matrix A contains the reduced upper triangular matrix and the lower triangular part does not need to be nonzero. The output b contains the modified right-hand-side vector (c) Write a MATLAB function x-myLinearSolve1(A, b), which solves Az -b. It first conducts the Gaus- sian elimination to reduce the problem to a upper triangular one. Then call the backward substitution procedure to solve the reduced problem. Test your code on the linear system in problem 1 a) Output the upper triangular matrix you have obtained from the Gaussian elimination and compare it with the one you obtained by hand. (b) Output the solution and compare it with the one in problem 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
