Question

In: Electrical Engineering

Show and explain Gauss-Jordan elimination using Matlab.

Show and explain Gauss-Jordan elimination using Matlab.

Solutions

Expert Solution

Ques:

Ans: To solve Gauss-Jordan elimination Method, i consider a linear equation of 4 variable.

the Below code to solve this by this method

Matlab code:

close all
clear all
clc

syms x y z w
%Converting Linear Simultaneous Equations to Matrix form
eqns=[6*x+2*y+2*z+4*w==1,-x+2*y+2*z-3*w==-1, x+2*z+3*w==1,y+z+4*w==2];
vars=[ x y z w];
% a is the matrix of co-efficient
% b is the matrix of constants
[a,b]=equationsToMatrix(eqns,vars)
% m is the row
% c is the column
[m,c]=size(a);
j=1; %j th column
k=1;%k th row
n=1;% n th pivoting row
z=2;% Row operation always starts from 2
% Forward Elimination
% Shifting Loop for column operation
for i=1:c-1
%Making each desired column component zero
for r=z:m
% Checking if any Lower triangle is Already Zero or not
if a(r,j)==0
% If any is zero left the entire row as it is and skip the step
a(r,:)=a(r,:);b(r,:)=b(r,:);
else
b(r,:)=((a(r,j)/a(k,j))*b(n,:))-b(r,:)
a(r,:)=((a(r,j)/a(k,j))*a(n,:))-a(r,:)
end
end
k=k+1;% Changing row after completion of inner loop
n=n+1;% Changing the pivoting row
z=z+1;% Setting a new condition for inner loop
j=j+1;% Changing column after completion of inner loop
end
% Converting all the diagonal elements to one
for row=1:m
b(row,:)=b(row,:)/a(row,row)
a(row,:)=a(row,:)/a(row,row)
end
D=c;
for q=1:D-1
for rowJ=m-1:-1:1
if a(rowJ,c)==0
a(rowJ,:)=a(rowJ,:);b(rowJ,:)=b(rowJ,:);
else
b(rowJ,:)=b(rowJ,:)-(a(rowJ,c)*b(m,:))
a(rowJ,:)=a(rowJ,:)-(a(rowJ,c)*a(m,:))
end
end
m=m-1;
c=c-1;
end
% x,y,z,w is nothing but cofficient of b
x = b(1)
y = b(2)
z = b(3)
w = b(4)

Result:

number of iteration is more, so i can't display whole result that's why i will show you final result. in this code you can see every iteration result.


Related Solutions

Use either Gaussian elimination or Gauss-Jordan elimination to solve the given system or show that no...
Use either Gaussian elimination or Gauss-Jordan elimination to solve the given system or show that no solution exists. (Please show clear steps and explain them) x1 + x2 + x3 = 7 x1 − x2 − x3 = −3 3x1 + x2 + x3 = 11
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
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....
Gauss Jordan elimination using python for a 2d list (3x3) without using any library. Thanks
Gauss Jordan elimination using python for a 2d list (3x3) without using any library. Thanks
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!
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) =
how to write coding in matlab using gauss elimination method for equation 10a + 50b +...
how to write coding in matlab using gauss elimination method for equation 10a + 50b + 20c + 10d = 100 5a + 15b + 75c - 25d=200 25a -15c - 5d = 300 10a + 20b - 30c + 100d = 400
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT