/ Machine Learning

An implementation of the Fourier Transform using Python

An implementation of the Fourier Transform using Python

Fourier Transform

The Fourier transform (FT) decomposes a function of time (a signal) into the frequencies that make it up, in a way similar to how a musical chord can be expressed as the frequencies (or pitches) of its constituent notes. In this sort repository I will be implementing a general Fourier Transform algorithm capable of decomposing a function f(x) = sin(2apix) + sin(2bpix) ... for constants a,b,.. > 0.

Here is an image of the man who came up with this idea.



The Code is written in Python 3.6.5 . If you don't have Python installed you can find it here. If you are using a lower version of Python you can upgrade using the pip package, ensuring you have the latest version of pip.

To install pip run in the command Line

python -m ensurepip -- default-pip

to upgrade it

python -m pip install -- upgrade pip setuptools wheel

to upgrade Python

pip install python -- upgrade

Additional Packages that are required are: Numpy and MatplotLib\

You can donwload them using pip

pip install numpy MatplotLib

or conda

conda install numpy MatplotLib


  • Create a fake signal and apply the fourier Transform with run.py
    • Basic Usage : python run.py -s a b ...
    • Plots the signal, then the decomposition and saves the figures
    • Option:
      • python run.py -s a b --n True
      • Uses my own implementation of the FFT


python run.py -s 10 20

python run.py -s 50 200

python run -s 50 100 250 600