0% found this document useful (0 votes)
24K views7 pages

N X X X X 1 0,3 1,5 2,7 - 0,9 2 0,78 1,74 2,7 - 0,18

The document describes the Jacobi method for solving a system of linear equations. It provides an example of applying the Jacobi method to a system of 4 equations with 4 unknowns. It then shows the iterative process of updating the estimates of the unknowns over 12 iterations until convergence is reached with the solutions x1=1, x2=2, x3=3, x4=0. The document also provides the pseudocode for the Jacobi algorithm and a MATLAB program implementing the method on the example system.

Uploaded by

Awalia Santi R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24K views7 pages

N X X X X 1 0,3 1,5 2,7 - 0,9 2 0,78 1,74 2,7 - 0,18

The document describes the Jacobi method for solving a system of linear equations. It provides an example of applying the Jacobi method to a system of 4 equations with 4 unknowns. It then shows the iterative process of updating the estimates of the unknowns over 12 iterations until convergence is reached with the solutions x1=1, x2=2, x3=3, x4=0. The document also provides the pseudocode for the Jacobi algorithm and a MATLAB program implementing the method on the example system.

Uploaded by

Awalia Santi R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Jacobi

Contoh :
Diketahui persamaan : 10x1 2x2 x3 x4 = 3
-2x1 + 10x2 x3 x4 = 15
-x1 x2 + 10x3 2x4 = 27
-x1 x2 2x3 + 10x4 = -9
Persamaan diatas ditulis kembali, sebagai berikut :
x1 = 0,3 + 0,2 x2 + 0,1 x3 + 0,1 x4
x2 = 1,5 + 0,2 x1 + 0,1 x3 + 0,1 x4
x3 = 2,7 + 0,1 x1 + 0,1 x2 + 0,2 x4
x4 = -0,9 + 0,1 x1 + 0,1 x2 + 0,2 x3
x1 = x2 = x3 = x4 = 0, nilai-nilai tersebut disubstitusikan ke persamaan diatas, maka
diperoleh :
x1 = 0,3 + 0,2(0) + 0,1(0) + 0,1(0) = 0,3
x2 = 1,5 + 0,2(0) + 0,1(0) + 0,1(0) = 1,5
x3 = 2,7 + 0,1(0) + 0,1(0) + 0,2(0) = 2,7
x4 = -0,9 + 0,1(0) + 0,1(0) + 0,2(0) = -0,9
x1 = 0,3, x2 = 1,5, x3 = 2,7, x4 = -0,9
x1 = 0,3 + 0,2(1,5) + 0,1(2,7) + 0,1(-0,9) = 0,78
x2 = 1,5 + 0,2(0,3) + 0,1(2,7) + 0,1(-0,9) = 1,74
x3 = 2,7 + 0,1(0,3) + 0,1(1,5) + 0,2(-0,9) = 2,7
x4 = -0,9 + 0,1(0,3) + 0,1(1,5) + 0,2(2,7) = -0,18
x1 = 0,78, x2 = 1,74, x3 = 2,7, x4 = -0,18
x1 = 0,3 + 0,2(1,74) + 0,1(2,7) + 0,1(-0,18) = 0,9
x2 = 1,5 + 0,2(0,78) + 0,1(2,7)+ 0,1(-0,18) = 1,908
x3 = 2,7 +0,1(0,78) + 0,1(1,74) + 0,2(-0,9) = 2,916
x4 = -0,9 + 0,1(0,78) + 0,1(1,74)+ 0,2(2,7) = -0,108

jika proses tersebut dilanjutkan terus akan diperoleh hasil seperti berikut :
n x1 x2 x3 x4
1 0,3 1,5 2,7 -0,9
2 0,78 1,74 2,7 -0,18
3 0,9 1,908 2,916 -0,108
4 0,9624 1,9608 2,9592 -0,036
5 0,845 1,9848 2,9851 -0,0158

Dengan metode jacobi dengan 12 iterasi diperoleh :


x1 = 1, x2 = 2, x3 = 3, x4 = 0

1. Algoritma program jacobi


Input : A, n, b, dan hampiran awal Y = (y1 y2 y3 ... yn)T, batas toleranssi T dan
maksimum iterasi N.
Output : x = (x1 x2 x3 ... xn)T atau pesan gagal
Langkah langkah :
1) Set perhitungan iterasi k = 1
2) While k<=N do
a) For I = 1, 2, 3, ..., n, hitung xi = bi j aijYij/aii
b) Set x = (x1 x2 x3 ... xn)T
c) If x y < T then stop
d) K = k + 1
e) For I = 1, 2, 3, ..., n, set yi = xi
f) Set y = (y1 y2 y3 ... yn)T

2. Program metode jacobi beserta persen kesalahan


Program Jacobi
clear all;
clc;
disp('metode jacobi');
a=input('masukkan batas iterasi=');
x=0;
y=0;
z=0;
w=0;
fprintf('%5s%10s%10s%10s%10s%10s%10s%10s%10s\n','iterasi','x','y','z','w','persen
x','perseny','persenz','persenw');
for k=1:1:a
xi=x;
x1=(3+(2*y)+z+w)/10;
xj=x1;
persenx=abs((xj-xi)/xj*100);
yi=y;
y1=(15+(2*x)+z+w)/10;
yj=y1;
perseny=abs((yj-yi)/yj*100);
zi=z;
z1=(27+x+y+(2*w))/10;
zj=z1;
persenz=abs((zj-zi)/zj*100);
wi=w;
w1=(-9+x+y+(2*z))/10;
wj=w1;
persenw=abs((wj-wi)/wj*100);
x=x1;
y=y1;
z=z1;
w=w1;
fprintf('%5.2f%10.2f%10.2f%10.2f%10.2f%10.2f%10.2f%10.2f%10.2f\n',k,x,y,z,w,p
ersenx,perseny,persenz,persenw);
end

Hasil program
Simpson
9
Contoh : hitung 1 1/ dx dengan satu pias
Penyelesaian :
1+ 3.3/11+ 3.3/19+ 1/9
I = (9 1) = 2,40297714
8

Besarnya kesalahan adalah :


2,19722,40297714
= x 100% = -9,36420267%
2,1972

Aturan 3/8
Input :
Fungsi(x), batas bawah (a), batas atas (b)
Output : nilai
Langkah-langkah :
1) h = (b a)/3
2) c = a + h
3) d = a + 2h
4) rumus = (b a).((fa + 3fc + 3fd + fb)/8)
program
clear all;
clc;
syms x;
f=input('masukkan persamaan=');
a=input('masukkan batas bawah=');
b=input('masukkan batas atas=');
e=int(f);
h=(b-a)/3;
c=a+h;
d=a+(2*h);
fa=subs(f,x,a);
fb=subs(f,x,b);
fc=subs(f,x,c);
fd=subs(f,x,d);
rumus=(b-a)*((fa+(3*fc)+(3*fd)+fb)/8);
bb=subs(e,x,a);
ba=subs(e,x,b);
in=ba-bb;
err=abs(in-rumus)/in*100;
fprintf('nilainya=%10.8f\n',rumus);
fprintf('persen kesalahan=%10.8f\n',err);
hasil
Flowchart jacobi

START

disp('metode
jacobi');
a=input('masukkan
batas iterasi=');

x=0;
y=0;
z=0;

fprintf('%5s%10s%10s%10s
%10s%10s%10s%10s%10s\
n','iterasi','x','y','z','w','persenx'
,'perseny','persenz','persenw');

for k=1:1:a

xi=x;
x1=(3+(2*y)+z+w)/10;
xj=x1;
persenx=abs((xj-xi)/xj*100);
yi=y;
y1=(15+(2*x)+z+w)/10;
yj=y1;
perseny=abs((yj-yi)/yj*100);
zi=z;
z1=(27+x+y+(2*w))/10;
no zj=z1;
persenz=abs((zj-zi)/zj*100);
wi=w;
w1=(-9+x+y+(2*z))/10;
wj=w1;
persenw=abs((wj-wi)/wj*100);
x=x1;
y=y1;
z=z1;
w=w1;

fprintf('%5.2f%10.2f%10.2f%
10.2f%10.2f%10.2f%10.2f%
10.2f%10.2f\
n',k,x,y,z,w,persenx,perseny,p
ersenz,persenw);

END
Flowchart simpson

START

syms x;

f=input('masukkan
persamaan=');
a=input('masukkan batas
bawah=');
b=input('masukkan batas
atas=');

e=int(f);
h=(b-a)/3;
c=a+h;
d=a+(2*h);
fa=subs(f,x,a);
fb=subs(f,x,b);
fc=subs(f,x,c);
fd=subs(f,x,d);
rumus=(b-a)*((fa+(3*fc)+(3*fd)+fb)/8);
bb=subs(e,x,a);
ba=subs(e,x,b);
in=ba-bb;
err=abs(in-rumus)/in*100;

fprintf('nilainya=%
10.8f\n',rumus);
fprintf('persen
kesalahan=%10.8f\
n',err);

END

You might also like