Matlab Database > Interpolation > Interpolation by Splines > CSPLINE

Matlab File(s)

Title: CSPLINE
Author: Rolf Krause
E-Mail: krause-AT-ins.uni-bonn.de
Institution: University of Bonn
Description: Cubic spline interpolation for given nodes x .
Two types of spline interpolation are available:
With given slopes at the endpoints:
y = [left_slope y_values right_slope] : given values
Without given slopes at the endpoints:
y = [y_values] : given values
xx - where to interpolate

usage: [a, b, c, d] = cspline(x,y,xx) or yy = cspline(x,y,xx)

See also the matlab-function SPLINE

Example:
x = 0:10; y = cos(x);
xx = 0:.25:10;
yy = cspline(x,y,xx);
plot(x,y,'o',xx,yy)

Knowing the slopes at the endpoints, a better result can be obtained by

x = 0:10; y = cos(x);
xx = 0:.25:10;
yy = cspline(x,[-sin(xx(1)) y -sin(xx(end))],xx);
plot(x,y,'o',xx,yy)
Keywords: ---
File Name: cspline.m
File Size: 3 KB
File Version: 1.0
Matlab Version: 6.1
Date: 1998-02-22
Downloads: 6935
Download File

Upload your own files today! Click here for more information.