Module 1 : Introductory Programming
Chapter 9 : Fourier Transforms and plotting softwares
 
9.2b The Fast Fourier Transform (FFT)
For the FFT, the lines are similar, except that dct is changed to FFT to represent the fast Fourier transform. The fast Fourier transform is an improved version of the Fourier transform algorithm. The improvement comes by using the periodic properties of the cos and sine functions, thereby reducing the number of evaluations of the functions to its values on only one period. The lines to use the FFT are given below.

//Function  exp(-a*t**2) FFT
//FFT forward and inverse using scilab
N=256;
t=linspace(0,10,N);
t(1)
t(2)
t(100)
t(256)

//Function 2 exp(-a*t**2) FFT
//FFT forward and inverse using scilab
N=256;
t=linspace(0,10,N);
t(1)
t(2)
t(100)
t(256)
for i=1:N,A(i) = exp(-200.0* t(i)*t(i));end;
plot(A);
A(1)
A(2)
A(100)
A(256)
X=fft(A,-1);
plot(X);
X(1)
X(2)
X(100)
X(256)

Y=fft(X,1);

plot(Y)