% Interpolate with a spline curve and finer spacing.
% the code in getdata.m must be run first
n = length(x);
t  = 1:n;                            % integers from 1 to n
ts = 1: .2: n;                       % from 1 to n, stepsize 0.2
xys = spline(t,[x;y],ts);            % do the spline interpolation
xs = xys(1,:);  ys = xys(2,:);       % extract the components

% Plot the interpolated curve.
figure(1);                           % plot in the first graphics window
plot(xs,ys,x,y,'*-');
xlabel('x'); ylabel('y')
grid on

figure(2);                           % write to second window
% Plot the two components of the spline curve separately  show the labels
plot([1:length(xs)],xs,'g-',[1:length(ys)],ys,'b-') 
legend('x values','y values')
xlabel('numbering'); ylabel('values')
grid on