分类：电脑/网络-程序设计
问题：矩阵计算的VB程序代码哪里有？只要可以运行，最好是ASP的VB代 
只要可以运行，最好是ASP的代码，谢谢！
回答：Optn Base 1Dim x As IntegerDim d(2, 2), n(2, 2), na As Single, ns As SingleDim M1(2, 2) As SingleDim M2(2, 2) As SingleDim M3(2, 2) As SingleDim M4(2, 2) As SingleDim mO(2, 2) As SingleDim mZ(2, 2) As Single         '暂时存放数据的数组Private Sub Form_Click()    Cls    FontSize = 20    FontBold = True    Print        'mo(2,2)=m1(2,2)*m2(2,2)    Dim i As Integer, j As Integer, k As Integer    i = 1: j = 1: k = 1    For i = 1 To 2        If i = 1 Then            'mo(1,2)正确            For j = 1 To 2                If j = 1 Then                    'mo(1,1)正确                    For k = 1 To 2                        Select Case k                                                        Case 1                                mO(i, j) = M1(i, k) * M2(k, i)                            Case 2                                mO(i, j) = mO(i, j) - M1(i, k) * M2(k, i)                        End Select                    Next k                Else                    k = 0                    For k = 1 To 2                        Select Case k                            Case 1                                mO(i, j) = M1(i, k) * M2(k, j)                            Case 2                                mO(i, j) = mO(i, j) + M1(i, k) * M2(k, j)                        End Select                    Next k                End If            Next j        Else            'mo(2,2)正确            For j = 1 To 2                If j = 1 Then                    'mo(2,1)正确                    For k = 1 To 2                        Select Case k                                                        Case 1                                mO(i, j) = M1(i, k) * M2(j, k)                            Case 2                                mO(i, j) = mO(i, j) + M1(i, k) * M2(k, j)                        End Select                    Next k                Else                    k = 0                    For k = 1 To 2                        Select Case k                            Case 1                                mO(i, j) = M1(i, k) * M2(k, j)                            Case 2                                mO(i, j) = M1(i, k) * M2(k, j) - mO(i, j)                        End Select                    Next k                End If            Next j        End If    Next i        For i = 1 To 2        For j = 1 To 2            Print mO(i, j); Space(4);        Next j        Print    Next i        Print        'mo(2,2)=mo(2,2)*m3(2,2)    mZ(1, 1) = mO(1, 1): mZ(1, 2) = mO(1, 2)    mZ(2, 1) = mO(2, 1): mZ(2, 2) = mO(2, 2)    i = 1: j = 1: k = 1    For i = 1 To 2        If i = 1 Then            'mo(1,2)正确            For j = 1 To 2                If j = 1 Then                    'mo(1,1)正确                    For k = 1 To 2                        Select Case k                                                        Case 1                                mO(i, j) = mZ(i, k) * M3(k, i)                            Case 2                                mO(i, j) = mO(i, j) - mZ(i, k) * M3(k, i)                        End Select                    Next k                Else                    k = 0                    For k = 1 To 2                        Select Case k                            Case 1                                mO(i, j) = mZ(i, k) * M3(k, j)                            Case 2                                mO(i, j) = mO(i, j) + mZ(i, k) * M3(k, j)                        End Select                    Next k                End If            Next j        Else            'mo(2,2)正确            For j = 1 To 2                If j = 1 Then                    'mo(2,1)正确                    For k = 1 To 2                        Select Case k                                                        Case 1                                mO(i, j) = mZ(i, k) * M3(j, k)                            Case 2                                mO(i, j) = mO(i, j) + mZ(i, k) * M3(k, j)                        End Select                    Next k                Else                    k = 0                    For k = 1 To 2                        Select Case k                            Case 1                                mO(i, j) = mZ(i, k) * M3(k, j)                            Case 2                                mO(i, j) = mZ(i, k) * M3(k, j) - mO(i, j)                        End Select                    Next k                End If            Next j        End If    Next i        For i = 1 To 2        For j = 1 To 2            Print mO(i, j); Space(4);        Next j        Print    Next i        Print               'mo(2,2)=mo(2,2)*m4(2,2)    mZ(1, 1) = mO(1, 1): mZ(1, 2) = mO(1, 2)    mZ(2, 1) = mO(2, 1): mZ(2, 2) = mO(2, 2)    i = 1: j = 1: k = 1    For i = 1 To 2        If i = 1 Then            'mo(1,2)正确            For j = 1 To 2                If j = 1 Then                    'mo(1,1)正确                    For k = 1 To 2                        Select Case k                                                        Case 1                                mO(i, j) = mZ(i, k) * M4(k, i)                            Case 2                                mO(i, j) = mO(i, j) - mZ(i, k) * M4(k, i)                        End Select                    Next k                Else                    k = 0                    For k = 1 To 2                        Select Case k                            Case 1                                mO(i, j) = mZ(i, k) * M4(k, j)                            Case 2                                mO(i, j) = mO(i, j) + mZ(i, k) * M4(k, j)                        End Select                    Next k                End If            Next j        Else            'mo(2,2)正确            For j = 1 To 2                If j = 1 Then                    'mo(2,1)正确                    For k = 1 To 2                        Select Case k                                                        Case 1                                mO(i, j) = mZ(i, k) * M4(j, k)                            Case 2                                mO(i, j) = mO(i, j) + mZ(i, k) * M4(k, j)                        End Select                    Next k                Else                    k = 0                    For k = 1 To 2                        Select Case k                            Case 1                                mO(i, j) = mZ(i, k) * M4(k, j)                            Case 2                                mO(i, j) = mZ(i, k) * M4(k, j) - mO(i, j)                        End Select                    Next k                End If            Next j        End If    Next i        For i = 1 To 2        For j = 1 To 2            Print mO(i, j); Space(4);        Next j        Print    Next i    End SubPrivate Sub Form_Load()        x = InputBox("请输入X的值：")        d(1, 1) = 1326.1:   d(1, 2) = 1146.23    d(2, 1) = 1543.5:   d(2, 2) = 1231.6        n(1, 1) = 2.125:    n(1, 2) = 1.46    n(2, 1) = 2.125:    n(2, 2) = 1.46    na = 1:     ns = 1.457            M1(1, 1) = Cos(2 * n(1, 1) * d(1, 1) / x)    M1(1, 2) = Sin(2 * n(1, 1) * d(1, 1) / x)    M1(2, 1) = Sin(2 * n(1, 1) * d(1, 1) / x)    M1(2, 2) = Cos(2 * n(1, 1) * d(1, 1) / x)            M2(1, 1) = Cos(2 * n(1, 2) * d(1, 2) / x)    M2(1, 2) = Sin(2 * n(1, 2) * d(1, 2) / x)    M2(2, 1) = Sin(2 * n(1, 2) * d(1, 2) / x)    M2(2, 2) = Cos(2 * n(1, 2) * d(1, 2) / x)            M3(1, 1) = Cos(2 * n(2, 1) * d(2, 1) / x)    M3(1, 2) = Sin(2 * n(2, 1) * d(2, 1) / x)    M3(2, 1) = Sin(2 * n(2, 1) * d(2, 1) / x)    M3(2, 2) = Cos(2 * n(2, 1) * d(2, 1) / x)            M4(1, 1) = Cos(2 * n(2, 2) * d(2, 2) / x)    M4(1, 2) = Sin(2 * n(2, 2) * d(2, 2) / x)    M4(2, 1) = Sin(2 * n(2, 2) * d(2, 2) / x)    M4(2, 2) = Cos(2 * n(2, 2) * d(2, 2) / x)        End Sub