1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
splin Scilab Group Scilab Function splin
NAME
splin - spline function
CALLING SEQUENCE
d=splin(x,f [,"periodic"])
PARAMETERS
x : real vector
f : real vector of same size as x
"periodic" : string flag (a periodic spline is looked for)
DESCRIPTION
Given values fi of a function f at given points xi (fi=f(xi)) this
primitive computes a third order spline function S which interpolates the
function f. The components of x must be in increasing order. For a
periodic spline f(1) must equal f(n); S is defined through the triple
(x,f,d) where d=spline(x,f) is the vector of the estimated derivatives of
S at xi (fi=S(xi),di=S'(xi)). This function should be used in conjunction
with interp.
In the case "periodic" n must be choosen >= 3. In the non periodic case,
n must be >= 4 (but n=3 gives some kind of results) and the boundary/end
conditions for the spline are of type "not-a-knot conditions" and
prescribe (if x1, x2, ..., xn are the interpolation nodes) :
S'''(x2-) = S'''(x2+)
S'''(x{n-1}-) = S'''(x{n-1}+)
so the first cubic polynomial p1 is equal to the second p2 and the same
is valid for the 2 last ones : p{n-2}=p{n-1}.
EXAMPLE
x=0:0.5:10;f=sin(x);
d=splin(x,f);
S=interp(0:0.1:10,x,f,d);
plot2d(x',f',-1);
plot2d((0:0.1:10)',S',2,'000')
SEE ALSO
interp, smooth
|