アットウィキロゴ

ggg

Private Sub Command1_Click()
Dim m1 As Single
Dim m2 As Single
Dim s1 As Single
Dim s2 As Single
Dim cp1 As Single
Dim yp1 As Single
Dim yp2 As Single
Dim c(0 To 10, 0 To 10) As Single
Dim y1(0 To 10, 0 To 10) As Single
Dim y2(0 To 10, 0 To 10) As Single
Dim th1(1 To 10) As Single
Dim th2(1 To 10) As Single
Dim datay(0 To 100) As Single
Dim datac(0 To 100) As Single
Dim i As Single
Dim j As Single
Dim h As Single
Dim n1 As Single
Dim n2 As Single
Dim n3 As Single
Dim num As Single
Dim rate As Single
Dim z1 As Single
Dim z2 As Single
m1 = 1
m2 = 1
Open "c:/data.txt" For Input As #2
Do Until EOF(2)
Input #2, a3, a4, a5
c(m1, m2) = a3
y1(m1, m2) = a4
y2(m1, m2) = a5
m2 = m2 + 1
If m2 = 11 Then m1 = m1 + 1
If m2 = 11 Then m2 = 1
Loop
Close #2
For n = 1 To 9
z1 = 0.1 * n
z2 = 0.2
mine = 1000
check1 = 0
For s1 = 1 To 10
For s2 = 1 To 10
h = 0
If y1(s1, s2) < z1 Then h = h + 1
If y2(s1, s2) < z2 Then h = h + 1
e = (y1(s1, s2) - z1) ^ 2 + (y2(s1, s2) - z2) ^ 2
If e < mine Then h = h + 1
If h = 3 Then m11 = s1
If h = 3 Then m12 = s2
If h = 3 Then check1 = 100
Next
Next
check2 = 0
mine = 1000
For s1 = 1 To 10
For s2 = 1 To 10
h = 0
If y1(s1, s2) < z1 Then h = h + 1
If y2(s1, s2) > z2 Then h = h + 1
e = (y1(s1, s2) - z1) ^ 2 + (y2(s1, s2) - z2) ^ 2
If e < mine Then h = h + 1
If h = 3 Then m21 = s1
If h = 3 Then m22 = s2
If h = 3 Then check2 = 100
Next
Next
check3 = 0
mine = 1000
For s1 = 1 To 10
For s2 = 1 To 10
h = 0
If y1(s1, s2) > z1 Then h = h + 1
If y2(s1, s2) < z2 Then h = h + 1
e = (y1(s1, s2) - z1) ^ 2 + (y2(s1, s2) - z2) ^ 2
If e < mine Then h = h + 1
If h = 3 Then m31 = s1
If h = 3 Then m32 = s2
If h = 3 Then check3 = 100
Next
Next
check4 = 0
mine = 1000
For s1 = 1 To 10
For s2 = 1 To 10
h = 0
If y1(s1, s2) > z1 Then h = h + 1
If y2(s1, s2) > z2 Then h = h + 1
e = (y1(s1, s2) - z1) ^ 2 + (y2(s1, s2) - z2) ^ 2
If e < mine Then h = h + 1
If h = 3 Then m41 = s1
If h = 3 Then m42 = s2
If h = 3 Then check4 = 100
Next
Next
h = 0
check = 0
If check1 > 50 Then h = h + 1
If check2 > 50 Then h = h + 1
If check3 > 50 Then h = h + 1
If check4 > 50 Then h = h + 1
If h = 4 Then check = 100
rate = (z2 - y2(m11, m12)) / (y2(m21, m22) - y2(m11, m12))
yy = y1(m11, m12) + rate * (y1(m21, m22) - y1(m11, m12))
cc = c(m11, m12) + rate * (c(m21, m22) - c(m11, m12))
rate = (z2 - y2(m31, m32)) / (y2(m41, m42) - y2(m31, m32))
yyy = y1(m31, m32) + rate * (y1(m41, m42) - y1(m31, m32))
ccc = c(m31, m32) + rate * (c(m41, m42) - c(m31, m32))
If check > 50 Then Debug.Print z1, 1 - (ccc - cc) / (yyy - yy)
Next






End Sub
最終更新:2009年12月20日 01:33