Question

In: Computer Science

Using Matlab's FUNCTION FILE Solve this system of equations using Gauss Elimination in MATLAB by writing...

Using Matlab's FUNCTION FILE

Solve this system of equations using Gauss Elimination in MATLAB by writing a Function file.

10y + z = 2

x + 3y – z = 6

2x + 4y + z = 5

Could you also provide me with a copiable function file of Matlab and the associated screenshot. Thank you!

Solutions

Expert Solution

function C = gauss_elimination(A,B)

A= [ 0 1 2; 10 3 4; 1 -1 1]

B = [-2; 6; 5]

    i = 1;

    X = [ A B ];

    [ nX mX ] = size( X);

    while i <= nX

        if X(i,i) == 0

            disp('Diagonal element zero')

            return

        end

        X = elimination(X,i,i);

        i = i +1;

    end    

    C = X(:,mX);

function X = elimination(X,i,j)

[ nX mX ] = size( X);

a = X(i,j);

X(i,:) = X(i,:)/a;

for k =  1:nX

    if k == i

        continue

    end

    X(k,:) = X(k,:) - X(i,:)*X(k,j);

end

As per the matrix a1,a2,a3 ; b1,b2,b3 you can change the values of matrix A(coefficient matrix) and matrix B(result matrix) and get any equation solved.


Related Solutions

1) Solve the system of linear equations, using the Gauss-Jordan elimination method. (If there is no...
1) Solve the system of linear equations, using the Gauss-Jordan elimination method. (If there is no solution, enter NO SOLUTION. If there are infinitely many solutions, express your answer in terms of the parameters t and/or s.) 3y + 2z = 1 2x − y − 3z = 4 2x + 2y − z = 5 (x, y, z) = 2) Solve the system of linear equations, using the Gauss-Jordan elimination method. (If there is no solution, enter NO SOLUTION....
Solve the following system of equations using Gaussian or​ Gauss-Jordan elimination. w + x + y...
Solve the following system of equations using Gaussian or​ Gauss-Jordan elimination. w + x + y + z = -2 2w +2x - 2y - 2z = -12 3w - 2x + 2y + z = 4 w - x + 7y + 3z = 4
Solve the system of linear equations using the Gauss-Jordan elimination method. 2x + 2y + z...
Solve the system of linear equations using the Gauss-Jordan elimination method. 2x + 2y + z = 3 x + z = 2 4y − 3z = 13 solve for x,y,x
Solve the system of linear equations using the Gauss-Jordan elimination method. 2x + 3y - 2z...
Solve the system of linear equations using the Gauss-Jordan elimination method. 2x + 3y - 2z = 8 3x - 2y + 2z = 2 4x - y + 3z = 2 (x, y, z) = ?
1) Solve the system of linear equations using the Gauss-Jordan elimination method. 2x + 4y −...
1) Solve the system of linear equations using the Gauss-Jordan elimination method. 2x + 4y − 6z = 56 x + 2y + 3z = −2 3x − 4y + 4z = −21 (x, y, z) = 2) Solve the system of linear equations using the Gauss-Jordan elimination method. 5x + 3y = 9 −2x + y = −8 (x, y) =
Write a MATLAB function function = pivGauss(.....) to solve linear equations using Gaussian Elimination with Partial...
Write a MATLAB function function = pivGauss(.....) to solve linear equations using Gaussian Elimination with Partial Pivoting. You'll need to employ Nested Loops. Thank you !
Solve the system using either Gaussian elimination with back-substitution or Gauss-Jordan elimination. (If there is no...
Solve the system using either Gaussian elimination with back-substitution or Gauss-Jordan elimination. (If there is no solution, enter NO SOLUTION. If the system has an infinite number of solutions, express x, y, z, and w in terms of the parameters t and s.) 4x + 12y − 7z − 20w = 20 3x + 9y − 5z − 28w = 36 (x, y, z, w) = ( ) *Last person who solved this got it wrong
Please Answer 1-3 for me 1. Solve the system of linear equations using the Gauss-Jordan elimination...
Please Answer 1-3 for me 1. Solve the system of linear equations using the Gauss-Jordan elimination method. 2x1 − x2 + 3x3 = −16 x1 − 2x2 + x3 = −5 x1 − 5x2 + 2x3 = −11 (x1, x2, x3) = ( ) 2. Formulate a system of equations for the situation below and solve. For the opening night at the Opera House, a total of 1000 tickets were sold. Front orchestra seats cost $90 apiece, rear orchestra seats...
Show and explain Gauss-Jordan elimination using Matlab.
Show and explain Gauss-Jordan elimination using Matlab.
write a Matlab function file to solve system Ax=b by using the output of the function...
write a Matlab function file to solve system Ax=b by using the output of the function lufac2a your function should have inputs f=matrix return from lufac2a, piv=array return by lufac2a and b=right hand side of your system.the only output for your system should be x guideline 1.use the column access for the matrix entries 2. do not create any other matrix in your function-get your data directly from the matrix passed into your function 3.do not use Matlab command designed...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT