Anda di halaman 1dari 1

1 trabajo de geoestadstica - VARIOGRAMA LuigiGC Generar 5000 datos aleatorios y ordenados y clculo de su variograma exportados a .

txt
Dim NA(5000), NO(5000), F1(5000), F2(5000), s, l, ls, li As Double Dim i, j, k, n As Integer Dim Linea As String Dim Arch As String Private Sub Command4_Click() ls = Val(Text1.Text) 'mayor ley li = Val(Text2.Text) 'menor ley 'n = Val(text3.Text) 'numero de datos End Sub Private Sub Command1_Click() For i = 1 To 5000 NA(i) = (ls - li) * Rnd + li Next For h = 1 To 4999 For i = 1 To 5000 - h s = s + (NA(i) - NA(i + h)) ^ 2 Next F1(h) = s / (5000 - h) s=0 List1.AddItem F1(h) Next For i = 1 To 5000 For j = 1 To 4999 If NA(j) < NA(j + 1) Then l = NA(j) NA(j) = NA(j + 1) NA(j + 1) = l End If Next j Next i For i = 1 To 5000 NO(i) = NA(i) Next i For h = 1 To 4999 For i = 1 To 5000 - h s = s + (NO(i) - NO(i + h)) ^ 2 Next F2(h) = s / (5000 - h) s=0 List2.AddItem F2(h)

Next End Sub Private Sub Command2_Click() Arch = "C:\con datos aleatorios1.txt" Open Arch For Output Access Write As #1 For k = 0 To List1.ListCount Linea = "" Linea = Linea & List1.List(k) Print #1, Linea Next k Close #1 End Sub Private Sub Command3_Click() Arch = "C:\con datos ordenados.txt" Open Arch For Output Access Write As #1 For k = 0 To List1.ListCount Linea = "" Linea = Linea & List2.List(k) Print #1, Linea Next k Close #1 End Sub

Anda mungkin juga menyukai