Math, asked by Qwerty2147, 1 year ago

How to calculate cubic spline interpolation coefficients?

Answers

Answered by rvk123
0
want to know how to calculate cubic spline interpolation coefficients, which uses end point slope constraint.

There are NN points (x0,y0),(x1,y1),…,(xN−1,yN−1)∈R2(x0,y0),(x1,y1),…,(xN−1,yN−1)∈R2where x0<x1<⋯<xN−1x0<x1<⋯<xN−1. Cubic spline interpolation should give N−1N−1 polinomials

Sj(x)=aj+bj(x−xj)+cj(x−xj)2+dj(x−xj)3Sj(x)=aj+bj(x−xj)+cj(x−xj)2+dj(x−xj)3

where j∈{0,1,…,N−2}j∈{0,1,…,N−2}. Because there are4(N−1)4(N−1) unknown variables aj,bj,cj,djaj,bj,cj,dj, 4(N−1)4(N−1) equations are required to solve.

Like natural cubic splines, we usually get the first 4(N−1)−24(N−1)−2 equations from the following conditions

Si(xi)=Si+1(xi)=yiSi(xi)=Si+1(xi)=yi for i∈{0,1,…,N−1}i∈{0,1,…,N−1}Si(xi+1)=Si+1(xi+1)Si(xi+1)=Si+1(xi+1) for i∈{0,1,…,N−1}i∈{0,1,…,N−1}S′i(xi+1)=S′i+1(xi+1)Si′(xi+1)=Si+1′(xi+1) for i∈{0,1,…,N−2}i∈{0,1,…,N−2}S′′i(xi+1)=S′′i+1(xi+1)Si′′(xi+1)=Si+1′′(xi+1) for i∈{0,1,…,N−2}i∈{0,1,…,N−2}

and so two other conditions are required. For natural cubic splines, conditions

S′′0(x0)=0,S′′N−1(xN−1)=0S0′′(x0)=0,SN−1′′(xN−1)=0

are used, but instead, I want to use edge slope conditions

S′0(x0)=vfirst,S′N−1(xN−1)=vlast


Similar questions