A
Andrew
Hello,
Let me try posting this again. I am trying to do some simple matrix
manipulation in vba. What I want to do is take a 4x4 matrix, invert
it, multiply a 4x1 column vector by the inverted matrix, and then put
the result into a column vector. I do not want to use ranges for the
inputs. I will put the matrix values into the matrix manually.
A is 4x4 matrix
B is 4x1 column
C is 4x1 column
Dim A(1 To 4, 1 To 4) As Double
Dim B(1 To 4) As Double
Dim C()
Here is how the matrices are established. The variables come from
worksheet cells (not shown)
A(1, 1) = x1 ^ 3
A(2, 1) = x2 ^ 3
A(3, 1) = 3 * x1 ^ 2
A(4, 1) = 3 * x2 ^ 2
A(1, 2) = x1 ^ 2
A(2, 2) = x2 ^ 2
A(3, 2) = x1 * 2
A(4, 2) = x2 * 2
A(1, 3) = x1
A(2, 3) = x2
A(3, 3) = 1
A(4, 3) = 1
A(1, 4) = 1
A(2, 4) = 1
A(3, 4) = 0
A(4, 4) = 0
B(1) = y1
B(2) = y2
B(3) = m1
B(4) = m2
What I want to do is invert A, then multiply B by A inverted, and put
the
results in C.
Here is my code:
C=MInverse(A)
C=MMult(C,B)
The code stops at the MMult(C,B) line, stating "Unable to get the
MMult property of the worksheetfunction class."
This seems to be a simple problem. Can anyone help me with this. An
example would be great.
thanks,
Andy
Let me try posting this again. I am trying to do some simple matrix
manipulation in vba. What I want to do is take a 4x4 matrix, invert
it, multiply a 4x1 column vector by the inverted matrix, and then put
the result into a column vector. I do not want to use ranges for the
inputs. I will put the matrix values into the matrix manually.
A is 4x4 matrix
B is 4x1 column
C is 4x1 column
Dim A(1 To 4, 1 To 4) As Double
Dim B(1 To 4) As Double
Dim C()
Here is how the matrices are established. The variables come from
worksheet cells (not shown)
A(1, 1) = x1 ^ 3
A(2, 1) = x2 ^ 3
A(3, 1) = 3 * x1 ^ 2
A(4, 1) = 3 * x2 ^ 2
A(1, 2) = x1 ^ 2
A(2, 2) = x2 ^ 2
A(3, 2) = x1 * 2
A(4, 2) = x2 * 2
A(1, 3) = x1
A(2, 3) = x2
A(3, 3) = 1
A(4, 3) = 1
A(1, 4) = 1
A(2, 4) = 1
A(3, 4) = 0
A(4, 4) = 0
B(1) = y1
B(2) = y2
B(3) = m1
B(4) = m2
What I want to do is invert A, then multiply B by A inverted, and put
the
results in C.
Here is my code:
C=MInverse(A)
C=MMult(C,B)
The code stops at the MMult(C,B) line, stating "Unable to get the
MMult property of the worksheetfunction class."
This seems to be a simple problem. Can anyone help me with this. An
example would be great.
thanks,
Andy