Private Sub Command1_Click()
Dim th(1 To 100) As Single
Dim s As Single
Dim cs(1 To 100) As Single
Dim ys(1 To 100) As Single
Dim u(1 To 99, -5 To 5, -5 To 5) As Single
Dim w(1 To 99, -5 To 5, -5 To 5) As Single
Dim c1 As Single
Dim y1 As Single
Dim wp As Single
Dim bp As Single
Open "c:/201.txt" For Input As #2
Do Until EOF(2)
Input #2, a1, a2, a3
s = a1
cs(s) = a2
ys(s) = a3
Loop
Close #2
For s = 1 To 100
th(s) = 0.02 * s
Next
h = 10 ^ (-2)
For s = 1 To 99
For m = -5 To 5
For n = -5 To 5
c1 = cs(s) + m * h
y1 = ys(s) + n * h
l1 = y1 / th(s)
pp = 0
If l1 < 0 Then pp = 1
If l1 < 0 Then l1 = 0
If l1 > 0.99 Then pp = 1
If l1 > 0.99 Then l1 = 0.99
If c1 < 0.01 Then pp = 1
If c1 < 0.01 Then c1 = 0.01
u(s, m, n) = Log(c1) + Log(1 - l1)
If pp = 1 Then u(s, m, n) = -999
Next
Next
Next
For s = 1 To 99
For m = -5 To 5
For n = -5 To 5
c1 = cs(s) + m * h
y1 = ys(s) + n * h
l1 = y1 / th(s + 1)
pp = 0
If l1 < 0 Then pp = 1
If l1 < 0 Then l1 = 0
If l1 > 0.99 Then pp = 1
If l1 > 0.99 Then l1 = 0.99
If c1 < 0.01 Then pp = 1
If c1 < 0.01 Then c1 = 0.01
w(s, m, n) = Log(c1) + Log(1 - l1)
If pp = 1 Then w(s, m, n) = -999
Next
Next
Next
Open "c:/202.txt" For Output As #1
For s = 1 To 99
For m = -5 To 5
For n = -5 To 5
Write #1, s, m, n, u(s, m, n), w(s, m, n)
Next
Next
Next
Close #1
End Sub
最終更新:2009年08月28日 20:29