Eliminasi Gauss Seidel
Eliminasi Gauss Seidel
Eliminasi Gauss Seidel
Oleh:
KELOMPOK 3
Rindang Maaris Aadzaar 18709251024
Eka Puspita sari 18709251035
|𝑎𝑖𝑖 | ≥ ∑ 𝑎𝑖𝑗
𝑗=1
𝑗≠𝑖
Jika bukan merupakan matriks dominan diagonal, maka dapat disusun ulang menjadi
sedemikian.
4. Jika elemen diagonal tidak nol, tuliskan kembali masing-masing persamaan untuk
menyelesaikan bilangan yang tak diketahui.
𝑐1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 … − 𝑎1𝑛 𝑥𝑛
𝑥1 =
𝑎11
𝑐2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 … − 𝑎2𝑛 𝑥𝑛
𝑥2 =
𝑎22
⋮
𝑐𝑛−1 − 𝑎𝑛−1.1 𝑥1 − 𝑎𝑛−1.2 𝑥2 … − 𝑎𝑛−1.𝑛−2 𝑥𝑛−2 − 𝑎𝑛−1.𝑛 𝑥𝑛
𝑥𝑛−1 =
𝑎𝑛−1.𝑛−1
𝑐𝑛 − 𝑎𝑛1 𝑥1 − 𝑎𝑛2 𝑥2 − ⋯ − 𝑎𝑛.𝑛−1 𝑥𝑛−1
𝑥𝑛 =
𝑎𝑛𝑛
Atau
𝑐1 −∑𝑛
𝑗=1 𝑎1𝑗 .𝑥𝑗 𝑐𝑛−1 −∑𝑛𝑗=1 𝑎𝑛−1,𝑗 .𝑥𝑗
𝑗≠1 𝑗≠𝑛−1
𝑥1 = 𝑥𝑛−1 =
𝑎11 𝑎𝑛−1,𝑛−1
𝑐2 −∑𝑛
𝑗=1 𝑎2𝑗 .𝑥𝑗 𝑐𝑛 −∑𝑛
𝑗=1 𝑎𝑛𝑗 .𝑥𝑗
𝑗≠2 𝑗≠𝑛
𝑥2 = 𝑥𝑛 =
𝑎22 𝑎𝑛𝑛
1 − 3(0) + 5(1)
𝑥1 = = 0,50000
12
28 − (0,5) − 3(1)
𝑥2 = = 4,9000
5
76 − 3(0,5000) − 7(4,9000)
𝑥3 = = 3,0923
13
0,5000 − 1,000
|𝑒𝑎 |1 = | | 100% = 100,00%
0,5000
4,9000 − 0
|𝑒𝑎 |2 = | | 100% = 100,00%
4,9000
3,0923 − 1,000
|𝑒𝑎 |3 = | | 100% = 67,662%
3,0923
𝑥1 0,99919
[𝑥2 ] = [ 3,0001 ]
𝑥3 4,0001
for i=1:n
sigma=0;
for j=1:i-1
sigma=sigma+A(i,j)*x(j);
end
for j=i+1:n
sigma=sigma+A(i,j)*x_old(j);
end
x(i)=(1/A(i,i))*(b(i)-sigma);
end
itr=itr+1;
normVal=norm(x_old-x);
end
%%
fprintf('Solution of the system is : \n%f\n%f\n%f\n%f in %d
iterations',x,itr);
Output
A=
12 3 -5
1 5 3
3 7 13
b=
1
28
76
x=
1
0
1
Solution of the system is :
0.999195
3.000109
4.000127