% Generates a plot of a parametrised natural cubic spline through five
% points (0,0), (1,1), (0,2), (0,-1) and (2,1).

% Time axis
t = 1:5;
% Set x and y-values
x = [0 1 0  0 2];
y = [0 1 2 -1 1];

% We use Matlab's built-in spline function
tv = linspace(1,5,100); 
xv = spline(t,x,tv);
yv = spline(t,y,tv);
plot(xv,yv,'b-',x,y,'ro','LineWidth',2)



