Professional Documents
Culture Documents
%soal no 1 a
A=[-0.005 1 1;1 2 1;-3 -1 6]
A =
-0.0050
1.0000
-3.0000
1.0000
2.0000
-1.0000
1.0000
1.0000
6.0000
b=[2;4;2]
b =
2
4
2
gauss(A,b)
ans =
0
0
0.9938
gauss(A,b)
ans =
0
0
0.9938
gauss(A,b)
ans =
0.9840
1.0111
0.9938
%metode LU decomposition
ludec
{Error using <a href="matlab:helpUtils.errorDocCallback('ludec', 'E:\semester 5\K
OMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semester 5\KOMPUTASI\MATLAB1\1202101020
71_modul5\ludec.m', 2)" style="font-weight:bold">ludec</a> (<a href="matlab: ope
ntoline('E:\semester 5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semester 5\KOMP
UTASI\MATLAB1\120210102071_modul5\ludec.m',2,0)">line 2</a>)
Not enough input arguments.
}
ludec(A,b)
x =
0.9840
1.0111
0.9938
ans =
0.9840
1.0111
0.9938
% soal no 1b
A=[1 -1 2;2 -2 1;3 -2 7]
A =
1
2
3
-1
-2
-2
2
1
7
b=[5;1;20]
b =
5
1
20
%metode eliminasi gauss
gauss(A,b)
ans =
NaN
NaN
NaN
%metode LU decomposition
ludec(A,b)
x =
NaN
NaN
NaN
ans =
NaN
NaN
NaN
%soal no 1c
A=[1.34 7.2 1.04;3.18 4.01 0.980;2.84 -24.0 -2.24]
A =
1.3400
7.2000
3.1800
4.0100
2.8400 -24.0000
1.0400
0.9800
-2.2400
b=[9.60;8.1700;-23.4000]
b =
9.6000
8.1700
-23.4000
gauss(A,b)
ans =
0.2913
0.5171
5.2756
ludec(A,b)
x =
0.2913
0.5171
5.2756
ans =
0.2913
0.5171
5.2756
%soal no 2
x0=[0;0;0;0];
A=[5 7 6 5;7 10 8 7;6 8 10 9;5 7 9 10]
A =
5
7
6
5
7
10
8
7
b=[1;-1;-1;1]
b =
1
-1
-1
1
tol=10e-6
tol =
1.0000e-05
maks=50
maks =
6
8
10
9
5
7
9
10
50
jacobian
{Error: <a href="matlab: opentoline('E:\semester 5\KOMPUTASI\MATLAB1\MATLAB R2012
a\%drive_E%\semester 5\KOMPUTASI\MATLAB1\120210102071_modul5\jacobian.m',12,11)"
>File: jacobian.m Line: 12 Column: 11</a>
The expression to the left of the equals sign is not a valid target for an assig
nment.
}
%metode jacobian
jacobian(A,b)
{Error: <a href="matlab: opentoline('E:\semester 5\KOMPUTASI\MATLAB1\MATLAB R2012
a\%drive_E%\semester 5\KOMPUTASI\MATLAB1\120210102071_modul5\jacobian.m',12,11)"
>File: jacobian.m Line: 12 Column: 11</a>
The expression to the left of the equals sign is not a valid target for an assig
nment.
}
jacobian(A,b)
{Error: <a href="matlab: opentoline('E:\semester 5\KOMPUTASI\MATLAB1\MATLAB R2012
a\%drive_E%\semester 5\KOMPUTASI\MATLAB1\120210102071_modul5\jacobian.m',13,11)"
>File: jacobian.m Line: 13 Column: 11</a>
Expression or statement is incorrect--possibly unbalanced (, {, or [.
}
jacobian(A,b)
{Error using <a href="matlab:helpUtils.errorDocCallback('jacobian', 'E:\semester
5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semester 5\KOMPUTASI\MATLAB1\1202101
02071_modul5\jacobian.m', 2)" style="font-weight:bold">jacobian</a> (<a href="ma
tlab: opentoline('E:\semester 5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semest
er 5\KOMPUTASI\MATLAB1\120210102071_modul5\jacobian.m',2,0)">line 2</a>)
Not enough input arguments.
}
jacobian(A,b)
{Error using <a href="matlab:helpUtils.errorDocCallback('jacobian', 'E:\semester
5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semester 5\KOMPUTASI\MATLAB1\1202101
02071_modul5\jacobian.m', 2)" style="font-weight:bold">jacobian</a> (<a href="ma
tlab: opentoline('E:\semester 5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semest
er 5\KOMPUTASI\MATLAB1\120210102071_modul5\jacobian.m',2,0)">line 2</a>)
Not enough input arguments.
}
jacobian(A,b)
{Error using <a href="matlab:helpUtils.errorDocCallback('jacobian', 'E:\semester
5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semester 5\KOMPUTASI\MATLAB1\1202101
02071_modul5\jacobian.m', 2)" style="font-weight:bold">jacobian</a> (<a href="ma
tlab: opentoline('E:\semester 5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semest
er 5\KOMPUTASI\MATLAB1\120210102071_modul5\jacobian.m',2,0)">line 2</a>)
Not enough input arguments.
}
jacobian(A,b)
{Error using <a href="matlab:helpUtils.errorDocCallback('jacobian', 'E:\semester
5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semester 5\KOMPUTASI\MATLAB1\1202101
02071_modul5\jacobian.m', 2)" style="font-weight:bold">jacobian</a> (<a href="ma
tlab: opentoline('E:\semester 5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semest
er 5\KOMPUTASI\MATLAB1\120210102071_modul5\jacobian.m',2,0)">line 2</a>)
Not enough input arguments.
}
jacobian
{Error using <a href="matlab:helpUtils.errorDocCallback('jacobian', 'E:\semester
5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semester 5\KOMPUTASI\MATLAB1\1202101
02071_modul5\jacobian.m', 2)" style="font-weight:bold">jacobian</a> (<a href="ma
2
1
-1
3
5
3
5
-1
3
-5
1
2
b=[-3;3;-2;3];
maks=50
maks =
50
SOR
{Error using <a href="matlab:helpUtils.errorDocCallback('SOR', 'E:\semester 5\KOM
PUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semester 5\KOMPUTASI\MATLAB1\120210102071
_modul5\SOR.m', 2)" style="font-weight:bold">SOR</a> (<a href="matlab: opentolin
e('E:\semester 5\KOMPUTASI\MATLAB1\MATLAB R2012a\%drive_E%\semester 5\KOMPUTASI\
MATLAB1\120210102071_modul5\SOR.m',2,0)">line 2</a>)
Not enough input arguments.
}
SOR(A,b,x0,w,tol,maks)
C =
0
-2
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 *
0.6399
-4.4725
-0.8820
8.1165
%kesimpulan : semakin besar nilai maks yang dituliskan maka akan mendapatkan nil
ai SOR yang semakin besar pula sedangkan nilai w tidak berubah
diary off