splines.h File Reference

Go to the source code of this file.

Functions

void CubicSpline (int N, double *a, double *b, double *c, double *d, double *x, double *y, int bordermode, int mode=0, double *data=0, double xinterval=1, double xstart=0, double xend=-1)
 
void CubicSpline (int N, double *a, double *b, double *c, double *d, double h, double *y, int bordermode, int mode=0, double *data=0, double xinterval=1, double xstart=0, double xend=-1)
 
void Smooth_Interpolate (double *y, int N, int P, double *x, double *xind)
 

Detailed Description

  • spline interpolation routines

Function Documentation

void CubicSpline ( int  N,
double *  a,
double *  b,
double *  c,
double *  d,
double *  x,
double *  y,
int  bordermode,
int  mode,
double *  data,
double  xinterval,
double  xstart,
double  xend 
)

function CubicSpline: computing piece-wise trinomial coefficients of a cubic spline

In: x[N+1], y[N+1]: knots bordermode: boundary mode of cubic spline bordermode=0: natural: y''(x0)=y''(x_N)=0 bordermode=1: quadratic runout: y''(x0)=y''(x1), y''(x_N)=y''(x_(N-1)) bordermode=2: cubic runout: y''(x0)=2y''(x1)-y''(x2), the same at the end point mode: spline format mode=0: spline defined on the l'th piece as y(x)=a[l]x^3+b[l]x^2+c[l]x+d[l] mode=1: spline defined on the l'th piece as y(x)=a[l]t^3+b[l]t^2+c[l]t+d[l], t=x-x[l] Out: a[N],b[N],c[N],d[N]: piecewise trinomial coefficients data[]: cubic spline computed for [xstart:xinterval:xend], if specified No return value. On start d must be allocated no less than N+1 storage units.

void CubicSpline ( int  N,
double *  a,
double *  b,
double *  c,
double *  d,
double  h,
double *  y,
int  bordermode,
int  mode,
double *  data,
double  xinterval,
double  xstart,
double  xend 
)

function CubicSpline: computing piece-wise trinomial coefficients of a cubic spline with uniformly placed knots

In: y[N+1]: spline values at knots (0, h, 2h, ..., Nh) bordermode: boundary mode of cubic spline bordermode=0: natural: y''(x0)=y''(x_N)=0 bordermode=1: quadratic runout: y''(x0)=y''(x1), y''(x_N)=y''(x_(N-1)) bordermode=2: cubic runout: y''(x0)=2y''(x1)-y''(x2), the same at the end point mode: spline format mode=0: spline defined on the l'th piece as y(x)=a[l]x^3+b[l]x^2+c[l]x+d[l] mode=1: spline defined on the l'th piece as y(x)=a[l]t^3+b[l]t^2+c[l]t+d[l], t=x-x[l] Out: a[N],b[N],c[N],d[N]: piecewise trinomial coefficients data[]: cubic spline computed for [xstart:xinterval:xend], if specified No return value. On start d must be allocated no less than N+1 storage units.

void Smooth_Interpolate ( double *  y,
int  N,
int  P,
double *  x,
double *  xind 
)

function Smooth_Interpolate: smoothly interpolate/extrapolate P-piece spline from P-1 values. The interpolation scheme is chosen according to P: P-1=1: constant P-1=2: linear function P-1=3: quadratic function P-1>=4: cubic spline

In: xind[P-1], x[P-1]: knot points Out: y[N]: smoothly interpolated signal, y(xind[p])=x[p], p=0, ..., P-2.

No return value.