%This illustrated 1-D interpolation using quadratic splines.
%Form 1-D samples to be interpolated (B=beta=samples of quadratic spline):
clear;B=[1/8 3/4 1/8];C=[24 8 16 32];X=conv(B,C);N=length(X);
%Next 2 lines: quadratic spline as function of time t:
t=[-2:0.001:2];S(4001)=0;S(501:1500)=((3/2+t(501:1500)).^2)/2;
S(1501:2500)=3/4-t(1501:2500).^2;S(2501:3500)=((3/2-t(2501:3500)).^2)/2;
%Next 2 lines: time-shifted splines as functions of time t2:
t2=[-4.001:0.001:4.001];S1=[0 S zeros(1,4001)];S2=[zeros(1,1001) S zeros(1,3001)];
S3=[zeros(1,2001) S zeros(1,2001)];S4=[zeros(1,3001) S zeros(1,1001)];S5=[zeros(1,4001) S 0];
C=real(ifft(fft(X,N)./fft(B,N),N));%Compute coefficients C(I) by 1-D deconvolution:
XX=S1*C(1)+S2*C(2)+S3*C(3)+S4*C(4);%Interpolated function
figure,stem([-4:4],[0 X 0 0]),title('Samples x(n\Delta) to be interpolated')
figure,plot(t2,XX,'r'),hold on,stem([-4:4],[0 X 0 0]),title('Quadratic spline interpolation')