Anda di halaman 1dari 2

program REGRESI LINIER

write(*,*) "PROGRAM INI UNTUK MENCARI NILAI REGRESI LINIER"

real n, x, y, i, ai, ao, sy, sx, syk, sxk, yr, xr

print*'masukkan nilai n='

read*, n

syk = 0

syx = 0

sy = 0

sx = 0

Do 20, i=1, n,1

print*,'masukkan nilai x='

read*, x

print*,'masukkan nilai y='

read*, y

syk=syk+(x*y)

sy=sy+y

sx=sx+x

sxk=sxk+x**2

16 continue

yr=sy/n

xr=sx/n

ai=(((n*syx)-(sx*sy))/(n*(sxk))-((sx)**2)

ao=yr-(xr*ai)

print 30, ai, ao

30 format('nilai dari ai= & ao=', f6.2 ')

end REGRESI LINIER


program INTERPOLASI

write(*,*) "PROGRAM INI UNTUK MENCARI INTERPOLASI ORDE 1"

real y, y1, y2, x, x1, x2, x

print*,'program ini untuk menghitung nilai interpolasi orde 1, y=y1+(((y2-y2)/(x2-x2))*(x-x1))'

print*,'masukan nilai y1='

read*, y1

Print *,'masukkan nilai y2 ='

read*, y2

print*,'masukkan nilai x ='

read*, x

print*,'masukkan nilai x1 ='

read*, x1

print*,'masukkan nilai x2 ='

read*, x2

y=y1+(((y2-y2)/(x2-x2))*(x-x1))

print 16, y

16 format ('nilai dari y adalah=',f6.2)

end INTERPOLASI

Anda mungkin juga menyukai