
208 Introduction to Computational Modeling
The C program in file csinterpf.c is shown in Listing 16.2. Line 32 calls func-
tion csinterp to compute the interpolation using the cubic spline technique. This pro-
gram is very similar to the previous program that performed linear interpolation. The
first argument used in calling the library function gsl interp alloc is the gsl constant
gsl interp cspline, which specifies the type of interpolation to apply.
FIGURE 16.4: Graph of given data points.
Listing 16.2: Script to compute cubic spline interpolation of data.
1 /
*
Program: csinterpf.c
2 Interpolation of Discrete Points
3 Using Cubic Spline interpolation