% Interpolate simple 2-D line with spline.m
% spline2Dline.m  L Braile 3/7/2005
x = [0.8 3.5 2.5 2 9 10 6 4 9];
y = [10.2 12 9.2 6.6 11 10 5 1 4];
n = length(x);
t = [1:n];
ts = [1:0.1:n];
xs = spline(t,x,ts);
ys = spline(t,y,ts);
plot(x,y,'-b',x,y,'ob')
hold on
plot(xs,ys,'-r','linewidth',3)
axis equal
axis([0 14 0 14]);
xlabel('x')
ylabel('y')
title('Spline interpolation with "2-D" line (multi-valued function in x)')
hold off