Professional Documents
Culture Documents
L/O/G/O
1 2
Metode Yacobi Metode Gauss Siedel Click to add title in here Click to add title in here
Tujuan:
oMenyelesaikan dan membandingkan sistem persamaan linier dengan menggunakan metode tak langsung, yaitu metode Yacobi dan Gauss Siedel
[ Image information in product ] Title Image - www.themegallery.com Note to customers : This image has been licensed to be used within this PowerPoint template only. You may not extract the image for any other use.
Metode Yacobi
Dasar Teori
oBermula dari suatu hampuran penyelesaian awal dan kemudian berusaha memperbaiki hampiran dalam tak berhingga,namun langkah konvergen oDisebut juga metode iterasi Jacobi
Metode Yacobi
Algoritma
1. Melakukan pendekatan awal x1(1) menghitung masing-masing komponen untuk n=1,2,3,...,n dengan persamaan
2. Pendekatan x1(2) , x2
(2)
, x2(1)
Metode Yacobi
Listing
clc; clear; n=input('jumlah persamaan='); tol=input('toleransi='); a=[0.24 0.07 0.1;0.55 0.93 0;0.21 0 0.9]; c=[100;620;280]; for i=1:n; x(i)=input('masukan x trial='); end eror=1; ite=0; for i=1:n; p=2; L=1; z=1; while z~=0; if abs (a(i,p))>abs(a(i,L)); L=p; end if p==n; z=0; else p=p+1; z=1; end end for j=1:n; anew(L,j)=a(i,j); end cnew(L)=c(i); end
Metode Yacobi
a=anew; c=cnew; while max(eror)>tol; ite=ite+1; for i=1:n; jum=0; for j=1:n; if j~=i; jum=jum+a(i,j)*x(j); end end xnew(i)=(c(i)-jum)/a(i,i); end for i=1:n; eror(i)=abs((xnew(i)-x(i))/x(i)); x(i)=xnew(i); end end for i=1:n; disp (['x',num2str(i),'=',num2str(x(i))]); disp(x(i)); end ite max(eror)
2 Metode Gauss-Siedel
Dasar Teori
oDigunakan untuk menyelesaikan sistem persamaan linier yang berukuran besar dan proporsi koefisien nol-nya besar (space matriks)
2 Metode Gauss-Siedel
Algoritma
1. Menghitung x1 k
2. Mengatur sistem persamaan hingga harga absolut sistem diagonal koefisien sebesar-besarnya
1 Metode Gauss-Siedel
Algoritma
3. Menghentikan iterasi dan syarat konvergensi sama dengan metode GaussSiedell
2 Metode Gauss-Siedel
Listing
clc; clear; n=input('jumlah persamaan='); tol=0.00001; a=[0.24 0.07 0.1;0.55 0.93 0;0.21 0 0.9]; c=[100;620;280]; for i=1:n; x(i)=input('masukan x trial='); end eror=1; ite=0; for i=1:n; p=2; L=1; z=1; while z~=0; if abs(a(i,p))>abs(a(i,L)); L=p; end if p==n; z=0; else p=p+1; z=1; end end
2 Metode Gauss-Siedel
Listing
for j=1:n; anew(L,j)=a(i,j); end cnew(L)=c(i); end a=anew; c=cnew; while max(eror)>tol; ite=ite+1; for i=1:n; jum=0; for j=1:n; if j~=i; jum=jum+a(i,j)*x(j); end end xnew(i)=(c(i)-jum)/a(i,i); eror(i)=abs((xnew(i)-x(i))/x(i)); x(i)=xnew(i); end end for i=1:n; disp (['x',num2str(i),'=',num2str(x(i))]); disp(x(i)); end ite max(eror)
Thank You!
www.themegallery.com
L/O/G/O