Professional Documents
Culture Documents
%soal no 1
R1=5;
R2=10;
R3=5;
R4=15;
R5=10;
R6=20;
Va=200;
Vb=0;
fschange('D:\Kuliah\Semester V\Komputasi Fisika\UTS bagian 2\soal_1a.m');
clear soal_1a
uiopen('D:\Kuliah\Semester V\Komputasi Fisika\UTS bagian 2\gauss.m',1)
%soal no 1
%metode gauss
A=[15 5 10 -10;20 10 5 0]
A =
15
20
5
10
10
5
-10
0
b=[0;-200]
b =
0
-200
gauss(A,b)
??? Index exceeds matrix dimensions.
Error in ==> <a href="error:D:\Kuliah\Semester V\Komputasi Fisika\UTS bagian 2\g
auss.m,7,1">gauss at 7</a>
m=-A(i+1:n,i)/A(i,i);
%metode jacobi
A=[15 5 10 -10;20 10 5 0]
A =
15
20
b=[0;-200]
5
10
b =
0
-200
x0=[1;1]
x0 =
1
10
5
-10
0
1
tol=10e-6
tol =
1.0000e-005
maks=50
maks =
50
uiopen('D:\Kuliah\Semester V\Komputasi Fisika\UTS bagian 2\jacobian.m',1)
jacobian(A,b,x0,maks)
ans =
19.9992
-59.9976
uiopen('D:\Kuliah\Semester V\Komputasi Fisika\UTS bagian 2\gauss_seidel.m',1)
%metode gauss_seidel
A=[15 5 10 -10;20 10 5 0]
A =
15
20
5
10
10
5
-10
0
b=[0;-200]
b =
0
-200
x0=[1;1]
x0 =
1
1
tol=10e-6
tol =
1.0000e-005
maks=50
maks =
50
gauss_seidel(A,b,x0,tol,maks)
f x1 x2 x3 ...
??? Error using ==> mtimes
5
10
10
5
-10
0
b=[0;-200]
b =
0
-200
x0=[1;1]
x0 =
1
1
tol=10e-6
tol =
1.0000e-005
maks=50
maks =
50
fschange('D:\Kuliah\Semester V\Komputasi Fisika\UTS bagian 2\SOR.m');
clear sor
w=1.75
w =
1.7500
SOR(A,b,x0,w,tol,maks)
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> <a href="error:D:\Kuliah\Semester V\Komputasi Fisika\UTS bagian 2\S
OR.m,15,1">SOR at 15</a>
x(j)=(1-w)*xlama(j)+w*(C(j,:)*x+r(j));
% soal nomor 2
uiopen('D:\matlab\MATLAB 7\120210102027_Defrin Yuniar KS_UTS2\tpalsu.m',1)
uiopen('D:\matlab\MATLAB 7\120210102027_Defrin Yuniar KS_UTS2\newt.m',1)
iter =
0
f =
2.0369
f =
9.0742
f =
0.2564
f =
6.8404
f =
0.0065
f =
6.4969
f =
4.4791e-006
f =
6.4879
f =
2.1574e-012
metode newton telah korvergen
ans =
2.0000
1.4375
1.2130
1.1756
1.1746
1.1746
% metode secant
secant('soal_2',2,4,10e-6,10)
f =
9
f =
77
f =
5.2366
f =
3.3352
f =
0.7369
f =
0.1544
f =
0.0105
f =
1.6994e-004
f =
1.9224e-007
f =
3.5114e-012
metode newton telah konvergen
ans =
2.0000
4.0000
1.7353
1.5700
1.2802
1.1980
1.1762
1.1746
1.1746
1.1746
% kesimpulan : dengan menggunakan metode biseksi, posisi palsu, newton raphson,
dan secant dapat dismpulkan bahwa benda tersebut melewati titik asalnya setelah
menempuh waktu 1,1746 s
% soal no 1
% metode eliminasi gauss
uiopen('D:\matlab\MATLAB
uiopen('D:\matlab\MATLAB
)
uiopen('D:\matlab\MATLAB
uiopen('D:\matlab\MATLAB
A=[0 10 5 15 -10 0;5 0 0
b=[0;200;0];
gauss(A,b)
??? Index exceeds matrix
-9.5120e+013
p=c/2*m
p =
8.4000e+012
fschange('D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.m');
clear soal_3
% metode bagi dua
bagidua('soal_3',2,3,10e-6)
??? Error: File: D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.
m Line: 2 Column: 20
Missing MATLAB operator.
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\bagidua.m,3,1">bagidua at 3</a>
fa=feval(f,a);
fschange('D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.m');
clear soal_3
bagidua('soal_3',2,3,10e-6)
??? Error: File: D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.
m Line: 2 Column: 74
This statement is incomplete.
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\bagidua.m,3,1">bagidua at 3</a>
fa=feval(f,a);
fschange('D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.m');
clear soal_3
bagidua('soal_3',2,3,10e-6)
??? Error: File: D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.
m Line: 2 Column: 76
This statement is incomplete.
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\bagidua.m,3,1">bagidua at 3</a>
fa=feval(f,a);
fschange('D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.m');
clear soal_3
bagidua('soal_3',2,3,10e-6)
??? Undefined function or variable 'e'.
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\soal_3.m,2,1">soal_3 at 2</a>
f=e^-((-n)*x)*((m*cos*p*x)+(m*sin*p*x))
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\bagidua.m,3,1">bagidua at 3</a>
fa=feval(f,a);
fschange('D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.m');
clear soal_3
bagidua('soal_3',2,3,10e-6)
??? Undefined function or variable 'e'.
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\soal_3.m,2,1">soal_3 at 2</a>
f=e^-((--9.5120e+013)*x)*((1200000*cos*8.4000e+012*x)+(1200000*sin*8.4000e+012*x
))
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\bagidua.m,3,1">bagidua at 3</a>
fa=feval(f,a);
fschange('D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.m');
clear soal_3
bagidua('soal_3',2,3,10e-6)
??? Undefined function or variable 'e'.
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\soal_3.m,2,1">soal_3 at 2</a>
f=e^-((-9.5120e+013)*x)*((1200000*cos*8.4000e+012*x)+(1200000*sin*8.4000e+012*x)
)
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\bagidua.m,3,1">bagidua at 3</a>
fa=feval(f,a);
fschange('D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.m');
clear soal_3
bagidua('soal_3',2,3,10e-6)
??? Undefined function or variable 'e'.
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\soal_3.m,2,1">soal_3 at 2</a>
f=e^9.5120e+013*x*((1200000*cos*8.4000e+012*x)+(1200000*sin*8.4000e+012*x))
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\bagidua.m,3,1">bagidua at 3</a>
fa=feval(f,a);
tpalsu('soal_3',2,3,10e-6)
??? Undefined function or variable 'e'.
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\soal_3.m,2,1">soal_3 at 2</a>
f=e^9.5120e+013*x*((1200000*cos*8.4000e+012*x)+(1200000*sin*8.4000e+012*x))
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\tpalsu.m,3,1">tpalsu at 3</a>
fa=feval(f,a)
fschange('D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.m');
clear soal_3
bagidua('soal_3',2,3,10e-6)
??? Error: File: D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_UTS2\soal_3.
m Line: 2 Column: 5
Incomplete or misformed expression or statement.
Error in ==> <a href="error:D:\matlab\MATLAB 7\120210102027_Defrin Yuniar K.S_U
TS2\bagidua.m,3,1">bagidua at 3</a>
fa=feval(f,a);
diary off