Friday 25 May 2012

Video : Regresi Polinomial untuk mencari hubungan radiasi dengan suhu

program dalam video dibawah ini sudah pernah saya bahas di posting saya sebelumnya, tentang regresi polinomial maupun regresi linier.


langkah-langkah untuk menghitungnya adalah :
1. masukkan data radiasi (Y) dan data suhu (x)
2. hitung x^2 x^3 x^4 x.y dan x^2.y
3. jumlah masing-masing x^2 x^3 x^4 x.y dan x^2.y
4. masukkan data x^2 x^3 x^4 x.y dan x^2.y ke matrix cell di excel
5. hitung koeffisien A,B,C
6. tulis hasilnya dalam ax2+bx+c

Sintax lengkapnya seperti berikut

Dim A As Double
    Dim b, c, d, e, f, a0, b0, c3, c4, c5, j3, j4, j5 As Double
    For i = 1 To 30
        A = A + Cells(1 + i, 10) ' jumlah total x
        b = b + Cells(1 + i, 11) ' jumlah total y
        c = Cells(1 + i, 10) ^ 2 ' menulis pangkat
        Cells(1 + i, 12) = c
        d = d + Cells(1 + i, 12) ' jumlah x2
       
        c3 = Cells(1 + i, 10) ^ 3 ' menulis pangkat 3
        Cells(1 + i, 13) = c3
        j3 = j3 + Cells(1 + i, 13) ' jumlah pangkat 3
       
        c4 = Cells(1 + i, 10) ^ 4 ' menulis pangkat 4
        Cells(1 + i, 14) = c4
        j4 = j4 + Cells(1 + i, 14)
               
        e = Cells(1 + i, 10) * Cells(1 + i, 11) ' x kali y
        Cells(1 + i, 15) = e    ' menuliskan nilai x*y
        f = f + Cells(1 + i, 15) ' jumlah xy
       
        c5 = (Cells(1 + i, 10) ^ 2) * Cells(1 + i, 11) ' x*y
        Cells(1 + i, 16) = c5
        j5 = j5 + Cells(1 + i, 16) ' jumlah x2y
       
    Next
        Cells(33, 10) = A ' menuliskan jumlah
        Cells(33, 11) = b
        Cells(33, 12) = d
        Cells(33, 13) = j3
        Cells(33, 14) = j4
        Cells(33, 15) = f
        Cells(33, 16) = j5

0 comments:

Post a Comment