M = 18 ;
N = 2^M ;
t = 1:N ;

f = (.1:.05:1.9)*2^(-12) ;
Lf = length(f) ;

T = 2048 ;%round(K/2/f) ;
te = 1:T:N ;
L = length(te) ;

for k = 1:Lf
    
    x = sin(2*pi*f(k)*t) ;

    X = fft(x(te)) ;
    Xp = zeros(1,N) ;
    Xp(1:L/2) = X(1:L/2) ;
    Xp(N-L/2:N) = X(L/2:L) ;

    xe = ifft(Xp)*N/L ;

    figure(1)
    subplot(211)
    plot(x)
    axis([N/2-N/16 N/2+N/16 -1.1 1.1])
    hold on
    plot(te,x(te),'or')
    for m = 1:L
        plot([te(m) te(m)],[-1.1 1.1],'k')
    end
    set(gca,'XTick',[]); set(gca,'YTick',[]);
    hold off
    title('signal + echantillons')

    subplot(212)
    plot(te,x(te),'or')
    axis([N/2-N/16 N/2+N/16 -1.1 1.1])

    hold on
    plot(t,real(xe),'r')
    set(gca,'XTick',[]); set(gca,'YTick',[]);
    hold off
    title('interpolation')
    
    pause(.5)

end