Sitemap

How does that thing work?

4 min readJan 10, 2019

--

Probably math.

Back in engineering school we learned a bit of advanced math which included the Fast Fourier Transformation (FFT). This is isn’s the simplest idea to explain using the actual math but isn’t so bad if we look at some visual aids. The fourier transform is fundamental to many parts of our daily lives quietly working in the background. Has anyone heard of a JPG? How about an MP3? Maybe GPS?

Without doing too much math, simply, we can transform a signal in the time domain to its components in the frequency domain. No matter how crazy looking a time series plot looks, it can be represented by a sum of individual frequencies (sine waves)

https://giphy.com/gifs/Q4TFjBrtYSo8/html5

Here, is an example of breaking down a square wave. We can take the total interference of sin waves and generate a square-wave, triangle, or sawtooth-wave. The side profile of the component wave heights represents the harmonics which comprise the original signal. The largest wave is the fundamental wave and each additional wave is a multiple of that wave frequency. These are know as harmonics which may sound familiar…

Indeed, it is something we come across in music. Below is a plot of a standing waves with the fundamental and the nodes of several harmonics (also known as partials or overtones). Without digressing too much a standing wave doesn’t look like it is moving, in musical instruments this would be due to resonance. The wave is traveling back and forth and interferes with itself producing areas of maximum constructive and destructive interference.

Press enter or click to view image in full size
https://en.wikipedia.org/wiki/File:Harmonic_partials_on_strings.svg

So we have known about the functional representation of fourier analysis for a long time but more recently it has been applied to technology to do some amazing things. Back to that JPG and MP3 reference.

Get Josh Cocciardi’s stories in your inbox

Join Medium for free to get updates from this writer.

Similar to how a sound may look like a complicated noise and yet is still composed of individual frequency components, the same is true for other analog or continuous time signals such as a photo. We can look at the digital nature of an image and see each pixel as a single color and we can take a step up from the pixel and look at a block of pixel, they may not be the same color but we can certainly approximate the color of the block of pixels using fourier analysis. Each block would have a fundamental frequency of color with technically an infinite number of harmonics adding together to create the true image block. What we would see is a single frequency that represents the entire block, a single color! This obviously wouldn’t be a very good representation of the image so we can add back another harmonic of image information, and so on until we get to a point where the image looks very close to the original. If we wanted to say, compress the size of the image by removing some information, we could simply use enough harmonics so the image looks good while removing the rest of infinite smaller harmonics. Rather than store all of that analog photo information, we now have a smooth looking approximation of the original that has been…. compressed!

Here are a few examples of poor jpeg compression to make the block approximation clear. JPEG actually uses tiny circle waves based off of fourier transforms.

http://stephaniehurlburt.com/blog/2016/12/20/a-taste-of-fourier-transforms-and-jpeg-compression
http://stephaniehurlburt.com/blog/2016/12/20/a-taste-of-fourier-transforms-and-jpeg-compression

Next up, MP3s. Now that we know generally how fourier analysis works it is easy to see how we can apply to additional mediums. MP3s utilize fourier to snip off the really high note information preserving the overall sound but dramatically reducing the size of the file.

What other complicated continuous signals could we break down to fundamental frequencies? Stocks?

Press enter or click to view image in full size
stock img

Why not! Don’t get too excited, someone already thought of it. While fourier analysis can curve fit, its powers of prediction are limited. That is not to say it is not a useful tool. Here is a link to the investopedia page about fourier.

Algorithm stock trading, especially high frequency trading certainly can take advantage of fourier analysis. These tools are becoming so readily available you can access them in most stock packages or newer exciting algo tools such as Quantopian that literally lets you code out trading algorithms that you can test on historical data and that real investors can use, cool!

Fourier transforms are used for even more than what is covered here and have very powerful curve fitting powers. Flatirons very own data science program may be a good resource to learn more about some of the existing tools and models utilizing fourier analysis.

--

--