% A script to demonstrate Fourier interpolation with fstretch()
% Create coarsely sampled dataset
x1 = -10:0.5:10; % x data
y1 = x1./(1+x1.^2); % y data, using function y = x/(1+x^2).

N1 = numel(x1);
N2 = 7*N1+19; % Note that N2/N1 doesn't have to be an integer.

[x2,y2] = fstretch(x1,y1,N2); % FFT interpolation
y2a = x2./(1+x2.^2); % True analytic function, for comparison

hold off
plot(x1,y1,'+k', x2,y2a,'k', x2,y2,'r');
legend('data','true','FFT interpolated');