This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: For yloc = 1 To 9 ztest = getz(xloc, yloc) If (ztest < z) Then xbest = xloc ybest = yloc z = ztest End If Next yloc Next xloc Worksheets("Firehouse").Range("b21").Value = xbest Worksheets("Firehouse").Range("c21").Value = ybest Worksheets("Firehouse").Range("d21").Value = z End Sub Sheet1 Page 2 Function getz(r As Integer, s As Integer) As Single Dim i As Integer, davg As Single, poptotal As Single davg = 0 For i = 1 To 15 'straight line davg = davg + pop(i) * Sqr(((x(i) - r) ^ 2) + ((y(i) - s) ^ 2)) 'over the road davg = davg + pop(i) + Abs(x(i) - r) + Abs(y(i) - s) Next i davg = davg / pop(0) getz = davg End Function...
View Full Document
This note was uploaded on 03/30/2008 for the course CE 297A taught by Professor List during the Spring '08 term at N.C. State.
- Spring '08