Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE DO NOT USE MATLABS max function for partial pivoting. Part 1 - Gauss Elimination Function Develop a MATLAB function called GaussElimination that solves a

PLEASE DO NOT USE MATLABS "max" function for partial pivoting. 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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

1. Give an example of hierarchical planning in an organization.

Answered: 1 week ago

Question

What is order of reaction? Explain with example?

Answered: 1 week ago

Question

Derive expressions for the rates of forward and reverse reactions?

Answered: 1 week ago

Question

Write an expression for half-life and explain it with a diagram.

Answered: 1 week ago