An Interactive Guide To The Fourier Transform

Hi Ravi, good question. We need to make measurements quickly enough to capture the fastest-moving signal. Start off with a 0Hz signal, which is constant.

How many measurements do you need? Just 1. Measuring at the beginning will give enough information since it’s a constant value.

Now, how about a cycle which repeats once during the signal? (The 1Hz component). We need to measure at the beginning (t=0) and halfway through (t=1/2). Why halfway?

First, we want our samples to be evenly spaced, but also, we need two measurements to describe the behavior of that 1Hz cycle. Having a single data point at t=0 doesn’t let us fit a curve to it, we need two points to “lock in” the cycle (many different 1Hz cycles can have the same value at t=0, but have different phase offsets).

A 2Hz cycle is similar: it repeats twice during the interval. We get the starting point (t=0) and two other data points (t=1/3 and t=2/3) to lock in the phase cycle of this 2Hz signal. Eventualy I’d like to do a follow-up to explain this more, but the main idea is if you have a fast-moving signal, you need more data points to catch (and describe) its behavior.

very very appetising

very very appetizing

" The yellow dots are when we actually measure the signal. With 3 cycles defined (0Hz, 1Hz, 2Hz), each dot is 1/3 of the way through the signal. " – Why is the signal measured only 1/3 of the way ? Why not at any other points ?

Thanks a lot ! I never understood the fourier before. You really made this topic easy and fun.

Wonderful site! I will be spending more time here.
I appreciate both your use of simple analogies and your disclaimer as to their limitations; I like your raft and river comparison for how far an analogy can take you.

I recently came across a curious discussion of how Fourier transforms may be used in quantum physics to explain how a particle like an electron can appear to be both particle and wave together. I had some trouble visualizing some of the descriptions but this site with the interactive animations pulled it all together quite well for me. Visually seeing how a ‘time pulse’ can be generated from the summation of all possible wave functions helped me visualize there are two equivalent ways to describe the electron:
a) summation of all applicable quantum waveforms derived from an infinite series of Feynman diagrams
b) a ‘chunk’ of probability that appears localized in time and space (particle) but tapers off to nill at greater distances (wave)

To those who doubt the usefulness and need for analogy, I leave you with the words of Erwin Schrodinger:
“If you can not, in the long run, explain what you have been doing, your doing has been worthless.”

Thanks Eric, really appreciate the comment.

Wow, that’s a great analogy with with electron, it’s a way to see how both a probability waveform (Fourier cycle components) and a particle (time spike) can describe the same phenomena – awesome!

Great Schrodinger quote too, if our understanding dies with us, what’s the point?

Hi Kaild,

Firstly, congratulations on a well written article. I love the idea behind the site. If I understand you correctly any signal is a series of time spikes, whose frequencies are phase shifted to produce constructive interference at each spike.
However, I tried computing the signal (4,4,0,0) using the method you describe in the full analysis section and my 1hz term gave me an amplitude of 2 (and not 1.41 as given by the graph) ie, 1hz=4/4:0 4/4:-90 0/4:180 0/4:90 = 2:180.
I’m obviously missing something here (and godamit I thought I had it!)

Kind regards. B

Just to add up to my question.
Is the signal coming to microphone (the magic devices I though about in my question) already a sum of all signals within the frequency range of the microphone? In other words is the sound coming to mic the total of all frequencies that could be constructed via FT if we would know every frequency value?

This is great explanation for those who struggle with math and want to click without being a math guru. The part I struggle the most with is seeing a sound as a whole in the time domain, sampling it and applying the ft. Let’s say the word “hello” is sent over the air and each letter corresponds to specific frequency , amplitude and phase: (made up example)
H - 5hz
E - 28hz
L - 100hz
L - 100hz
O - 330hz
Assumption is that the word hello lasts exactly 1second.
How does this word looks in the time domain graph? Would we have to divide whole 1second into every hz value and spread out accordingly? For example 1/5 , 1/28 , etc.
If above is true the next step would be to sample the time domain?
Let’s say we sample at 600hz?
What does the sample contain? Does it contain every amplitude from every frequency at sampling time or it’s value is the result of then FT? What is the sensor device that can sense all those different frequency to allow sampling, ft and so on. How this device knows the difference between 10hz and let’s say 13000hz?
I understand that ft converts all signals into one but above drives my brain crazy.

Thanks Eric for the thoughtful comments (as always!)

@Billy: Great question. When combining the spikes for (4, 0, 0, 0) and (0, 4, 0, 0) we need to take the phase shifts into account.

The first spike is at t=0 and has components without any phase: 1, 1, 1, 1.

The second spike occurs at t=1 and needs to adjust its components to: 1, 1:-90, 1:-180, 1:-270

What happens when we combine the ingredients?

The terms that are perfectly in phase (aligned) can just be added, so the 0Hz component becomes 2:

2 x x x

But how about the 1Hz component? In the first spike it has phase of 0, in the second spike it has a phase of -90. This is like going 1 mile East (0 degrees) then 1 mile South (-90). The result is going sqrt(1^2 + 1^2) = sqrt(2) = 1.41 at a SouthEast direction (-45 degrees).

So, we get

2 1.41:-45 x x

The other terms can be worked out similarly. Great question and something I’d like to clarify: the cycle ingredients can be “out of sync” (due to their phase) and may not combine simply. They can even cancel when fully out of phase (1:-90 and 1:+90 will cancel out and give nothing, like going 1 mile North then 1 mile South).

Really wonderful site!! I recently bumped into the site and read few articles. Each one gave me Aha moment. Thank you for that.
Fourier transform is well explained , but I have question about -ve sign in front of ‘i’ in forward transform. From your article on imaginary number I learned that negative ‘i’ is clock wise rotation . In animation we see all circles going CCW which is natural for increasing degrees , but ‘i’ is negative. Why?
Also why ‘i’ is positive for reverse transform

@Pradeep Maskeri
Good observation and question. You’re putting some concepts together well to notice the negative power of i and think it should be a CW rotation.
Let me see of I can fill in some of the details.
The Fourier Transform (FT) is not exactly a rotational transform in the way you are thinking. Instead the FT takes one thing that can have an associated idea of rotation, and transforms it to another thing that can also have an associated idea of rotation. The FT does not take one complex number and transform it to give one complex number that has been rotated, instead it takes one method of representing a complicated bunch of stuff and transforms it to give a different description of the same stuff. The forward and reverse transform then are not forward and reverse rotations of a complex number, but rather the following:

  • forward, start with a bunch of basic things (sin and cos) turn them into one complicated thing (composite waveform of arbitrary shape)
  • reverse, start with one complicated thing and turn it into a bunch of simple things.

Hope this helps.
Eric V

@Bart
Your second question points toward the answer to some of the missteps in the first question.
Please don’t be offended by use use of the word ‘missteps’. I’ve made them a plenty and will make more. In the physical sciences it is a beautiful thing to make missteps and wrong guesses, greater still to voice them and ask questions. It demonstrates growth.

I can answer your question by telling you a thing that I claim is true. I only warn you ahead of time that it’s kind of a lie. Imagine the chagrin of the poor souls who came up with the corpuscular theory of light (http://en.wikipedia.org/wiki/Corpuscular_theory_of_light)
only to learn it’s all wrong, light is a wave not a particle. Then along comes quantum physics and tells us it is a particle, absolutely it’s a particle. We know this because the equations that govern it are, well, wave equations… but I digress.

Here is the great lie I have to tell you that, for now, is “true”.
You are right, the sound arriving at the microphone is already the sum of all frequencies. What arrives at the microphone is just a single pressure wave with a complicated shape, not a whole bunch of sin and cos waves. The Fourier Transform (FT) just lets us look at it as if it were a bunch of sin and cos waves. Then we can perform some tricky math with it. We can send it through a computer and do all sorts of jazzy things like take an old Parlophone mono recording of a concert with a rude telephone ringing in the background and remove just that sound. I saw a recording engineer at Abbey Roads studio do this with some pretty fancy software, blew my mind!
You also start asking, “What is the sensor device that can sense all those different frequency to allow sampling”? For a lovely game of chasing rabbits down holes, go ahead and see what Wikipedia has to say about the Nyquist Sampling Theorem. It’s good fun and a lovely headache. Let me see if I can shorten it. Lets say you have the setup you’ve provided, a human voice saying the word hello, and that sound hits a microphone. We want to record it to play back later, but we want to record it digitally! Start with what the mic gives us, an electric voltage wave that has the same complicated shape as the pressure wave that hit the mic. Take a ‘sample’ to see how strong the voltage is every so often. The strength will just get converted to a number (this is a binary number that can be stored digitally). As the voltage varies from -100% to +100% the digital number that comes out of our ADC (analog to digital converter) is a number between 0 and 256 (for 8 bit encoding). But how often is ‘every so often’? By the Nyquist Theorem, twice for each cycle of the highest frequency we want to represent. Humans have a tough time hearing any sound at a frequency higher than 20K Hz (repeats every 0.05ms). So you take 2 samples every 0.05ms. Each sample is an 8 bit number. Store it as a file. To play it back; read the first 8 bits, convert it in a DAC (3 guesses what DAC stands for) to a voltage between -2V and +2V, send it to an amp then speakers, repeat for each subsequent group of 8 bits. I left out a detail or two. This lets you faithfully record a sound up to 20kHz. If a higher frequency sound hit the mic our sampling would have missed it.

As for my ‘true’ lie… the Fourier Transform isn’t just about sound. It can be about anything that is represented as a wave (like a quantum wave function for an electron, or an atom, or a cat, or the universe). It lets us take a ‘thing’ that we want to look at and express it in one of 2 ways:
-single waveform complicated shape
-many waveforms simple shape
From the standpoint of sound wave we like to think the ‘real’ thing is the single complicated waveform. The other mess of an infinite number of basic shaped sin and cos waves are not really ‘real’ they are just a convenient mathematic way to treat the object. If the wave is the quantum waveform of a photon we may like to view it the same way. The photon is a ‘real’ object. The ‘real’ part is the single quantum waveform, or is it? However, the single waveform can have a position operator applied to it, to ask the question “where are you, oh little photon?”. Likewise it can have a momentum operator performed on it to ask the question “how fast are you going?” Werner Heisenberg discovered an interesting relationship between those two tasks. Yes it was math alone that caused him to propose his Uncertainty Principle. In this case the sum of all the ‘little’ equations (where, when, how fast, how much charge, how much mass, etc.) may seem to be more real than just the composite wave function, which really is just a probability cloud of nothingness.

The Fourier Transform just gives us a way to go back and forth between the parts, and the composite. Its up to us to decide which version we want to work with.

[…] 原文来源:betterexplained.com […]

[…] 原文来源:betterexplained.com […]

Hello everyone,i am doing my project in image processing… i have done video segmentation using the Fourier transform . I applied 3-D fft on video (gray image(2D)+no of video frames(1D)=3D) and Obtained magnitude and phase spectrum and reconstructed video frames back from the phase spectrum only . i am doing coding part using Matlab software

I have found that moving part pixel intensity values becomes dominant (means its intensity values are increased so much) compared to stationary part intensities in reconstructed frames of original frames .(e.g.in waterfall and traffic on road, water part and moving car’s intensity values are increased respectively compared to the stationary background). i want to know how did this happen?

Hi AR, thanks for the comment!

My primary learning philosophy is “blurry to sharp” (successive refinement) instead of “full detail, top-to-bottom” (walk through the formal definition, even slowly). My blurry version of the Fourier Transform is that it uses filters to break a whole into parts, much like a smoothie can be separated into constituent ingredients (there’s likely many analogies, but I like smoothies).

To get technical, sure, we’ve projected a function onto an infinite set of orthogonal basis functions defined by e^ix – but to me that’s the mechanism, not the goal. The goal was to filter a signal into parts for easy analysis, which can be done via an integral, or perhaps mechanically (our ear essentially runs a mechanical Fourier Transform on the incoming sound waves, and as a result we can hear several sounds simultaneously), and so on. It’s a bit like describing a car as a “horseless carriage” (what it looks like) or an “auto-mobile” (how it behaves – it moves itself) or a “vehicle driven by an internal combustion engine”. The latter is the most specific, but not likely to be the most approachable or helpful to a newcomer.

When learning a topic, I need to understand what it does / why it does it, before the how. From there, I can appreciate both the abstractions and subsequent implementation details. When writing, I basically write for myself – what do I wish I had heard up front? One of the trickiest things when explaining is avoiding the Curse of Knowledge and remembering what it’s like before the concept clicked. After it clicked, hearing “project onto orthogonal basis” is a nice reminder, but before it clicks, it would (for me) have been dutifully accepted but not really internalized. (“Sure, ok, we can hypothetically project a function onto other functions. But do I feel what’s going on? Not really.”) That said, everyone’s goals are different. Appreciate the feedback!

Stumbled on to better explained last night. Really enjoying it.

My ah ha moment with Fourier is when I looked at the trig identities and realised that two sinusoids multiplied together resulted in another sinusoid centered on the x axis, unless they were the same frequency, in which case the result would be all above the x-axis, (basic orthogonality). This meant that if I summed the product I would always get zero, unless I had the ‘key’ frequency then I would get a value. So Fourier decomposition was just repeatedly multiplying a signal by different sinusoids, ‘secret keys’, to ‘extract’ out its contribution.

is there anybody to answer my question given in post no.176???