Dim a(0 To 4, 0 To 1) As Double
Dim i As Double
Dim Kurve As CNCL_Interpolation
a(0,0) = 2 ' 1. Punkt 2, 10
a(0,1) = 10
a(1,0) = 5 ' 2. Punkt 5, 5
a(1,1) = 5
a(2,0) = 8 ' 3. Punkt 8, 8
a(2,1) = 8
a(3,0) = 13 ' 4. Punkt 13, 2
a(3,1) = 2
a(4,0) = 15 ' 5. Punkt 15, 5
a(4,1) = 5
Set Kurve = New CNCL_Interpolation(a)
For i = 0 To 17
Print "x=" + CStr(i) + " linear(x)=" + CStr(CNCL_Round(Kurve.linear(i),3)) + " spline(x)=" + CStr(CNCL_Round(Kurve.spline(i),3)) + " linreg(x)=" + CStr(CNCL_Round(Kurve.linreg(i),3)) + " newton(x)=" + CStr(CNCL_Round(Kurve.newton(i),3))
Next
Ausgabe:
x=0 linear(x)=13.333 spline(x)=14.311 linreg(x)=9.522 newton(x)=33.528
x=1 linear(x)=11.667 spline(x)=12.449 linreg(x)=9.113 newton(x)=18.674
x=2 linear(x)=10 spline(x)=10 linreg(x)=8.703 newton(x)=10
x=3 linear(x)=8.333 spline(x)=7.551 linreg(x)=8.294 newton(x)=5.779
x=4 linear(x)=6.667 spline(x)=5.689 linreg(x)=7.884 newton(x)=4.526
x=5 linear(x)=5 spline(x)=5 linreg(x)=7.474 newton(x)=5
x=6 linear(x)=6 spline(x)=5.781 linreg(x)=7.065 newton(x)=6.201
x=7 linear(x)=7 spline(x)=7.166 linreg(x)=6.655 newton(x)=7.372
x=8 linear(x)=8 spline(x)=8 linreg(x)=6.246 newton(x)=8
x=9 linear(x)=6.8 spline(x)=7.435 linreg(x)=5.836 newton(x)=7.814
x=10 linear(x)=5.6 spline(x)=5.858 linreg(x)=5.427 newton(x)=6.785
x=11 linear(x)=4.4 spline(x)=3.963 linreg(x)=5.017 newton(x)=5.128
x=12 linear(x)=3.2 spline(x)=2.446 linreg(x)=4.608 newton(x)=3.3
x=13 linear(x)=2 spline(x)=2 linreg(x)=4.198 newton(x)=1
x=14 linear(x)=3.5 spline(x)=3.058 linreg(x)=3.788 newton(x)=2.172
x=15 linear(x)=5 spline(x)=5 linreg(x)=3.379 newton(x)=5
x=16 linear(x)=6.5 spline(x)=6.942 linreg(x)=2.969 newton(x)=11.913
x=17 linear(x)=8 spline(x)=8 linreg(x)=2.56 newton(x)=24.581