Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Consider the MATLAB function GaussPivot() given in class in slide 5-31. (a) Modify GaussPivot() so that it computes and returns the determinant (with the

3. Consider the MATLAB function GaussPivot() given in class in slide 5-31.
(a) Modify GaussPivot() so that it computes and returns the determinant (with the correct sign) and
detects whether the system is singular based on a near-zero determinant. Define near-zero as
being when the absolute value of the determinant is below a tolerance. When this occurs, the
function should display an error message and terminate. The first line of the function should be:
function [x, D] = GaussPivot2(A, b, tol) where D is the determinant, and tol is the tolerance. Do not use the Matlab det() function.
(b) Showtheresultofrunningyourfunctiononthefollowingsystemofequationswithtol=0.00001
2x2 + 5x3 = 1
2x1+x2 +x3=1 4x1 +2x2 +2x3 =4
image text in transcribed
function x Gausts Pivot (A,b) t GaussPivot: Gauss elimination pivoting tx Gausspivot lA.b) Gauss elinination with pivoting. t input: Acoefficient matrix b right hand side vector s output: tx solution vector Im, nl-size(A): if m-n, error ('Matrix A must be square'): end nb-n+1 Aug" [A b); t forvard elimination for k- 1:n-1 oue partial pivo ting big, il-max (abs (Aug (k:n,x)) ipr-irk-1, end tor i -k+lin factor Aug (i,k)/Aug (k,k)i end end 3 back substitution xszeros (n. 1)a x(n) Aug (n,nb)/Aug (n,n) i for i n-1:-1:1 end eterminant Evaluation lon matrix can be simply

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

More Books

Students also viewed these Databases questions

Question

Identify how culture affects appropriate leadership behavior

Answered: 1 week ago