N = 10;
D1 = ones(1,2*N).*0.5;
u = -1+1/N:1/N:1;
z = 4;
k = z*2*pi*u/length(u);
D2 = D1.*exp(-4*k.^2);

d1 = real(ifft(D1));
d2 = real(ifft(D2));
sd1 = fftshift(d1);
sd2 = fftshift(d2);
e1 = realdisvec(D1,u,1,1,0);
e2 = realdisvec(D2,u,1,1,0);

for i = 1:2*N
    f1(i) = realdis(D1,u(i),1,1,0);
    f2(i) = realdis(D2,u(i),1,1,0);
end

subplot(3,1,1)
hold on;
plot(u,sd1);
plot(u,sd2,'r');

subplot(3,1,2)
hold on;
plot(u,e1);
plot(u,e2,'r');

subplot(3,1,3)
hold on;
plot(u,f1);
plot(u,f2,'r');