Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use matlab to solve The code below is a working Gaussian elimination function. It returns the solution vector X to a system of linear equations

use matlab to solve
image text in transcribed
The code below is a working Gaussian elimination function. It returns the solution vector X to a system of linear equations AX=B. You are to create a new function that employs matrix inversion to find the inverse of any size square coefficient matrix A. Use this function to solve the following system: 5X, + 2x2 - 4x3 = -10 10X, -8X2 + 6X2 = 51 15X+ 5X2-7X3 = 33 by finding the inverse of A and then using X=AB in the main program. Present both the inverse of A and the solution for X1, X2, X3 as output. Also show that your solution for the inverse of A is correct by showing the result of A'A. function X = Gauss Elim (A,B) Smake sure Bis in column form BOB(:); determine size of coefficient matrix [nr, nc)=size (A); build Augmented matrix Aug=[AB]: Perform Gaussian Elimination without any error reducing row-swapping for col = 1:nc-1 Scurrent column value being reduced to zero for row - col +1:nr current row value being reduced to zero Sidentify factor to multiply by pivot row factor = -Aug (row, col) /Aug (col, col); Sreplace whole row with new reduced row Aug (row, :) - Aug (col,:) *factor+Aug (row, :); end end Reduce Augmented matrix back into A and B A=Aug (:,1:nc); B-Aug (: , nc+1); Perform back substitution on A and B for i = nr:-1:1 summ=0; fork - (i+1): summ=summ+A(i, k) *X (k); end x(i)-(B(i)-summ) /A(i, i); end X=X(:); $convert solution to column form

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

What is the preferred personality?

Answered: 1 week ago

Question

What is the relationship between humans?

Answered: 1 week ago