Sub Ex_Bintk()
Const N = 4, K = 4
Dim X(N - 1) As Double, Y(N - 1) As Double, Xe As Double
Dim T(N + K - 1) As Double, Bcoef(N - 1) As Double, Q((2 * K - 1) * N - 1) As Double
Dim Ideriv As Long, Inbv As Long, Info As Long, I As Long
'-- Data
X(0) = 0.1: Y(0) = -2.3026
X(1) = 0.11: Y(1) = -2.2073
X(2) = 0.12: Y(2) = -2.1203
X(3) = 0.13: Y(3) = -2.0402
'-- B-representation of cubic spline interpolation of order k
For I = 0 To N - K + 1
T(I + K - 1) = X(0) + I * (X(N - 1) - X(0)) / (N - K + 1)
Next
T(0) = T(3): T(1) = T(3): T(2) = T(3)
T(7) = T(4): T(6) = T(4): T(5) = T(4)
Call
Bintk(X(), Y(), T(), N, K, Bcoef(), Q(), Info)
If Info <> 0 Then
Debug.Print "Error in
Bintk: Info =", Info
Exit Sub
End If
'-- Compute interpolated value
Ideriv = 0: Inbv = 1
Xe = 0.115
Debug.Print "ln(" + CStr(Xe) + ") =",
Bvalue(T(), Bcoef(), N, K, Ideriv, Xe, Inbv, Info)
Debug.Print "Info =", Info
End Sub
Sub Bintk(X() As Double, Y() As Double, T() As Double, N As Long, K As Long, Bcoef() As Double, Q() As Double, Info As Long)
B-representation of the spline interpolation of order k
Function Bvalue(T() As Double, A() As Double, N As Long, K As Long, Ideriv As Long, X As Double, Inbv As Long, Info As Long) As Double
Evaluation of function or derivative value for B-representation of B-spline