{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Tema9 - 9.14 Here is a VBA program to implement matrix...

This preview shows pages 1–8. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
9.14 Here is a VBA program to implement matrix multiplication and solve Prob. 9.3 for the case of [ X ] × [ Y ]. Option Explicit Sub Mult() Dim i As Integer, j As Integer Dim l As Integer, m As Integer, n As Integer Dim x(10, 10) As Single, y(10, 10) As Single Dim w(10, 10) As Single l = 2 m = 2 n = 3 x(1, 1) = 1: x(1, 2) = 6 x(2, 1) = 3: x(2, 2) = 10 x(3, 1) = 7: x(3, 2) = 4 y(1, 1) = 6: y(2, 1) = 0 y(2, 1) = 1: y(2, 2) = 4 Call Mmult(x(), y(), w(), m, n, l) For i = 1 To n For j = 1 To l MsgBox w(i, j) Next j Next i End Sub Sub Mmult(y, z, x, n, m, p) Dim i As Integer, j As Integer, k As Integer Dim sum As Single For i = 1 To m For j = 1 To p sum = 0 For k = 1 To n sum = sum + y(i, k) * z(k, j) Next k x(i, j) = sum Next j Next i End Sub 9.15 Here is a VBA program to implement the matrix transpose and solve Prob. 9.3 for the case of [ X ] T . Option Explicit Sub Mult() Dim i As Integer, j As Integer Dim m As Integer, n As Integer Dim x(10, 10) As Single, y(10, 10) As Single n = 3 m = 2 x(1, 1) = 1: x(1, 2) = 6 x(2, 1) = 3: x(2, 2) = 10
x(3, 1) = 7: x(3, 2) = 4 Call MTrans(x(), y(), n, m) For i = 1 To m For j = 1 To n MsgBox y(i, j) Next j Next i End Sub Sub MTrans(a, b, n, m)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 8

Tema9 - 9.14 Here is a VBA program to implement matrix...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online