0% found this document useful (0 votes)
6 views

VBA Noi Suy

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

VBA Noi Suy

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Function NSZ(Xo, Yo, Z) As Single

Dim i, j As Integer
cao = Z.Rows.Count 'Xac dinh so hang
Rong = Z.Columns.Count 'Xac dinh so cot
Dim A1, A2, B1, B2, Y, X, Tim As Single 'Cac diem chan
For i = 2 To cao
If Z(i, 1) <= Xo And Xo <= Z(i + 1, 1) Then
n = i
For j = 2 To Rong
If Z(1, j) <= Yo And Yo <= Z(1, j + 1) Then
m = j
Y = Z(1, m + 1) - Z(1, m)
X = Z(n + 1, 1) - Z(n, 1)
B1 = Z(n, m + 1)
B2 = Z(n + 1, m + 1)
A1 = Z(n, m)
A2 = Z(n + 1, m)
Tim = (A1 * (Z(1, m + 1) - Yo) * (Z(n + 1, 1) - Xo) +
A2 * (Xo - Z(n, 1)) * (Z(1, m + 1) - Yo) + B1 * (Yo - Z(1, m)) * (Z(n + 1, 1) - Xo)
+ B2 * (Xo - Z(n, 1)) * (Yo - Z(1, m))) / (X * Y)
End If
Next j
Exit For
End If
Next i
NSZ = Tim
End Function

Function NS(SoX, X, Y) As Double


Dim i As Integer
Dim n, cao As Integer
cao = X.Rows.Count
For i = 1 To cao
If X(i) <= SoX And SoX <= X(i + 1) Then
n = i
NS = Y(n) + (SoX - X(n)) * (Y(n + 1) - Y(n)) / (X(n + 1) - X(n))
Exit For
End If
Next i
End Function
Function NSP(SoX, X, Y) As Double
Dim a, b, c, Ya, Yb, Yc, t As Double
Dim i, n, cao As Integer
cao = X.Rows.Count
For i = 1 To cao - 2
a = X(i)
b = X(i + 2)
If a <= SoX And SoX <= b Then
n = i
c = X(i + 1)
Ya = Y(n)
Yb = Y(n + 2)
Yc = Y(n + 1)
t = 2 * (SoX - a) / (b - a)
NSP = Ya + (Yc - Ya) * t + (Yb - 2 * Yc + Ya) * t * (t - 1) / 2
Exit For
End If
Next i
End Function

You might also like