HDQ Basith Studio

Specialized for graphic design and 3D modelling.

Selasa, 17 April 2012

Contoh Metode Bisection dengan Fortran

Selamat menikmati.... !Metode bisection real :: a; a=-1; x=35; g=9.81 Vo=20; yo=2; pi=acos(a); print*,'Masukkan tebakan 1 '; read*,Te1 print*,'Masukkan tebakan 2 '; read*,Te2 Te1=Te1/180*pi; Te2=Te2/180*pi; Te3=Te1; z1=tan(Te1)*x-g*x**2/(2*Vo**2*cos(Te1)**2)+yo-1; z2=tan(Te2)*x-g*x**2/(2*Vo**2*cos(Te2)**2)+yo-1; if (z1<0) then     Te1=Te1; else     Te1=Te2     Te2=Te3; endif i=0 if (z1*z2<0) then     do i=1,100     y=(Te1+Te2)/2     if ((tan(y)*x)-(g*x**2/(2*Vo**2*cos(y)**2))+yo-1<0)...

Contoh Metode Bisection dengan Bahasa C/C++

Silahkan dicoba... #include #include #include int main() {     float m,x,y,i,g,Vo,yo,z1,z2,Hasil,pi,a,b;     float Te1,Te2,Te3;     pi=acos(-1); x=35; g=9.81; Vo=20; yo=2; printf("Program Bisection\ntan(sudut)*35-(9.81*35^2/(2*20*20*(cos(sudut))^2)+1=0\n\n"); for (a=1;a<3;a++) {     printf("Masukkan tebakan kiri  (dalam sudut) : ");     scanf("%f",&Te1);     printf("Masukkan tebakan kanan (dalam sudut) : ");     scanf("%f",&Te2);    ...

Kamis, 12 April 2012

Metode Gauss dengan Matlab

Ini adalah contoh metode Gauss untuk menyelesaikan persamaan linier dengan 2 atau lebih variabel. Saya rasa script ini sudah cukup sempurna karena belum saya jumpai error. Silahkan dicoba.... disp('=====================================================================') a=[cosd(30) 0 -cosd(45) 0 0 0 0; sind(30) 0 sind(45) 0 0 0 0; -cosd(30) -1 0 0 0 0 0; -sind(30) 0 0 0 -1 0 0; 0 0 cosd(45) 1 0 -1 0; 0 0 -sind(45) 0 0 0 -1; 0 1 0 -1 0 0 0]; b=[1200; -600; 0; 0; 0; 0; 0]; c=a; d=b; n=7; for i=1:n-1;     if a(1,1)==0;    ...

Metode Bisection dengan Matlab

Ini adalah contoh script metode bisection menggunakan matlab. Silahkan dianalisa dan diedit sendiri. 'Ujian Matlab 8.36'; 'Metode Bisection'; 'fungsi y=tan(Te)*x-g*x^2/(2*Vo^2*cos(Te)^2)+yo'; x=35; g=9.81; Vo=20; yo=2; Te1=input('masukkan tebakan kiri  (dalam derajat) : '); Te2=input('masukkan tebakan kanan (dalam derajat) : '); Te1=Te1/180*pi; Te2=Te2/180*pi; Te3=Te1; z1=tan(Te1)*x-g*x^2/(2*Vo^2*cos(Te1)^2)+yo-1; z2=tan(Te2)*x-g*x^2/(2*Vo^2*cos(Te2)^2)+yo-1; if z1<0;     Te1=Te1; else Te1=Te2;     Te2=Te3; end if...