Tujuan : Mencari nilai turunan suatu fungsi yang sangat sulit dihitung dengan menggunakan
( + ) ()
() =
a. Secara Geometris
2
+1 = + + " +
2
2
= +1 "
2
+1
= "
2
+1
= + ()
Yang dalam hal ini O(h) = 2 " , xi< t <xi+1
clc
clear all
disp('--------------***** Differensial Kelompok Cantik *****-------------- ')
disp('-------------------------------------------------------------------- ')
disp(' no h fx fMaju feks Error ')
disp('-------------------------------------------------------------------- ')
h=0.1;
x=0;
for no=1:10;
fx=f(x);
fMaju=(f(x+h)-f(x))/h;
feks=g(x);
error=abs(fMaju-feks);
disp(sprintf('%5g %12.8f %12.8f %12.8f %12.8f %12.8f',
no,h,fx,fMaju,feks,error))
x=x+h;
end
- Listing fungsi
function y=f(x)
y=((exp(-x))*sin(2*x))+1;
end
function g=g(x)
g=((exp(-x))*(2*cos(2*x)-sin(2*x)));
d. Contoh soal
Dengan menggunakan metode Selisih Maju pada Matlab, hitunglah differensial
f(x)=e-xsin(2x)+1 dari range x=[0] dengan h=0.1 hingga x= [0,5]. Kemudian
bandingkan lihat errornya
Hasil dengan menggunakan program matlab
() ( )
() =
a. Secara Geometris
Gambar 2. Kurva metode selisih mundur
b. Perolehan Rumus
Rumus-rumus turunan numerik diperoleh dari deret taylor dengan memisalkan,
diberikan titik-titik (xi,fi) i=1,2,...,n yang dalam hal ini
= 0 + dan = ( )
Uraikan f(xi-1) disekitar xi
(+1 ) ( ) (+1 )2 "( )
(1 ) = ( ) +
1! 2!
2
1 = + "
2
2
= 1 + "
2
1
= "
2
1
= + ()
Yang dalam hal ini O(h) = 2 " , xi< t <xi+1
clc
clear all
disp('--------------***** Differensial Kelompok Cantik *****--------------
')
disp('--------------------------------------------------------------------
')
disp(' no h fx fMaju feks Error
')
disp('--------------------------------------------------------------------
')
h=0.1;
x=0;
for no=1:10;
fx=f(x);
fMaju=(f(x+h)-f(x))/h;
feks=g(x);
error=abs(fMaju-feks);
disp(sprintf('%5g %12.8f %12.8f %12.8f %12.8f %12.8f',
no,h,fx,fMaju,feks,error))
x=x+h;
end
-
-
d. Contoh soal
Dengan menggunakan metode Selisih Mundue pada Matlab, hitunglah differensial
f(x)=e-xsin(2x)+1 dari range x=[0] dengan h=0.1 hingga x= [0,5]. Kemudian
bandingkan lihat errornya
clc
clear all
disp('--------------***** Differensial Kelompok Cantik *****--------------
')
disp('--------------------------------------------------------------------
')
disp(' no h fx fMaju feks Error
')
disp('--------------------------------------------------------------------
')
h=0.1;
x=0;
for no=1:10;
fx=f(x);
fMaju=(f(x+h)-f(x))/h;
feks=g(x);
error=abs(fMaju-feks);
disp(sprintf('%5g %12.8f %12.8f %12.8f %12.8f %12.8f',
no,h,fx,fMaju,feks,error))
x=x+h;
end
2
1 = + "
2
2
= 1 + "
2
1
= "
2
1
= + ()
Yang dalam hal ini O(h) = 2 " , xi< t <xi+1
clear
clc
disp(' "Interpolasi Linier" ')
disp(' Press Enter to continue ')
pause
%%
disp(' Interpolasi Linier Kelompok 2');
disp(' Prodi Matematik FMIPA UNIB ')
disp('===============2===============');
x=input ('masukkan nilai x= ');
x1=input('masukkan nilai x1= ');
x2=input('masukkan nilai x2= ');
y1=input('masukkan nilai y1= ');
y2=input('masukkan nilai y2= ');
y=(((x-x1)/(x2-x1))*(y2-y1))+y1;
disp(y);
d. Contoh soal
Dengan menggunakan metode Selisih Mundue pada Matlab, hitunglah differensial
f(x)=e-xsin(2x)+1 dari range x=[0] dengan h=0.1 hingga x= [0,5]. Kemudian
bandingkan lihat errornya