
function sfa1


% aliasing 
%  L=10, N=16
% konvoluce s orezanim, 
% L=1, N=16 
% presne 
 L=10, N=64
  del=L/N;
  x=(-N/2:N/2-1)*del; 
  f=(-N/2:N/2-1)/N/del;
  a=5*del;
  g=exp(-pi*(x-a).^2);
  G=ft(g,del);
  
  M=1000;
  xx=linspace(x(1),x(end),M);
  ff=linspace(f(1),f(end),M);
  gg=exp(-pi*xx.^2);
  GG=exp(-pi*ff.^2).*exp(-I*2*pi*a*ff);
  figure(1)
  plot(f,abs(G),"x",ff,abs(GG),".")
  axis("tight")
  figure(2)
  plot(f,arg(G),"x",ff,arg(GG),".")
  axis("tight")



break

% vzorkovani sinc

  L=512; N=1024;


  del=L/N;
  x=(-N/2:N/2-1)*del;
  f=(-N/2:N/2-1)/N/del;

  g=sinc(x);
  G=ft(g,del);
  
  M=4096;
  xx=linspace(x(1),x(end),M);
  ff=linspace(f(1),f(end),M);
  gg=sinc(xx);
  GG=abs(ff)<=1/2;
  close(2);
  figure(1)
  plot(f,abs(G),"x",ff,abs(GG),".")
  axis("tight")

  max(abs(G))

end





function G=ft(g,del)
 G=fftshift(fft(ifftshift(g)))*del;
end


function g=ift(G,delf)
 g=fftshift(ifft(ifftshift(g)))*delf*length(G);
end
