各位大家帮帮忙,自己编的这个插值法,怎么一输入数据,就是插不出来呢,问题到底在哪里??各位帮帮忙。
Private Sub Command1_Click()zz = Val(Text1)
If Text1 = "" Then
Command1.Caption = "先输插值点"
Text1.SetFocus
Exit Sub
End If
Dim z() As Single, v() As Single
Open "D:\cazi.txt" For Input As #1
Do While Not EOF(1)
k = k + 1
ReDim Preserve z(k) As Single, v(k) As Single
Input #1, z(k), v(k)
Loop
Close
For I = 1 To k - 1
If z(I + 1) > zz Then
If v(I) < v(I + 1) Then
vv = v(I) + (zz - z(I)) * (v(I + 1) - v(I)) / (z(I + 1) - z(I))
ElseIf v(I) > v(I + 1) Then
vv = v(I + 1) + (z(I + 1) - zz) * (v(I) - v(I + 1)) / (z(I + 1) - z(I))
End If
End If
Next
If zz < z(1) Or zz > z(k) Then
MsgBox ("此值已在内插区间以外")
Exit Sub
End If
pic.Print "z="; zz, " v="; vv; ""
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub text1_keyup(keycode As Integer, shift As Integer)
Command1.Caption = "开始插值"
End Sub