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

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
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
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

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

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online