Difference between revisions of "Fast Fourier Transform Library & Arduino"

From ESE205 Wiki
Jump to: navigation, search
(Process)
(External References)
Line 63: Line 63:
 
eBox log page [https://classes.engineering.wustl.edu/ese205/core/index.php?title=EBOX_Log here]
 
eBox log page [https://classes.engineering.wustl.edu/ese205/core/index.php?title=EBOX_Log here]
 
==External References==
 
==External References==
 +
https://www.youtube.com/watch?v=spUNpyF58BY&t=21s
 +
 +
https://www.algorithm-archive.org/contents/cooley_tukey/cooley_tukey.html
 +
 +
https://www.youtube.com/watch?v=XtypWS8HZco&t=22s
 +
 +
http://people.scs.carleton.ca/~maheshwa/courses/5703COMP/16Fall/FFT_Report.pdf
 +
 +
https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm

Revision as of 17:37, 8 December 2018

Overview

Introduction

As the name suggests the Fast Fourier Transform Library enables for the timely computation of a signal's discrete Fourier transform. Instructions on how to download the latest release can be found here. A fast Fourier transform (fFt) would be of interest to any wishing to take a signal or data set from the time domain to the frequency domain.

Materials & Prerequisites

Materials

All items one needs to utilize an fFT with an Arduino are:

    *Computer
    *Arduino
    *USB connector

Prerequisites

Next download latest open-source Arduino Software here.

Process

First, let's begin with a discussion of a general Fourier Transform (FT) and then we will address the Fast Fourier Transform (FFT). The Fourier transform is a mathematical function that decomposes a waveform, which is a function of time, into the frequencies that make it up. The result produced by the Fourier transform is a complex valued function of frequency. The absolute value of the Fourier transform represents the frequency value present in the original function and its complex argument represents the phase offset of the basic sinusoidal in that frequency.

The Fourier transform is also called a generalization of the Fourier series. This term can also be applied to both the frequency domain representation and the mathematical function used. The Fourier transform helps in extending the Fourier series to non-periodic functions, which allows viewing any function as a sum of simple sinusoids. The definition of which is provided below. Note that we use the discrete time definition of the FT, or a Discrete Fourier Transform (DFT), and not the continuous time definition, the main difference between the two being a summation vs an integral. We make this choice because inputs into computers are discrete data points and not continuous so we can not use an integral, and by extension, we can't use the continuous time definition of the FT.

The decomposition of functions into their respective frequencies is a very powerful and useful tool, however, an FT requires massive amounts of computational work. For those of you in computer science, an FT would take O(n^2) time. So although we want to use this tool it is computationally expensive. Or at least this was the case until J.W Cooley and John Tukey came on the scene. They came up with the aptly named Cooley–Tukey FFT algorithm which reduced the time cost on a DFT from O(n^2) to O(nlogn). It recursively breaks down the DFT into smaller DFTs and turns the summation into a dynamic programming problem. So we save on time but we increase our space complexity dramatically, however, due to the continued improvement in transistor technology, modern day computing, for all practical purposes, doesn't care about space complexity until it has to. An example of a field that has to would be computational biology, due to the vast number of different genes in existence that all need to be tested. But that's beside the point, let's continue our discussion of an FFT.

The actual algorithm begins by splitting the matrix into two parts, one with all the even indexed elements, the other part with all the odd indexed elements. We continue spliting the matrices down in the same manner until we can perform a DFT on a manageable matrix. Another way to implement the split, rather than by the even-odd index convention, would be through a reversing the bit value of the array entry's index. You make the choice only on the language you program in; so choose the option that takes up less time to implement for the language.

Coding it will look like:


function cooley_tukey(x)

   N = length(x)
   if (N > 2)
       x_odd = cooley_tukey(x[1:2:N])
       x_even = cooley_tukey(x[2:2:N])
   else
       x_odd = x[1]
       x_even = x[2]
   end
   n = 0:N-1
   half = div(N,2)
   factor = exp.(-2im*pi*n/N)
   return vcat(x_odd .+ x_even .* factor[1:half], x_odd .- x_even .* factor[1:half])

end

An Example

https://github.com/kosme/arduinoFFT/tree/master/Examples

Authors

  • Jordan Gewirtz
  • Nish Chakraburtty
  • Chanel Lynn

Group Link

eBox project page here

eBox log page here

External References

https://www.youtube.com/watch?v=spUNpyF58BY&t=21s

https://www.algorithm-archive.org/contents/cooley_tukey/cooley_tukey.html

https://www.youtube.com/watch?v=XtypWS8HZco&t=22s

http://people.scs.carleton.ca/~maheshwa/courses/5703COMP/16Fall/FFT_Report.pdf

https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm