% ----------------------------------------
% cubic_spline.m
% cubic spline interpolation of data
% ----------------------------------------
clear all;clf;
% knots
x = -4:4; y = [0 .15 1.12 2.36 2.36 1.46 .49 .06 0];
% spline coefficients
c = spline(x,[0 y 0]);
% dense set of x-points
xx = linspace(-4,4,101);
plot(x,y,'o',xx,ppval(c,xx),'-');
