📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command4
Caption = "Command4"
Height = 495
Left = 5640
TabIndex = 3
Top = 3240
Width = 1815
End
Begin VB.CommandButton Command3
Caption = "Command3"
Height = 495
Left = 3720
TabIndex = 2
Top = 3240
Width = 1695
End
Begin VB.CommandButton Command2
Caption = "点击输入权阵"
Height = 495
Left = 5640
TabIndex = 1
Top = 2400
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "点击输入系数B矩阵"
Height = 495
Left = 3720
TabIndex = 0
Top = 2400
Width = 1695
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 1
Private Sub Command1_Click()
Dim i As Integer, j As Integer, N As Integer, t As Integer, A() As Double
N = Val(InputBox("请输如观测值个数"))
t = Val(InputBox("请输如必要观测值个数"))
ReDim A(N, t) As Double
For i = 1 To N
For j = 1 To t
A(i, j) = Val(InputBox("请输入A(" & i & "," & j & ")的值"))
Next j
Next i
For i = 1 To N
For j = 1 To t
Print A(i, j); "";
Next j
Print
Next i
Print
Call Transpose(A())
Print
End Sub
Public Sub Transpose(A() As Double)
Dim i, j As Integer
Dim AT() As Double
Dim r As Integer
Dim c As Integer
r = UBound(A, 1) - LBound(A, 1) + 1
c = UBound(A, 2) - LBound(A, 2) + 1
ReDim AT(c, r) As Double
For i = LBound(A, 1) To UBound(A, 1)
For j = LBound(A, 2) To UBound(A, 2)
AT(j, i) = A(i, j)
Next j
Next i
For i = LBound(A, 2) To UBound(A, 2)
For j = LBound(A, 1) To UBound(A, 1)
Print AT(i, j); "";
Next j
Print
Next i
End Sub
Public Function QNZ(ByVal N As Integer, A() As Double)
Dim L As Integer
Dim i As Integer, j As Integer, k As Integer
Dim ch As Double, Z As Double, zz As Double
Dim P As Integer
Dim b() As Double
ReDim b(N, N)
L = 2 * N
Dim E() As Double
ReDim E(N, L)
For i = 1 To N
For j = 1 To N
E(i, j) = A(i, j)
Next j
Next i
For i = 1 To N
For j = N + 1 To L
If i = j - N Then
E(i, j) = 1
Else
E(i, j) = 0
End If
Next j
Next i
For j = 1 To N
If E(j, j) = 0 Then
For i = 1 To N
If E(i, j) <> 0 Then Exit For
Next i
For P = 1 To L
ch = E(i, P)
E(i, P) = E(j, P)
E(j, P) = ch
Next P
End If
Z = E(j, j)
For P = 1 To L
E(j, P) = E(j, P) / Z
Next P
For i = 1 To N
If i <> j And E(i, j) <> 0 Then
zz = E(i, j)
For P = 1 To L
E(i, P) = E(i, P) - E(j, P) * zz
Next P
End If
Next i
Next j
For i = 1 To N
For j = 1 To N
b(i, j) = E(i, j + N)
Next j
Next i
QNZ = b()
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -