Matriks dengan Excel


Untuk mendukung analisa matriks pada struktur kadang memerlukan operasi matriks yang kompleks, sehingga memerlukan alat bantu penyelesaian matriks. Penyelesaian matriks dapat dilakukan dengan bantuan program buatan sendiri dengan visual basic atau dengan bantuan microsft excel,

Berikut adalah operasi matriks di Excell

Operasi Matriks di MS Excel

Sedangkan yang senang membuat sendiri dengan VBasic source code dapat ditulis sbb :
Dim Matrik_1(1, 1) As Double
Dim Matrik_2(1, 1) As Double
Dim hasil(1, 1) As Double
Dim nilai$
‘Memasukan Matrik ke 1
Private Sub inputM1_Click()
Dim i As Integer
Dim j As Integer
For i = 0 To 1
For j = 0 To 1
Prompt$ = “Masukkan nilai Matriks ke 1”
nilai$ = InputBox(Prompt$, “Proses input matriks ke 1”)
‘tes = MsgBox(“niali =   ” & nilai$, vbOKOnly)
pindahBaris$ = Chr(13) + Chr(10)
Text1.Text = Text1.Text & ” ” & nilai$
Matrik_1(i, j) = nilai$
Next j
Text1.Text = Text1.Text & ” ” & pindahBaris$
Next i
End Sub
‘Memasukan Matrik ke 2
Private Sub inputM2_Click()
Dim i As Integer
Dim j As Integer
For i = 0 To 1
For j = 0 To 1
Prompt$ = “Masukan nilai Matriks ke 2”
nilai$ = InputBox(Prompt$, “Proses input matriks ke 2″)
pindahBaris$ = Chr(13) + Chr(10)
Text2.Text = Text2.Text & ” ” & nilai$
Matrik_2(i, j) = nilai$
Next j
Text2.Text = Text2.Text & ” ” & pindahBaris
Next i
End Sub
Private Sub Option1_Click()
Dim i As Integer
Dim j As Integer
Dim k As Integer
For i = 0 To 1
For j = 0 To 1
hasil(i, j) = 0
For k = 0 To 1
hasil(i, j) = hasil(i, j) + (Matrik_1(i, k) + Matrik_2(k, j))
‘tes = MsgBox(“GUE –masuk disini =   ” & hasil(i, j), vbOKOnly)
Next k
Next j
Next i
End Sub
Private Sub Option2_Click()
Dim i As Integer
Dim j As Integer
Dim k As Integer
For i = 0 To 1
For j = 0 To 1
hasil(i, j) = 0
For k = 0 To 1
hasil(i, j) = hasil(i, j) + (Matrik_1(i, k) – Matrik_2(k, j))
Next k
Next j
Next i
End Sub
Private Sub Option3_Click()
Dim i As Integer
Dim j As Integer
Dim k As Integer
For i = 0 To 1
For j = 0 To 1
hasil(i, j) = 0
For k = 0 To 1
hasil(i, j) = hasil(i, j) + (Matrik_1(i, k) * Matrik_2(k, j))
Next k
Next j
Next i
End Sub
‘TampilHasil
Private Sub TampilHasil_Click()
Dim i As Integer
Dim j As Integer
For i = 0 To 1
For j = 0 To 1
Text3.Text = Text3.Text & ” ” & hasil(i, j)
Next j
pindahBaris$ = Chr(13) + Chr(10)
Text3.Text = Text3.Text + pindahBaris$
Next i
pindahBaris$ = Chr(13) + Chr(10)
Text3.Text = Text3.Text + pindahBaris$
pindahBaris$ = Chr(13) + Chr(10)
End Sub
Private Sub keluar_Click()
Unload Me
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s