%
%
%
% Optical Imaging and Spectroscopy
%
% David J. Brady
% Duke University
% www.opticalimaging.org
%
% Figure 3.6
%
% Analysis of DFT of Gaussian fn 
%
X=2;
N=32;
xrange=linspace(-X,X,N);
xStep=xrange(3)-xrange(2);
urange=(-N/(4*X)):(1/(2*X)):(N/2-1)/(2*X);
gx=exp(-pi*(xrange.^2));
figure(1);set(gcf,'color','white');
subplot(4,1,1);plot(xrange,gx,'-k');title('e^{-\pi x^2}');
subplot(4,1,2);plot(urange,xStep*abs(fftshift(fft(fftshift(gx)))),'-k');title(['DFT for N=' num2str(N)]);
N=64;
xrange=linspace(-X,X,N);
xStep=xrange(3)-xrange(2);
urange=(-N/(4*X)):(1/(2*X)):(N/2-1)/(2*X);
gx=exp(-pi*(xrange.^2));
subplot(4,1,3);plot(urange,xStep*abs(fftshift(fft(fftshift(gx)))),'-k');title(['DFT for N=' num2str(N)]);
N=128;
xrange=linspace(-X,X,N);
xStep=xrange(3)-xrange(2);
urange=(-N/(4*X)):(1/(2*X)):(N/2-1)/(2*X);
gx=exp(-pi*(xrange.^2));
%subplot(4,1,1);plot(xrange,gx);title('e^{-\pi x^2}');
subplot(4,1,4);plot(urange,xStep*abs(fftshift(fft(fftshift(gx)))),'-k');title(['DFT for N=' num2str(N)]);
