0% found this document useful (0 votes)
72 views

An Interactive Guide To The Fourier Transform - BetterExplained

The document provides an interactive guide to help build intuition about the Fourier Transform. It uses analogies and visualizations to explain that the Fourier Transform takes a time-based signal and decomposes it into its constituent cyclic components, similar to how one could filter out individual ingredients from a smoothie to determine the recipe. The guide aims to help readers gain an intuitive understanding of the Fourier Transform without jumping straight into complex mathematical equations.

Uploaded by

chafle tube
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

An Interactive Guide To The Fourier Transform - BetterExplained

The document provides an interactive guide to help build intuition about the Fourier Transform. It uses analogies and visualizations to explain that the Fourier Transform takes a time-based signal and decomposes it into its constituent cyclic components, similar to how one could filter out individual ingredients from a smoothie to determine the recipe. The guide aims to help readers gain an intuitive understanding of the Fourier Transform without jumping straight into complex mathematical equations.

Uploaded by

chafle tube
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

An Interactive Guide To The Fourier Transform


Home › Math, Popular ›

The Fourier Transform is one of deepest insights ever made. Unfortunately, the meaning is buried within dense equations:

Yikes. Rather than jumping into the symbols, let's experience the key idea rsthand. Here's a plain-English metaphor:

What does the Fourier Transform do? Given a smoothie, it nds the recipe.
How? Run the smoothie through lters to extract each ingredient.
Why? Recipes are easier to analyze, compare, and modify than the smoothie itself.
How do we get the smoothie back? Blend the ingredients.

Here's the "math English" version of the above:

The Fourier Transform takes a time-based pattern, measures every possible cycle, and returns the overall "cycle recipe"
(the amplitude, offset, & rotation speed for every cycle that was found).

Time for the equations? No! Let's get our hands dirty and experience how any pattern can be built with cycles, with live
simulations.

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 1/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

If all goes well, we'll have an aha! moment and intuitively realize why the Fourier Transform is possible. We'll save the detailed
math analysis for the follow-up.
Join 450k Monthly
This isn't a force-march through the equations, it's the casual stroll I wish I had. Onward!
Readers

Enjoy the article? Keep reading to


Fourier Transform Intuition
gain an intuitive understanding of
math.

Email Address

Join Newsletter!

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 2/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

From Smoothie To Recipe


Join 450k Monthly
A math transformation is a change of perspective. We change our notion of quantity from "single items" (lines in the sand, tally
system) to "groups of 10" (decimal) depending on what we're counting. Scoring a game? Tally it up.Readers
Multiplying? Decimals,
please.

Enjoy the article? Keep reading to


The Fourier Transform changes our perspective from consumer to producer, turning What do I have? into How was it made?
gain an intuitive understanding of
math.
In other words: given a smoothie, let's nd the recipe.

Why? Well, recipes are great descriptions of drinks. You wouldn't share a drop-by-drop analysis, you'd say "I had an
Email Address
orange/banana smoothie". A recipe is more easily categorized, compared, and modi ed than the object itself.
Join Newsletter!
So... given a smoothie, how do we nd the recipe?

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 3/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Join 450k Monthly


Readers

Enjoy the article? Keep reading to


gain an intuitive understanding of
math.

Email Address

Join Newsletter!

Well, imagine you had a few lters lying around:

Pour through the "banana" lter. 1 oz of bananas are extracted.


Pour through the "orange" lter. 2 oz of oranges.
Pour through the "milk" lter. 3 oz of milk.
Pour through the "water" lter. 3 oz of water.

We can reverse-engineer the recipe by ltering each ingredient. The catch?

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 4/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Filters must be independent. The banana lter needs to capture bananas, and nothing else. Adding more oranges
should never affect the banana reading.
Join 450k Monthly
Filters must be complete. We won't get the real recipe if we leave out a
Readers
lter ("There were mangoes too!"). Our collection
of lters must catch every possible ingredient.
Enjoy the article? Keep reading to
Ingredients must be combine-able. Smoothies can be separated and re-combinedgain
without issue (Aunderstanding
an intuitive cookie? Not soof
math.
much. Who wants crumbs?). The ingredients, when separated and combined in any order, must make the same result.

Email Address
See The World As Cycles
The Fourier Transform takes a speci c viewpoint: What if any signal could be ltered into a bunch of circular paths?
Join Newsletter!

Whoa. This concept is mind-blowing, and poor Joseph Fourier had his idea rejected at rst. (Really Joe, even a staircase pattern
can be made from circles?)

And despite decades of debate in the math community, we expect students to internalize the idea without issue. Ugh. Let's
walk through the intuition.

The Fourier Transform nds the recipe for a signal, like our smoothie process:

Start with a time-based signal


Apply lters to measure each possible "circular ingredient"
Collect the full recipe, listing the amount of each "circular ingredient"

Stop. Here's where most tutorials excitedly throw engineering applications at your face. Don't get scared; think of the examples
as "Wow, we're nally seeing the source code (DNA) behind previously confusing ideas".

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 5/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

If earthquake vibrations can be separated into "ingredients" (vibrations of different speeds & amplitudes), buildings can
be designed to avoid interacting with the strongest ones.
Join 450k Monthly
Readers
If sound waves can be separated into ingredients (bass and treble frequencies), we can boost the parts we care about, and
hide the ones we don't. The crackle of random noise can be removed. Maybe similar "sound recipes" can be compared
(music recognition services compare recipes, not the raw audio clips). Enjoy the article? Keep reading to
gain an intuitive understanding of
math.
If computer data can be represented with oscillating patterns, perhaps the least-important ones can be ignored. This
"lossy compression" can drastically shrink le sizes (and why JPEG and MP3 les are much smaller than raw .bmp or .wav
les). Email Address

If a radio wave is our signal, we can use lters to listen to a particular channel. In the smoothie
Joinworld, imagine each
Newsletter!
person paid attention to a different ingredient: Adam looks for apples, Bob looks for bananas, and Charlie gets cauli ower
(sorry bud).

The Fourier Transform is useful in engineering, sure, but it's a metaphor about nding the root causes behind an observed
effect.

Think With Circles, Not Just Sinusoids


One of my giant confusions was separating the de nitions of "sinusoid" and "circle".

A "sinusoid" is a speci c back-and-forth pattern (a sine or cosine wave), and 99% of the time, it refers to motion in one
dimension.
A "circle" is a round, 2d pattern you probably know. If you enjoy using 10-dollar words to describe 10-cent ideas, you
might call a circular path a "complex sinusoid".

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 6/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Labeling a circular path as a "complex sinusoid" is like describing a word as a "multi-letter". You zoomed into the wrong level of
detail. Words are about concepts, not the letters they can be split into!
Join 450k Monthly
Readers
The Fourier Transform is about circular paths (not 1-d sinusoids) and Euler's formula is a clever way to generate one:

Enjoy the article? Keep reading to


gain an intuitive understanding of
math.

Email Address

Join Newsletter!

Must we use imaginary exponents to move in a circle? Nope. But it's convenient and compact. And sure, we can describe our
path as coordinated motion in two dimensions (real and imaginary), but don't forget the big picture: we're just moving in a
circle.

Following Circular Paths

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 7/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Let's say we're chatting on the phone and, like usual, I want us to draw the same circle simultaneously. (You promised!) What
should I say?
Join 450k Monthly
How big is the circle? (Amplitude, i.e. size of radius)
Readers
How fast do we draw it? (Frequency. 1 circle/second is a frequency of 1 Hertz (Hz) or 2*pi radians/sec)
Where do we start? (Phase angle, where 0 degrees is the x-axis) Enjoy the article? Keep reading to
gain an intuitive understanding of
math.
I could say "2-inch radius, start at 45 degrees, 1 circle per second, go!". After half a second, we should each be pointing to:
starting point + amount traveled = 45 + 180 = 225 degrees (on a 2-inch circle).

Email Address

Join Newsletter!

Every circular path needs a size, speed, and starting angle (amplitude/frequency/phase). We can even combine paths: imagine
tiny motorcars, driving in circles at different speeds.

The combined position of all the cycles is our signal, just like the combined avor of all the ingredients is our smoothie.

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 8/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Here's a simulation of a basic circular path:

Join 450k Monthly


Cycles 0 1 Time 1 -1
Readers
Enjoy the article? Keep reading to
gain an intuitive understanding of
math.

Email Address

1
Total Parts Ticks Derive Running?
Join Newsletter!

(Based on this animation, here's the source code. Modern browser required. Click the graph to pause/unpause.)

The magnitude of each cycle is listed in order, starting at 0Hz. Cycles [0 1] means

0 amplitude for the 0Hz cycle (0Hz = a constant cycle, stuck on the x-axis at zero degrees)
1 amplitude for the 1Hz cycle (completes 1 cycle per time interval)

Now the tricky part:

The blue graph measures the real part of the cycle. Another lovely math confusion: the real axis of the circle, which is
usually horizontal, has its magnitude shown on the vertical axis. You can mentally rotate the circle 90 degrees if you like.
The time points are spaced at the fastest frequency. A 1Hz signal needs 2 time points for a start and stop (a single
data point doesn't have a frequency). The time values [1 -1] shows the amplitude at these equally-spaced intervals.

With me? [0 1] is a pure 1Hz cycle.


https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 9/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Now let's add a 2Hz cycle to the mix. [0 1 1] means "Nothing at 0Hz, 1Hz of amplitude 1, 2Hz of amplitude 1":

Join 450k Monthly


Cycles 0 1 1 Time 2 -1 -1
Readers
Enjoy the article? Keep reading to
gain an intuitive understanding of
math.

Email Address

1
Total Parts Ticks Derive Running?
Join Newsletter!

Whoa. The little motorcars are getting wild: the green lines are the 1Hz and 2Hz cycles, and the blue line is the combined
result. Try toggling the green checkbox to see the nal result clearly. The combined " avor" is a sway that starts at the max and
dips low for the rest of the interval.

The yellow dots are when we actually measure the signal. With 3 cycles de ned (0Hz, 1Hz, 2Hz), each dot is 1/3 of the way
through the signal. In this case, cycles [0 1 1] generate the time values [2 -1 -1], which starts at the max (2) and dips low (-1).

Oh! We can't forget phase, the starting angle! Use magnitude:angle to set the phase. So [0 1:45] is a 1Hz cycle that starts at 45
degrees:

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 10/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Cycles 0 1:45 Time 0.7 -0.7

Join 450k Monthly


Readers

Enjoy the article? Keep reading to


gain an intuitive understanding of
math.

1
Total Parts Ticks Derive Running?
Email Address
This is a shifted version of [0 1]. On the time side we get [.7 instead of [1 -1],
because our cycle isn't exactly lined up with
-.7]
Join Newsletter!
our measuring intervals, which are still at the halfway point (this could be desired!).

The Fourier Transform nds the set of cycle speeds, amplitudes and phases to match any time signal.

Our signal becomes an abstract notion that we consider as "observations in the time domain" or "ingredients in the frequency
domain".

Enough talk: try it out! In the simulator, type any time or cycle pattern you'd like to see. If it's time points, you'll get a
collection of cycles (that combine into a "wave") that matches your desired points.

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 11/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Join 450k Monthly


Readers

Enjoy the article? Keep reading to


gain an intuitive understanding of
math.

Email Address

But… doesn't the combined wave have strange values between the yellow time intervals? Sure. But who's
Join to say whether a
Newsletter!
signal travels in straight lines, or curves, or zips into other dimensions when we aren't measuring it? It behaves exactly as we
need at the equally-spaced moments we asked for.

Making A Spike In Time


Can we make a spike in time, like (4 0 0 0), using cycles? I'll use parentheses () for a sequence of time points, and brackets []
for a sequence of cycles.

Although the spike seems boring to us time-dwellers (one data point, that's it?), think about the complexity in the cycle world.
Our cycle ingredients must start aligned (at the max value, 4) and then "explode outwards", each cycle with partners that
cancel it in the future. Every remaining point is zero, which is a tricky balance with multiple cycles running around (we can't
just "turn them off").

Let's walk through each time point:

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 12/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

At time 0, the rst instant, every cycle ingredient is at its max. Ignoring the other time points, (4 ? ? ?) can be made from
4 cycles (0Hz 1Hz 2Hz 3Hz), each with a magnitude of 1 and phase of 0 (i.e., 1 + 1 + 1 + 1 = 4).
Join 450k Monthly
At every future point (t = 1, 2, 3), the sum of all cycles must cancel.
Readers
Here's the trick: when two cycles are on opposites sides of the circle (North & South, East & West,
Enjoy etc.) their
the article? combined
Keep reading to
position is zero (3 cycles can cancel if they're spread evenly at 0, 120, and 240 degrees). gain an intuitive understanding of
math.
Imagine a constellation of points moving around the circle. Here's the position of each cycle at every instant:

Email Address
Time 0 1 2 3
------------
Join Newsletter!
0Hz: 0 0 0 0
1Hz: 0 1 2 3
2Hz: 0 2 0 2
3Hz: 0 3 2 1

Notice how the the 3Hz cycle starts at 0, gets to position 3, then position "6" (with only 4 positions, 6 modulo 4 = 2), then
position "9" (9 modulo 4 = 1).

When our cycle is 4 units long, cycle speeds a half-cycle apart (2 units) will either be lined up (difference of 0, 4, 8…) or on
opposite sides (difference of 2, 6, 10…).

OK. Let's drill into each time point:

Time 0: All cycles at their max (total of 4)


Time 1: 1Hz and 3Hz cancel (positions 1 & 3 are opposites), 0Hz and 2Hz cancel as well. The net is 0.
Time 2: 0Hz and 2Hz line up at position 0, while 1Hz and 3Hz line up at position 2 (the opposite side). The total is still 0.
https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 13/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Time 3: 0Hz and 2Hz cancel. 1Hz and 3Hz cancel.


Time 4 (repeat of t=0): All cycles line up.
Join 450k Monthly
Readers
The trick is having individual speeds cancel (0Hz vs 2Hz, 1Hz vs 3Hz), or having the lined-up pairs cancel (0Hz + 2Hz vs 1Hz +
3Hz).
Enjoy the article? Keep reading to
When every cycle has equal power and 0 phase, we start aligned and cancel afterwards. (Igain don't
anhave a nice
intuitive proof yet -- any
understanding of
takers? -- but you can see it yourself. Try [1 1], [1 1 1], [1 1 1 1] and notice the signals we generate: (2math.
0), (3 0 0), (4 0 0 0)).

In my head, I label these signals as "time spikes": they have a value for a single instant, and are zero otherwise (the fancy name
Email Address
is a delta function.)
Join Newsletter!
Here's how I visualize the initial alignment, followed by a net cancellation:

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 14/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Join 450k Monthly


Readers
Enjoy the article? Keep reading to
gain an intuitive understanding of
math.

Email Address

Join Newsletter!

Moving The Time Spike


Not everything happens at t=0. Can we change our spike to (0 4 0 0)?

It seems the cycle ingredients should be similar to (4 0 0 0), but the cycles must align at t=1 (one second in the future). Here's
where phase comes in.

Imagine a race with 4 runners. Normal races have everyone lined up at the starting line, the (4 0 0 0) time pattern. Boring.

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 15/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

What if we want everyone to nish at the same time? Easy. Just move people forward or backwards by the appropriate distance.
Maybe granny can start 2 feet in front of the nish line, Usain Bolt can start 100m back, and they can cross the tape holding
Join 450k Monthly
hands.
Readers
Phase shifts, the starting angle, are delays in the cycle universe. Here's how we adjust the starting position to delay every cycle
1 second: Enjoy the article? Keep reading to
gain an intuitive understanding of
A 0Hz cycle doesn't move, so it's already aligned math.
A 1Hz cycle goes 1 revolution in the entire 4 seconds, so a 1-second delay is a quarter-turn. Phase shift it 90 degrees
backwards (-90) and it gets to phase=0, the max value, at t=1. Email Address
A 2Hz cycle is twice as fast, so give it twice the angle to cover (-180 or 180 phase shift -- it's across the circle, either way).
A 3Hz cycle is 3x as fast, so give it 3x the distance to move (-270 or +90 phase shift) Join Newsletter!

If time points (4 0 0 0) are made from cycles [1 1 1 1], then time points (0 4 0 0) are made from [1 1:-90 1:180 1:90]. (Note:
I'm using "1Hz", but I mean "1 cycle over the entire time period").

Whoa -- we're working out the cycles in our head!

The interference visualization is similar, except the alignment is at t=1.

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 16/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Join 450k Monthly


Readers

Enjoy the article? Keep reading to


gain an intuitive understanding of
math.

Email Address

Join Newsletter!

Test your intuition: Can you make (0 0 4 0), i.e. a 2-second delay? 0Hz has no phase. 1Hz has 180 degrees, 2Hz has 360 (aka 0),
and 3Hz has 540 (aka 180), so it's [1 1:180 1 1:180].

Discovering The Full Transform


The big insight: our signal is just a bunch of time spikes! If we merge the recipes for each time spike, we should get the recipe
for the full signal.

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 17/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

The Fourier Transform builds the recipe frequency-by-frequency:

Join 450k Monthly


Separate the full signal (a b c d) into "time spikes": (a 0 0 0) (0 b 0 0) (0 0 c 0) (0 0 0 d)
Readers
For any frequency (like 2Hz), the tentative recipe is "a/4 + b/4 + c/4 + d/4" (the amplitude of each spike is split among all
frequencies)
Enjoy
Wait! We need to offset each spike with a phase delay (the angle for a "1 second delay" the article?
depends on theKeep reading to
frequency).
Actual recipe for a frequency = a/4 (no offset) + b/4 (1 second offset) + c/4 (2 secondgain an +intuitive
offset) understanding
d/4 (3 second offset). of
math.
We can then loop through every frequency to get the full transform.

Email Address
Here's the conversion from "math English" to full math:

Join Newsletter!

A few notes:

N = number of time samples we have


n = current sample we're considering (0 .. N-1)
xn = value of the signal at time n
k = current frequency we're considering (0 Hertz up to N-1 Hertz)

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 18/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Xk = amount of frequency k in the signal (amplitude and phase, a complex number)

Join 450k Monthly


The 1/N factor is usually moved to the reverse transform (going from frequencies back to time). This is allowed, though I
Readers
prefer 1/N in the forward transform since it gives the actual sizes for the time spikes. You can get wild and even use
$1/\sqrt{N}$ on both transforms (going forward and back creates the 1/N factor).
n/N is the percent of the time we've gone through. 2 * pi * k is our speed in radians / sec. e^-ix is our backwards-moving
Enjoy the article? Keep reading to
circular path. The combination is how far we've moved, for this speed and time.
gain an intuitive understanding of
The raw equations for the Fourier Transform just say "add the complex numbers". Many programmingmath.languages cannot
handle complex numbers directly, so you convert everything to rectangular coordinates and add those.

Email Address
Onward
Join Newsletter!
This was my most challenging article yet. The Fourier Transform has several avors (discrete/continuous/ nite/in nite), covers
deep math (Dirac delta functions), and it's easy to get lost in details. I was constantly bumping into the edge of my knowledge.

But there's always simple analogies out there -- I refuse to think otherwise. Whether it's a smoothie or Usain Bolt & Granny
crossing the nish line, take a simple understanding and re ne it. The analogy is awed, and that's ok: it's a raft to use, and
leave behind once we cross the river.

I realized how feeble my own understanding was when I couldn't work out the transform of (1 0 0 0) in my head. For me, it was
like saying I knew addition but, gee whiz, I'm not sure what "1 + 1 + 1 + 1" would be. Why not? Shouldn't we have an intuition
for the simplest of operations?

That discomfort led me around the web to build my intuition. In addition to the references in the article, I'd like to thank:

Scott Young, for the initial impetus for this post


Shaheen Gandhi, Roger Cheng, and Brit Cruise for kicking around ideas & re ning the analogy

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 19/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Steve Lehar for great examples of the Fourier Transform on images


Charan Langton for her detailed walkthrough
Join 450k Monthly
Julius Smith for a fantastic walkthrough of the Discrete Fourier Transform (what we covered today)
Readers
Bret Victor for his techniques on visualizing learning

Enjoy
Today's goal was to experience the Fourier Transform. We'll save the advanced analysis for nextthe article? Keep reading to
time.
gain an intuitive understanding of
Happy math. math.

Email Address
Appendix: Projecting Onto Cycles
Stuart Rif e has a great interpretation of the Fourier Transform: Join Newsletter!

Imagine spinning your signal in a centrifuge and checking for a bias. I have a correction: we must spin backwards (the exponent
in the equation above should be $e^{-i 2 \pi...}$). You already know why: we need a phase delay so spikes appear in the future.

Appendix: Another Awesome Visualization


Lucas Vieira, author of excellent Wikipedia animations, was inspired to make this interactive animation:

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 20/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Fourier Toy - Click to download, requires ash

Join 450k Monthly


Readers
Enjoy the article? Keep reading to
gain an intuitive understanding of
math.
(Detailed list of control options)

The Fourier Transform is about cycles added to cycles added to cycles. Try making a "time spike"
Email by setting a amplitude of 1 for
Address
every component (press Enter after inputting each number). Fun fact: with enough terms, you can draw any shape, even Homer
Simpson. Join Newsletter!

Ptolemy and Homer (Simpson)

Check out http://www.jezzamon.com/fourier/ for a great tool to draw any shape using epicycles.

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 21/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Join 450k Monthly


Readers
Enjoy the article? Keep reading to
gain an intuitive understanding of
math.

Email Address

Join Newsletter!
Appendix: Article With R Code Samples
João Neto made a great writeup, with technical (R) code samples here:

http://www.di.fc.ul.pt/~jpn/r/fourier/fourier.html

Appendix: Using The Code


All the code and examples are open source (MIT licensed, do what you like).

Interactive example (view source)


Github gist
Reddit discussion on details of the computation, I'm pb_zeppelin

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 22/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Join 450k Monthly


Join Over 450k Monthly Readers Readers
Enjoy the article? Keep reading to
Enjoy the article? There's plenty more to help you build a lasting, intuitive understanding of math.
gain an intuitive understanding of
Join the newsletter for bonus content and the latest updates.
math.

Email Address
Email Address Join Newsletter
Join Newsletter!

Other Posts In This Series

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 23/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

403 Comments BetterExplained Discussions 


1 Login

 Recommend 11 t Tweet f Share Join 450k Monthly


Sort by Best
Readers
Join the discussion…

LOG IN WITH
Enjoy the article? Keep reading to
OR SIGN UP WITH DISQUS ?
gain an intuitive understanding of
Name math.

Lakshya • a year ago Email Address


Finally! An article which explained me in easiest words, what a Fourier Transform, what it does and how?
Thank you so much for this! Join Newsletter!
I am so impressed that I'm even gonna put my real e-mail id. Haha
2△ ▽ • Reply • Share ›

Ruth Brown • 2 months ago


This is was interesting, engaging, funny to read, and incredibly useful. Thank you very very much. I wish there were more resources as helpful
as this.
△ ▽ • Reply • Share ›

Odin • 4 months ago


I loved this! Would it be possible to use some examples where you take some of the signals [0 4 0 0] and take the full transform. I feel really
slow, but there was something on the way from making spikes to the full transform I didnt totally follow.
△ ▽ • Reply • Share ›

Luca Dorigo • 5 months ago


Kalid, this is wonderful. It would be amazing if you could expand on this (properties of the fourier transform like translation in time/frequency,
transform of derivatives, etc.) - textbooks really, really lack insight on these matters.
△ ▽ • Reply • Share ›

Joe Smith • 5 months ago


https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 24/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained
Joe Smith 5 months ago
no such thing as better or not
△ ▽ • Reply • Share ›
Join 450k Monthly
Simon Warrington • 5 months ago Readers
Brilliant explanation. Now I can help others see the magic in Fourier analysis and transforms. Thanks!!
△ ▽ • Reply • Share ›
Enjoy the article? Keep reading to
Rohin Bardhan • 6 months ago gain an intuitive understanding of
math.
Another query, does measuring the signal N no. of times always mean that there will be 0 to N-1 Hertz in the signal. And also can't there be
frequencies more than N-1 Hz in the signal measured for just N times IE. With only N time points?
△ ▽ • Reply • Share ›
Email Address
Rohin Bardhan • 6 months ago
Join
In the first equation, when I try to add the the X(subscript) n IE. The values of the signal at time n, then I do not getNewsletter!
the required cycle values IE
required Xk values. For example when I type in (5 4 2 3) in time, I get [3.5 0.79:-18.4 0 0.79: 18.4] in cycles. Why don't I get (5 + 4 + 2 + 3) in
case of zero Hertz if we just add the xn's , as in the first equation for transformation from the time domain to the frequency domain.
△ ▽ • Reply • Share ›

gawkface • 6 months ago


Whoa smoothie from recipe...
Smooth...
△ ▽ • Reply • Share ›

John Jacoby • 7 months ago


Hey like Aaron I'm also having trouble with the actual calculation of combining multiple times spikes. It's clearly not just adding together the
amplitudes and angles. I can't seem to reverse engineer what's going on when I type something like 0 3 2 into the time half of the animation.
Where did .88 and the weird decimal angles come from?
△ ▽ • Reply • Share ›

kalid Mod > John Jacoby • 7 months ago


Hi John,

Great question. We can't directly add amplitudes and angles, we need to use trig to figure out their combined effect when they're added.
https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 25/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained
q y p g , g g y

For example:
Join 450k Monthly
* Drive 3 miles at a 30 degree angle [assume 0 degrees is horizontal] * Then, drive 4 miles at a 50 degree angle.
Readers
What is your final position, the combined effect? (It's unlikely to be exactly 7 miles away, or at 80 degrees, right?)

Using trig, we can combine the horizontal and vertical coordinates: Enjoy the article? Keep reading to
x position: 3*cos(30) + 4*cos(50) = 5.169 miles horizontal gain an intuitive understanding of
y position: 3*sin(30) + 4*sin(50) = 4.564 miles vertical math.
Put back as amplitude/angle, this is:

magnitude = sqrt(5.2^2 + 4.6^2) = 6.94 miles Email Address


angle = atan(4.564/5.169) = 41.4 degrees
Join Newsletter!
Hope that helps.
1△ ▽ • Reply • Share ›

Aaron Roper • 7 months ago


I'm having trouble with the instructions under the Discovering the Full Transform section. Say I want the time signal (3 2 1 0). I divide it into each
time spike (3 0 0 0) (0 2 0 0) (0 0 1 0) (0 0 0 0). Then I divide a,b,c, and d by 4 to get (.75 0 0 0) (0 .5 0 0) (0 0 .25 0) (0 0 0 0). So then the
recipe for each time spike is (.19 .19 .19 .19) (.13 .13:-90 .13:180 .13:90) (.06 .06:180 .06 .06:180) (0 0 0 0). This is the point where I get lost.
When I type in the signal to the simulation I get [1.5 .71:-45 .5 .71:-45]. How do I go from the recipes for the time spikes to that input for the
cycles? What do you mean by loop through each frequency for the full transform?
△ ▽ • Reply • Share ›

mark r • 8 months ago


Great explanation. It really helps to have a simple model of what we are doing. Something that's bothering me is the missing negative in the
exponential for the synthesis formula. On the one hand it makes sense if you see the analysis formula as a change of basis:
X=Wx

Where W is change of basis matix. If you take the hermitian transpose of W (which is orthomormal) we can rearrange to get the synthasis
formula:
x=Hermitian(W)X.
https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 26/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

From symmetry of values in W we just to take the complex conjugate of W. Hence the difference in sign in the two formulas.

Join 450k Monthly


This doesn't fit into the idea of saying the timepoint = contributations to this time point from each frequency. Is there a simple way of explaining
the need of the negative value? Readers
△ ▽ • Reply • Share ›

Shaymaa MathStar • 9 months ago Enjoy the article? Keep reading to


How do you display your graphsthrough the site ? gain an intuitive understanding of
△ ▽ • Reply • Share › math.

threni • 10 months ago


This is all right, but many aspects are "better explained" by rooting about with a search engine. Email Address
△ ▽ • Reply • Share ›
Join Newsletter!
Hillshift > threni • 8 months ago
Sources? Care to point them out to readers and the author? Or did you just feel like being a snooty ****?
△ ▽ • Reply • Share ›

threni > Hillshift • 8 months ago


Thanks for what you take to be insult, I do believe I might just be able to take it for a slight compliment, considering the querulous
source. Yes, I believe that the issues can be better explained elsewhere. And no, I don't care to do your work for you by pointing
them out, nor that the dichotomy between pointing them out and being a snooty **** is anything but a false one.
△ ▽ • Reply • Share ›

Pulla Surya • 10 months ago


bro thanks alot this is for the first time i enjoyed by reading... it feels me more than doni last ball six in the world cup thanks alot
△ ▽ • Reply • Share ›

Asma Osama • 10 months ago


I would like to thank you for everything :)
△ ▽ • Reply • Share ›

Jacqueline • 10 months ago


https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 27/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained
Jacqueline • 10 months ago
I didn’t understand the part of the positions that cancel, I asumed position 0 is East, 1 North, 2 West and 3 South, but I’m not quite sure
△ ▽ • Reply • Share ›
Join 450k Monthly
kalid Mod > Jacqueline • 10 months ago Readers
Yes, positions across from each other cancel when added. Positions can be seen on an x,y grid:

East = (1, 0) Enjoy the article? Keep reading to


West = (-1, 0) gain an intuitive understanding of
North = (0, 1) math.
South = (0, -1)

East + West = (1, 0) + (-1, 0) = (0, 0)


1△
Email Address
▽ • Reply • Share ›

gary b • 10 months ago Join Newsletter!


well done Sir!

Respect for the time and effort required to make the difficult seem trivial
△ ▽ • Reply • Share ›

Jisan • a year ago


Hi, you can add the video of 3 blue 1 brown too. Great article, by the way......
△ ▽ • Reply • Share ›

chupo_cro • a year ago


Awesome visualization. To make it work offline 'http:' has to be added in front of '//' in the linked scripts' URLs.
△ ▽ • Reply • Share ›

whx • a year ago


Nice article,thanks a lot
△ ▽ • Reply • Share ›

PRAVIN KAPADI • a year ago

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 28/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained
I am very much impressed by the way it is explained . It is very easy to understand FT.Thanks
△ ▽ • Reply • Share ›
Join 450k Monthly
Bob Tivnan • a year ago
Readers
You sir have a gift. I have been teaching math for twenty years, and I have heard countless explanations of Fourier series. This is hands down
the most elegant and accessible explanation I have ever heard. Thank you for your contribution- it will impact my own teaching.
△ ▽ • Reply • Share › Enjoy the article? Keep reading to
gain an intuitive understanding of
Patrick Andrade • a year ago
math.
Congratulations for this explanation... It was very clear. I'd like know if you used some specific software to make that animations or if it was
made with pure javascript language..
△ ▽ • Reply • Share ›
Email Address
Kalid > Patrick Andrade • a year ago
The animation was in plain javascript (you can view source on the animation). Join Newsletter!
△ ▽ • Reply • Share ›

Shruti palan • a year ago


Does multiplying e^(2*pi*k*n/N) with X(k) to get x(n) mean we want the imaginary as in the rotational component of time signal as well, or else
x(n) can be formed by using just summation of X(k) which consists of amplitude and phase, why do we bother multiplying it with e^(2*pi*k*n/N)
factor which shows the speed with which signal is moving?
△ ▽ • Reply • Share ›

Sarfaraz • a year ago


What does the following mean:

"When our cycle is 4 units long, cycle speeds a half-cycle apart (2 units) will either be lined up (difference of 0, 4, 8…) or on opposite sides
(difference of 2, 6, 10…)."

In particular, what does "cycle speeds a half-cycle apart" even mean? That sounds like a grammatical typo!
△ ▽ • Reply • Share ›

Kalid > Sarfaraz • a year ago


It could be worded better. Speeds of 0Hz and 2Hz are 2 units apart, as are 1Hz and 3Hz.
https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 29/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained
t cou d be o ded bette Speeds o 0 a d ae u ts apa t, as a e a d3
△ ▽ • Reply • Share ›

Redu • a year ago Join 450k Monthly


How correct is it to say "A 1Hz cycle goes 1 revolution in the entire 4 seconds"..? Readers
△ ▽ • Reply • Share ›

kalid > Redu • a year ago Enjoy the article? Keep reading to
I'm using "Hz" loosely here to mean "cycle during the signal" and not "cycles per second". gain an intuitive
So here, understanding
a 1Hz component of
finishes a single
revolution over the duration of the signal. math.
△ ▽ • Reply • Share ›

Fred Mcginnis • a year ago Email Address


Many thanks for unraveling the mystery of Fourier Series.
△ ▽ • Reply • Share › Join Newsletter!

Gargamel • a year ago


Great article!
△ ▽ • Reply • Share ›

Alk • a year ago


Oooo God....... what u guys have done .....its fabulous ..amazing ..awesome....
I never enjoyed math in this way in my entire engineering college life..... We had a tough time understanding those concepts...... but you have
proved.. topics could be explained in much more interesting way .
Thanks for this ... n digging more into this site..... ;-)
△ ▽ • Reply • Share ›

Ryan • a year ago


Fantastic explanation, thanks!
△ ▽ • Reply • Share ›

Tyler • a year ago


Im interested using this method for a statistical analysis on oil production and produced water. This is my first time using the Fourier analysis
and was wondering if you could help me get started
https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 30/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained
and was wondering if you could help me get started.
△ ▽ • Reply • Share ›

Join 450k Monthly


Readers
Robert • a year ago
Hi. I am an adult electronics hobbyist.

This is an excellent simulation and explanation.


Enjoy the article? Keep reading to
Long live the applied (and theoretical) mathematicians.
gain an intuitive understanding of
I just would rather speak to... and learn from... the former ;) math.

thank you
△ ▽ • Reply • Share › Email Address

George Williams • a year ago


Join Newsletter!
So, Kalid have you ever done one of these wonderful tutorials on the subject of Convolution?
△ ▽ • Reply • Share ›

kalid > George Williams • a year ago


I'm working on a convolution tutorial, I have some rough notes here: https://aha.betterexplained...
△ ▽ • Reply • Share ›

George Williams • a year ago


Just great! I finally get it!~ Your ethical commitment to making things absolutely as simple as possible and yet sill true, is awesome. Why don't
they teach like this! All boats would be lifted. Thank you.
△ ▽ • Reply • Share ›

kalid > George Williams • a year ago


Thanks George!
△ ▽ • Reply • Share ›

swanson • a year ago


Sorry, I have read up to "Making a spike in time" several times and always get stuck. You use the term, "position," but it is not defined. Further,
no context for Modulo 4 is provided I am aware of what type of division it is but why 4 and not some other number?
https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 31/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained
no context for Modulo 4 is provided. I am aware of what type of division it is, but why 4 and not some other number?
△ ▽ • Reply • Share ›

Join 450k Monthly


Hi, check out the video just posted, it should help explain the way the time spike works. The modulo 4 Readers
kalid > swanson • a year ago
is because we have 4 data points
in that example.
△ ▽ • Reply • Share ›
Enjoy the article? Keep reading to
aling1472 • a year ago gain an intuitive understanding of
Awesome,Thanks math.
△ ▽ • Reply • Share ›

RISHI • a year ago Email Address


according to the explanation the fourier series coefficients a_n and b_n should be divided by 2...can anyone explain the formulas?
△ ▽ • Reply • Share › Join Newsletter!

Genesia S • 2 years ago


Hi! Thanks so much for the article. You made me really understand Fourier Transform, though I can see why no one believed Joe for over a
decade years ago (a line is a combination of circles say whaaat?). Haha!
*PS: Just a quick add, would make it clearer if the frequency and time domain graphs' axes were labelled. :)
△ ▽ • Reply • Share ›

Hans G. • 2 years ago


Hi, as pretty much everything else in this site, this article is great!

I do have an improvement suggestion though.


More precisely, in the section entitled "Moving The Time Spike".

In such section, you present a small table, which I ll copy below:

Time 0 1 2 3
------------
0Hz: 0 0 0 0
1Hz: 0 1 2 3
2Hz: 0 2 0 2
https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 32/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained
2Hz: 0 2 0 2
3Hz: 0 3 2 1

You mention that each cell there represents the position of the cycle at the instant. Join 450k Monthly
I couldnt quite get it. For instance, let us take the 2Hz cycle at time 1. Its position is "2"... but "2" what? Readers
Does it refer to the x-axis or to the y-axis? I find it confusing because the x-axis represents amplitude, and the y-axis represents time. Hence,
the "2" probably does not refer to any of them... Is it perhaps the phase?
Enjoy the article? Keep reading to
△ ▽ • Reply • Share ›
gain an intuitive understanding of
math.
Load more comments

Email Address
ALSO ON BETTEREXPLAINED DISCUSSIONS

Einstein’s Theory of Special Relativity (MetaLearn Podcast) Learning Math: Find The ImpliedJoin
Subject
Newsletter!
4 comments • a year ago 21 comments • 8 months ago
Anatoli — Honestly, I've got more insight from this comment rather than Richard Ruff — As always, a stimulating idea to ponder on first thing in
from the podcast itself. the day! Thanks Kalid, beautifully written, beautifully …

What does an exponent really mean? Intuition for Slope-Intercept Form


7 comments • 2 months ago 9 comments • 7 months ago
rock321987 — Hi,Is there any order in which I should read your articles? partha pratim Deb — Well done!!

✉ Subscribe d Add Disqus to your siteAdd DisqusAdd 🔒 Disqus' Privacy PolicyPrivacy PolicyPrivacy

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 33/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Join 450k Monthly


Readers

Enjoy the article? Keep reading to


gain an intuitive understanding of
math.

Email Address

Join Newsletter!

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 34/35
20/2/2019 An Interactive Guide To The Fourier Transform – BetterExplained

Join 450k Monthly


Readers

Enjoy the article? Keep reading to


gain an intuitive understanding of
math.

Email Address

Join Newsletter!

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/ 35/35

You might also like