% The function shows the Fourier spectra for several
% localized and homogeneous functions
function wavelet_01
  
echo off, clc
clear all


% Generating the grid;
N = 1024;
dx = 2.0 * pi / N;
X = (0.0 : dx : (N-1) * dx);
Y = (1:N/2);


F1a = sin( X );
F1b = fft( F1a );

F2a(1:N) = 0.0;
F2a(156:356) = 1.0;
F2b = fft( F2a );

F3a(1:N) = 0.0;
F3a(668:868) = -1.0;
F3b = fft( F3a );

figure(1); plot(X,F1a,'b',X,F2a,'r',X,F3a,'g');

figure(2); loglog(Y,abs(F1b(1:N/2)),'b',Y,abs(F2b(1:N/2)),'r',Y,abs(F3b(1:N/2)),'g');

figure(3); loglog(Y,angle(F2b(1:N/2)),'r',Y,angle(F3b(1:N/2)),'g');


