Question: Part 1 - Gauss Elimination Function Develop a MATLAB function called GaussElimination that solves a given system of linear equations of the form A x

Part 1- Gauss Elimination Function
Develop a MATLAB function called GaussElimination that solves a given system of linear equations of the form Ax=b using the Gauss Elimination method. The function should take three input arguments, which must be listed in this order: the coefficient matrix A, the right-side vector b, and a true/false value. If the third value is true, the function should perform partial pivoting while solving the linear system. If the third value is false, the function should not perform partial pivoting. The function should return the vector x. You must create your own implementation of the Gauss Elimination method; you may not use MATLAB's built-in matrix solvers (e.g., you may not use the left division operator). However, while developing your code, you may want to use the built-in matrix solvers to check the answers your code produces.
Refer to the pseudo code form lecture which shows where partial pivoting is performing during Gauss Elimination. You should place a conditional statement containing the partial pivoting code there. If a value of true is received in the input, the partial pivoting code should be executed, otherwise it should not.
1
gauss(A,b) : Performs Gauss elimination to solve for x in Ax=b
Input:
A= coefficient matrix (nxn)
b= right hand side vector
Output:
x= solution vector
Confirm that the coefficient matrix A is square
if A is not square
stop execution and return an error value: NaN
end
setup augmented matrix Ab=[A,B]
Number of columns nc=n+1
do not use matlabs MAX function for partial pivoting*
} back substitution
initialize solution vector x(set all to zero)
x(n)=Abn,ncAb(n,n)
for k=n-1 down to 1
x(k)=Ab(k,nc)
for j=k+1 to n
x(k)=x(k)-Ab(k,j)**x(j)
end
x(k)=xkAb(k,k)
end
 Part 1- Gauss Elimination Function Develop a MATLAB function called GaussElimination

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!