Engineers-Excel.com

     
Engineering using Spreadsheets

Discrete Fourier Transform: How it works

Description
How it works
Gallery 1
Gallery 2








This page explains how the DFT is implemented in the spreadsheet, it does not cover the thoery behind it. For DFT basics, see this page.

Firstly, the signal is plotted by taking 141 points over the range using the Data Tables feature. The values are tabulated in columns X and Y. Column Z and AA contains 71 sampled values of the signal, which are shown as red dots on the time domain plot. The INDEX function is used to obtain the signal samples, this is more efficient compared to re-evaluating the function.

DFT is then calculated by doing a matrix multiplication of the sampled values using the formula:

DFT formula

where k ranges from 0 to 70. The values of k, n and the real and imaginary parts of the exponential are stored in the named formulae k (it includes the 2*pi/N term too), n, DFTRe and DFTIm respectively. The MMULT function is used to obtain the real and imaginary parts of the DFT in  columns AB and AC.

The named formula freq evaluates the frequencies, the amplitudes are obtained using the formula

Amplitude = (Real part2 + Im part2)0.5

As the DFT is symmetric, we only plot the first half of the values in columns AD and AE in the lower plot.

Why only 71 samples ?

The Excel function MMULT can only multiply 2 arrays of maximum size 73 rows by 73 columns (I found this by trial and error). Hence, at best, we can only take 73 samples. I used 71 samples during the development of the tool and I have kept it that way.