METODE ELIMINASI GAUSS JORDAN.Metode ini merupakan pengembangan metode eliminasi Gauss, hanya saja augmented matrik, pada sebelah kiri diubah menjadi matrik diagonal.Penyelesaian dari persamaan linier simultan diatas adalah nilai d1,d2,d3,dn dan atau: » » » » » » ¼ º « « « « « « ¬ ª n n n nn n n n n a a a a b a a a a b.
Gauss elimination and Gauss Jordan methods using MATLAB code
gauss.m
% Code from 'Gauss elimination and Gauss Jordan methods using MATLAB' |
% https://www.youtube.com/watch?v=kMApKEKisKE |
a = [34 -222 |
49 -358 |
-2 -37610 |
14672]; |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%Gauss elimination method [m,n)=size(a); |
[m,n]=size(a); |
for j=1:m-1 |
for z=2:m |
if a(j,j)0 |
t=a(j,:);a(j,:)=a(z,:); |
a(z,:)=t; |
end |
end |
for i=j+1:m |
a(i,:)=a(i,:)-a(j,:)*(a(i,j)/a(j,j)); |
end |
end |
x=zeros(1,m); |
for s=m:-1:1 |
c=0; |
for k=2:m |
c=c+a(s,k)*x(k); |
end |
x(s)=(a(s,n)-c)/a(s,s); |
end |
disp('Gauss elimination method:'); |
a |
x' |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
% Gauss-Jordan method |
[m,n]=size(a); |
for j=1:m-1 |
for z=2:m |
if a(j,j)0 |
t=a(1,:);a(1,:)=a(z,:); |
a(z,:)=t; |
end |
end |
for i=j+1:m |
a(i,:)=a(i,:)-a(j,:)*(a(i,j)/a(j,j)); |
end |
end |
for j=m:-1:2 |
for i=j-1:-1:1 |
a(i,:)=a(i,:)-a(j,:)*(a(i,j)/a(j,j)); |
end |
end |
for s=1:m |
a(s,:)=a(s,:)/a(s,s); |
x(s)=a(s,n); |
end |
disp('Gauss-Jordan method:'); |
a |
x' |
![4x4 4x4](/uploads/1/2/6/2/126259011/770785716.jpg)
commented Mar 25, 2015
what is the difference bw gauss Jordan method and gauss Jordan elimination |
commented Sep 8, 2016 • edited
edited
in line 14 , it will be for z=j+1:m otherwise for z=2:m will not work for a=[2 1 -1 2 5 4 5 -3 6 9 4 2 -2 9 8 4 11 -4 8 2]; |
commented Nov 9, 2016
a(j,:) means? |
commented Dec 8, 2016
![Jordan Jordan](/uploads/1/2/6/2/126259011/553787243.jpg)
Can i get the matlab gui implementation of gauss elimination ? |
commented Dec 19, 2016
Good job |
commented Apr 26, 2018
if your matrix is changed as shown below, does your program work? a = [3 4 -2 2 2 4 0 -3 5 8 -2 -3 0 6 10 1 4 6 7 2]; thanks |
commented Dec 20, 2018 • edited
edited
commented Feb 14, 2019 • edited
edited
Can we find inverse using this method ? What is the final output which we get ? |
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment