acuX和acuY是可以的呀?我感觉这三个玩意儿无差啊- -斯巴达了- -
求解!!!!!!!!!!!!
Option Base 1
Private Sub Form_Load()
Dim opWord As String
Dim timeCount As Integer
Dim LXnx(32), LYnx(32), LZnx(32), Lkx As Double
Dim acuX(32), acuY(32), acuZ(32) As Double
Dim numofSta As Integer
Dim max(3), min(3) As IntegernumofSta = 32
Lkx = 1
'判断是否属于已知节点,若是,数据变。
For i = 1 To numofPoint
If timeData(i) = interSec Then
isGivenNum = True
timeData(i) = 0
ReDim coordDataX(numofPoint - 1, 32)
ReDim coordDataY(numofPoint - 1, 32)
ReDim coordDataZ(numofPoint - 1, 32)
For k = i To numofPoint - 1
timeData(k) = timeData(k + 1)
Next k
ReDim Preserve timeData(numofPoint - 1)
For j = 1 To 32
For k = 1 To i - 1
coordDataX(k, j) = oricoordDataX(k, j)
coordDataY(k, j) = oricoordDataY(k, j)
coordDataZ(k, j) = oricoordDataZ(k, j)
Next k
For k = i To numofPoint - 1
coordDataX(k, j) = oricoordDataX(k + 1, j)
coordDataY(k, j) = oricoordDataY(k + 1, j)
coordDataZ(k, j) = oricoordDataZ(k + 1, j)
Next k
Next j
Exit For
ElseIf timeData(i) > interSec Then
Exit For
End If
Next i'寻找可以使用的卫星,如果可以使用,则计算,如果不可使用,则输出一行字并跳过For i = 1 To 32 '以下是剔除不可用的卫星
'{
If coordDataX(1, i) = 0 Then
opWord = opWord & vbCrLf & "第" & i & "号卫星信息不存在..."
numofSta = numofSta - 1
GoTo NextPoint
End If
'}
For j = beginPoint To (beginPoint + n)
'以下是剔除不可用的卫星
'{
Lkx = 1
If coordDataX(j, i) = 0 Then
opWord = opWord & vbCrLf & "第" & i & "号卫星信息中断..."
LXnx(i) = 0
LYnx(i) = 0
LZnx(i) = 0
numofSta = numofSta - 1
GoTo NextPoint
End If
'}
'若存在,则计算
'{
For k = beginPoint To (beginPoint + n)
If j = k Then
GoTo Skip
End If
Lkx = Lkx * ((interSec - timeData(k)) / (timeData(j) - timeData(k)))Skip:
Next k
LXnx(i) = LXnx(i) + coordDataX(j, i) * Lkx
LYnx(i) = LYnx(i) + coordDataY(j, i) * Lkx
LZnx(i) = LZnx(i) + coordDataZ(j, i) * Lkx
'}
Next j
If isGivenNum = True Then
acuX(i) = oricoordDataX(insecPoint + 1, i) - LXnx(i)
acuY(i) = oricoordDataY(insecPoint + 1, i) - LYnx(i)
acuZ(i) = oricoordDataZ(insecPoint + 1, i) - LZnx(i)
opWord = opWord & vbCrLf & "第" & i & "号卫星在该时刻的坐标为:" & vbCrLf & "X:" & LXnx(i) & " Y:" & LYnx(i) & " Z:" & LZnx(i) _
& vbCrLf & " 在该时刻的误差为: " & vbCrLf & "dX:" & acuX(i) & " dY:" & acuY(i) & " dZ:" & acuZ(i)
Else
opWord = opWord & vbCrLf & "第" & i & "号卫星在该时刻的坐标为:" & vbCrLf & "X:" & LXnx(i) & " Y:" & LYnx(i) & " Z:" & LZnx(i)
End If
NextPoint:
Next i
'若是已知卫星坐标,则对原始数据进行还原!
If isGivenNum = True Then
ReDim coordDataX(numofPoint, 32)
ReDim coordDataY(numofPoint, 32)
ReDim coordDataZ(numofPoint, 32)
For i = 1 To 32
For j = 1 To numofPoint
coordDataX(j, i) = oricoordDataX(j, i)
coordDataY(j, i) = oricoordDataY(j, i)
coordDataZ(j, i) = oricoordDataZ(j, i)
Next j
Next i
ReDim timeData(numofPoint)
For i = 1 To numofPoint
timeData(i) = oritimeData(i)
Next i
End If
Call MinAndMax(min(1), max(1), acuX())
Call MinAndMax(min(2), max(2), acuY())
Call MinAndMax(min(3), max(3), acuZ())
Text3.Text = min(1) & "-" & max(1)
Text4.Text = min(2) & "-" & max(2)
Text5.Text = min(3) & "-" & max(3)
Text1.Text = opWord
Text2.Text = numofSta
End Sub
Private Sub MinAndMax(min, max, Num())
Dim i As Integer
min = Num(1)
max = Num(1)
For i = 1 To UBound(Num())
If Num(i) < min Then
min = Num(i)
End If
If Num(i) > max Then
max = Num(i)
End If
Next iEnd Sub
求解!!!!!!!!!!!!
Option Base 1
Private Sub Form_Load()
Dim opWord As String
Dim timeCount As Integer
Dim LXnx(32), LYnx(32), LZnx(32), Lkx As Double
Dim acuX(32), acuY(32), acuZ(32) As Double
Dim numofSta As Integer
Dim max(3), min(3) As IntegernumofSta = 32
Lkx = 1
'判断是否属于已知节点,若是,数据变。
For i = 1 To numofPoint
If timeData(i) = interSec Then
isGivenNum = True
timeData(i) = 0
ReDim coordDataX(numofPoint - 1, 32)
ReDim coordDataY(numofPoint - 1, 32)
ReDim coordDataZ(numofPoint - 1, 32)
For k = i To numofPoint - 1
timeData(k) = timeData(k + 1)
Next k
ReDim Preserve timeData(numofPoint - 1)
For j = 1 To 32
For k = 1 To i - 1
coordDataX(k, j) = oricoordDataX(k, j)
coordDataY(k, j) = oricoordDataY(k, j)
coordDataZ(k, j) = oricoordDataZ(k, j)
Next k
For k = i To numofPoint - 1
coordDataX(k, j) = oricoordDataX(k + 1, j)
coordDataY(k, j) = oricoordDataY(k + 1, j)
coordDataZ(k, j) = oricoordDataZ(k + 1, j)
Next k
Next j
Exit For
ElseIf timeData(i) > interSec Then
Exit For
End If
Next i'寻找可以使用的卫星,如果可以使用,则计算,如果不可使用,则输出一行字并跳过For i = 1 To 32 '以下是剔除不可用的卫星
'{
If coordDataX(1, i) = 0 Then
opWord = opWord & vbCrLf & "第" & i & "号卫星信息不存在..."
numofSta = numofSta - 1
GoTo NextPoint
End If
'}
For j = beginPoint To (beginPoint + n)
'以下是剔除不可用的卫星
'{
Lkx = 1
If coordDataX(j, i) = 0 Then
opWord = opWord & vbCrLf & "第" & i & "号卫星信息中断..."
LXnx(i) = 0
LYnx(i) = 0
LZnx(i) = 0
numofSta = numofSta - 1
GoTo NextPoint
End If
'}
'若存在,则计算
'{
For k = beginPoint To (beginPoint + n)
If j = k Then
GoTo Skip
End If
Lkx = Lkx * ((interSec - timeData(k)) / (timeData(j) - timeData(k)))Skip:
Next k
LXnx(i) = LXnx(i) + coordDataX(j, i) * Lkx
LYnx(i) = LYnx(i) + coordDataY(j, i) * Lkx
LZnx(i) = LZnx(i) + coordDataZ(j, i) * Lkx
'}
Next j
If isGivenNum = True Then
acuX(i) = oricoordDataX(insecPoint + 1, i) - LXnx(i)
acuY(i) = oricoordDataY(insecPoint + 1, i) - LYnx(i)
acuZ(i) = oricoordDataZ(insecPoint + 1, i) - LZnx(i)
opWord = opWord & vbCrLf & "第" & i & "号卫星在该时刻的坐标为:" & vbCrLf & "X:" & LXnx(i) & " Y:" & LYnx(i) & " Z:" & LZnx(i) _
& vbCrLf & " 在该时刻的误差为: " & vbCrLf & "dX:" & acuX(i) & " dY:" & acuY(i) & " dZ:" & acuZ(i)
Else
opWord = opWord & vbCrLf & "第" & i & "号卫星在该时刻的坐标为:" & vbCrLf & "X:" & LXnx(i) & " Y:" & LYnx(i) & " Z:" & LZnx(i)
End If
NextPoint:
Next i
'若是已知卫星坐标,则对原始数据进行还原!
If isGivenNum = True Then
ReDim coordDataX(numofPoint, 32)
ReDim coordDataY(numofPoint, 32)
ReDim coordDataZ(numofPoint, 32)
For i = 1 To 32
For j = 1 To numofPoint
coordDataX(j, i) = oricoordDataX(j, i)
coordDataY(j, i) = oricoordDataY(j, i)
coordDataZ(j, i) = oricoordDataZ(j, i)
Next j
Next i
ReDim timeData(numofPoint)
For i = 1 To numofPoint
timeData(i) = oritimeData(i)
Next i
End If
Call MinAndMax(min(1), max(1), acuX())
Call MinAndMax(min(2), max(2), acuY())
Call MinAndMax(min(3), max(3), acuZ())
Text3.Text = min(1) & "-" & max(1)
Text4.Text = min(2) & "-" & max(2)
Text5.Text = min(3) & "-" & max(3)
Text1.Text = opWord
Text2.Text = numofSta
End Sub
Private Sub MinAndMax(min, max, Num())
Dim i As Integer
min = Num(1)
max = Num(1)
For i = 1 To UBound(Num())
If Num(i) < min Then
min = Num(i)
End If
If Num(i) > max Then
max = Num(i)
End If
Next iEnd Sub
这是VB的变量声明格式,Dim acuX(32), acuY(32), acuZ(32) As Double前两个是variant类型,最后一个是double型,没看你代码,估计是这儿的问题……
只有最后一个acuZ为Double类型。前两个为Variant类型,这样类型应该确实不匹配了Dim acuX(32) As Double, acuY(32) As Double, acuZ(32) As Double