Extrapolating Cubic Splines

I have a nice cubic spline code, but it is intended only for interpolation. I need to extrapolate a little into the future. Does anyone know a good source of code, not a library, for this?

This is the code I wrote in the base (now ASM) for interpolation.

+3
source share
5 answers

You do not need a new code for this.

To extrapolate a spline, you can extrapolate the parameters of the first and last splines.

/, . / / . , / .

: , , . .

+6

4 (A, B, C, D), A D - , B C " ". ( ).

. .

(P0, P1, P2, P3), . - , "", , :

P0
   F0 := average(P0, P1)
P1                       S0 := average(F0, F1)
   F1 := average(P1, P2)         Midpoint := average(S0, S1)
P2                       S1 := average(F1, F2)
   F2 := average(P2, P3)
P3

(P0, P1, P2, P3).

(P0, F0, S0, M).

- (M, S1, F2, P3).

, .

- .

, , , .

, P1, P2, P3.

(P0, F0, S0, M), :

S1 := M + (M - S0)
F1 := S0 + (S0 - F0)
P1 := F0 + (F0 - P0)

F2 := S1 + (S1 - F1)
P2 := F1 + (F1 - P1)

, ,

P3 := F2 + (F2 - P2)

(P0, P1, P2, P3).

(P0, P1, P2, P3) (P0, F0, S0, M) - , P0 M - , P3.

4 (P0, F0, S0, M), 4 ( ) .

, , :

Midpoint = average(F0, F1)

" Midpoint F0 F1", , ,

Midpoint.x = (F0.x + F1.x)/2
Midpoint.y = (F0.y + F1.y)/2
Midpoint.z = (F0.z + F1.z)/2

S1 := M + (M - S0)

" , S0 ​​ M, S0 , S1 ", ( ) 3

S1.x := M.x + (M.x - S0.x)
S1.y := M.y + (M.y - S0.y)
S1.z := M.z + (M.z - S0.z)

. ( 2D, "z" - ).

+2

. , " " - .

, " ". , ( ). Googling wiki " " , , - , ( ).

, . Matlab . Wikipedia

, , .

, , ? ? -?


Edit1: : - -

+1

t . , 0 <= t <= 1, . , t < 0 t > 1 .

+1

. . , .

- , , (, -), .

, - , (, , , )

Indeed, I suggest you use some kind of algorithm that is more suitable for extrapolation, for example, using the Lagrange polynomial if everything you really need is very far from the points in the original data set.

0
source

Source: https://habr.com/ru/post/1708622/


All Articles