Тёмный

What is a Discrete Fourier Transform? | Week 14 | MIT 18.S191 Fall 2020 | Grant Sanderson 

The Julia Programming Language
Подписаться 83 тыс.
Просмотров 216 тыс.
50% 1

An overview with Julia of what the Discrete Fourier Transform (DFT) does, by applying it to analyze sounds, including how it is defined, along with a comparison between the runtime of a naively-
[Click "↓ ↓ ↓ Show More " for the Outline:]
implemented DFT and one using the Fast Fourier Transform (FFT) algorithm.
Course homepage: computationalthinking.mit.edu...
Pluto notebook: github.com/mitmath/18S191/blo...
0:00 Introduction
2:00 Time series data from sound recordings
2:37 Julia notebook: Playing with sound - WAV files
4:02 Drawing waveforms
5:45 Effect of frequency
6:00 Combining (superposing) different frequencies
6:45 Julia: FFT function
6:59 Discrete Fourier Transform (DFT) vs Fast Fourier Transform (FFT)
8:18 Plotting an FFT
8:58 Musical overtones: Magnitude of the FFT
12:13 Analyzing a sound file using the FFT
12:53 Defining the DFT mathematically
13:35 First term of the DFT
14:08 Visualizing the DFT in the complex plane
14:20 Equally-spaced points on unit circle in the complex plane
15:12 Idea of Fourier transform of a signal: walking around a circle
16:13 Adding complex numbers as adding vectors
17:10 Magnitude of DFT gives information about frequency
17:35 Angle of DFT gives information about phase
18:39 Interpreting the second term of the DFT
21:06 General formula for DFT
22:10 Implementing the DFT in Julia
23:01 Julia: Writing "i" as im
23:33 Julia: Array comprehension
25:35 Comparison of DFT with FFT results
26:49 Julia: isapprox for testing approximate equality
26:56 Efficiency of the implementation
28:23 Pre-computing an array of powers
28:57 Julia: Modulo (%)
29:14 Julia: OffsetArray for zero-based indexing
32:02 Computational complexity of DFT vs FFT
34:12 DFT as polynomials
Video on FFT from Reducible: • The Fast Fourier Trans...

Наука

Опубликовано:

 

31 май 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 200   
@BlackHoleForge
@BlackHoleForge 3 года назад
It was nice to put a face to the voice I've heard so many times.
@anch95
@anch95 3 года назад
Was pretty unconvincing for me when I first saw his face. The brown π is what I'll associate this voice with.
@mariasoubra7080
@mariasoubra7080 3 года назад
My mind was like: where is the animated math we used to see out there?😂
@lidiyapriyadarsinik2815
@lidiyapriyadarsinik2815 2 года назад
He kinda reminds me of that MS Word paper clip. In a sweetly inspiring way
@Titurel
@Titurel 11 месяцев назад
That’s just his avatar. He’s really a Pi figure.
@5ty717
@5ty717 5 месяцев назад
He is a modest lil thing yeah? Lol
@siddhant_yadav
@siddhant_yadav 3 года назад
He is the best mathematics teacher I have ever seen.
@octaviaraizel9240
@octaviaraizel9240 3 года назад
*Lokpati sir cries in corner*
@siddhant_yadav
@siddhant_yadav 3 года назад
@@octaviaraizel9240 I myself Suggest him to watch 3 blue 1 brown
@jakebruner2719
@jakebruner2719 3 года назад
was not expecting that major7 chord to sound so pretty
@sockpiano
@sockpiano 3 года назад
Major 7 rocks my socks.
@adityakhanna113
@adityakhanna113 3 года назад
They are niiice
@sockpiano
@sockpiano 3 года назад
@@adityakhanna113 definitely. Plus. The inversion (2nd) he's using is arguably the best!
@skeletonrowdie1768
@skeletonrowdie1768 3 года назад
the ninth always sounds so cute to me
@homomorphic
@homomorphic 3 года назад
This is literally the best tutorial on fourier transform I've ever seen.
@xzhao3888
@xzhao3888 3 года назад
How can a real human being sounds so much like a π.
@dqrksun
@dqrksun 3 года назад
XD
@redox5269
@redox5269 3 года назад
cause he's real, not necessarily rational
@EzraSingh
@EzraSingh Год назад
😂😂😂
@venkataramayya4266
@venkataramayya4266 3 года назад
I wish that this talk was available when I was doing research into the analysis of Cutting Force Signals in 1973-1976!!!
@hoaxuan7074
@hoaxuan7074 3 года назад
Weren't you all using the fast Walsh Hadamard tranform back in those days?
@rvmishra9881
@rvmishra9881 3 года назад
Man love these videos. School made me HATE physics but you made me fall in love with physics again.
@johubify
@johubify 3 года назад
Indian schools can do that to you 😂
@rvmishra9881
@rvmishra9881 3 года назад
@@johubify true enough
@forloop7713
@forloop7713 3 года назад
@@johubify or any school
@jeane0253
@jeane0253 3 года назад
This man is an educational god! He easily beats my professors in signal and system modules in Uni in terms of explaining what the whole thing is about. Magnificent
@homomorphic
@homomorphic 3 года назад
He definitely is amazingly gifted as an educator.
@mahpat
@mahpat 3 года назад
Magnificent indeed!
@truthphilic7938
@truthphilic7938 3 года назад
don't dare to associate partners with the god. Our God is one and greater than everything you can imagine.
@mustafamosavy4458
@mustafamosavy4458 Год назад
he is a great online teacher you have to use his videos in every lecture.
@mahpat
@mahpat 3 года назад
He actually explained fourier series in a way I understood it. Years of studying this in college and I had no idea what it is. Thank you so much.
@norbertn752
@norbertn752 3 года назад
Sadly I have similar experience with my university. Teachers had tendency to explain things in the most complicated way so nobody cant easily understand, which force us to learn it from different sources. For example I was interested in Introduction into SQL, expecting I will learn how to operate some specific database engine, based on SQL. But it was all about relational algebra theory, where most of the time I had no idea what they are talking about. So it was just waste of the time.
@DarthZackTheFirstI
@DarthZackTheFirstI 3 года назад
guess your professor also had no clue like his students. only memorized it from books XD
@jcbritobr
@jcbritobr 2 года назад
same here.
@jay_sensz
@jay_sensz 3 года назад
11:20 It might be important to note that you can't generally overlay multiple FFTs like that and have the frequencies align nicely. This only works if your input signals are all the same length (and sampling rate) because the frequency domain spacing is inversely proportional to the length of the time series.
@basavasagarkpatil8973
@basavasagarkpatil8973 3 года назад
Being an electronics and communication student, I have to say your videos gave me an insight of communication systems and signal processing and helped me immensely
@scorpio19771111
@scorpio19771111 2 года назад
Redundancy is good for slower learners like me. Thank you for making the extra effort.
@giridharsd1272
@giridharsd1272 3 года назад
Just love the way you explain mathematics. ❤
@AshishSingh-753
@AshishSingh-753 3 года назад
His voice gives me relief
@a-mann
@a-mann 3 года назад
Two things: 1. This is one of the best videos to give you a natural intuition of the DFT that I have ever come across. I wish I saw this back in university. Thank you so much. 2. The fact that you are using Figma to illustrate some equations and concepts is amazing.
@brockobama257
@brockobama257 3 года назад
Grant, no one creates quality videos of complex mathematical concepts better than you. I can’t thank you enough.
@zackglenn2847
@zackglenn2847 3 года назад
Very nice video. One of the interesting things about Fourier analysis is that there are so many different ways of approaching it, so even after getting intimately familiar with this field I still enjoy new takes on these basic concepts.
@peetiegonzalez1845
@peetiegonzalez1845 3 года назад
I had questions on Reducible's channel about the link between FFT and frequency domain because I was confused about the relationship between his polynomial example and the frequency values. Having now watched your video I got my answer. So great to see new channels explaining difficult concepts clearly, and especially using manim.
@myboigetflick372
@myboigetflick372 3 года назад
This will help a lot for my Fourier Series and PDE's final exam I have this week! Thank you!
@alfredo1valenzuela
@alfredo1valenzuela 3 года назад
Oh, my God. You can see in his face what exceptional parents this person had. It's beautiful.
@chenmarkson7413
@chenmarkson7413 3 года назад
19:55 this point is where I finally understand everything. Perfect explanation!!!!!!
@RD2564
@RD2564 5 месяцев назад
Dog, this video really didn't get going until you started using the "Grant engine" at 12:57 to explain how all the terms in the sample combine to tranform into the frequency domain representation. That walk around the complex plain was very helpful for me and I handn't see DFT described like that before, very nice. This all means the first 13 minutes where a lot of introductory overhead and in some sense it makes sense to me to put that "example" stuff at the back but that is obviously just one man's opinion.
@gansogames4927
@gansogames4927 Год назад
Blown away by the quality of your videos. Also blown away that you pronounce them as wahv files🤯
@lobais
@lobais 3 года назад
@Grant Sanderson, when you do a lecture like this, do you script it, or is some of it improvised?
@TheCloud553
@TheCloud553 3 года назад
Amazing as always Mr. Grant :D
@akmzahidulislam2764
@akmzahidulislam2764 3 года назад
What an educator you are! Long live Grant
@pentachronic
@pentachronic 3 года назад
Beautifully explained. Thanks.
@moulin3818
@moulin3818 3 года назад
Wow this is the crossover I haven't seen it coming!
@freghidelgrifo
@freghidelgrifo 2 года назад
Thank you so much, most clearly tutorial on the web!
@lilapela
@lilapela 3 года назад
until 1:46 I thought he was reading from a script lol. Grant is so well spoken and has an impressive way with words
@alan2here
@alan2here 3 года назад
3b1b grant? :)
@plekkchand
@plekkchand 4 месяца назад
Why?? it's perfectly normal/average...
@gumpiball5911
@gumpiball5911 3 года назад
i will never not imagine grant humming at my sample when taking an NMR spectrum from now on
@jcbritobr
@jcbritobr 2 года назад
Thats incredible stuff. Amazing.
@kenbeta9376
@kenbeta9376 2 года назад
Great man with nice soft heart
@bipeenj
@bipeenj 11 месяцев назад
Thanks for doing these videos appreciated ! I would like to see video on Quantum fourier transform as well because you have a gift of explaining things nicely.
@nafrost2787
@nafrost2787 2 года назад
I wanted to ask. Regarding the examples you gave at around 17:00 when you explained how we can use the DFT to decompose the signal into waves. In those examples, the signal may look like a wave when you put all the values next to each other. But it isn't really a wave isn't it? If the signal was a wave, then shouldn't its magnitude be constant in all its points, and its phase change between different points, which is exactly the opposite of what happened in the examples?
@journeytotheinfinity440
@journeytotheinfinity440 3 года назад
Eagerly waiting for your video..
@ifnspifn
@ifnspifn 3 года назад
Great video! I had a question though. I was watching the Reducible video on polynomial multiplication, and it struck me as somehow very odd that the DFT/FFT had anything to do with polynomials at all. After all, the FFT of a series of values gives us some description of the frequency domain of a function, but for polynomial multiplication, we’re running it on *coefficients* of something decidedly non-frequency related, and it’s returning the *values* of that function. Do you have a feel for the intuition of why it applies to polynomials at all? Or put another way, is there an intuitive relationship between polynomial coefficients and the coefficients of a fourier series?
@Pietro-qz5tm
@Pietro-qz5tm 3 года назад
Mathematically polynomials are just the sequences with value 0 from one index onwards; "finite sequences of coefficients" could also be a way to understand them. But the notation as polynomials (with "powers" of a symbol called "variable") is very useful since (pointwise) sum and (convolution) product are easily defined in term of summing coefficients of variables with the same exponent and distributive property. The evaluation morphisms are also pretty immediate: substitute the variable with the value and simplify.
@Pietro-qz5tm
@Pietro-qz5tm 3 года назад
So polynomials are just a very useful formalism to work with finite sequences, like signal samples.
@gdclemo
@gdclemo 3 года назад
This is a very good explanation of Fourier transforms! Thank you. I have one complaint though, which is that the audio of the samples is much lower than your speech and I can hardly hear them. They really need to be louder than they are.
@pauljohnson6377
@pauljohnson6377 3 года назад
Would it be possible to teach or learn Fourier series, convolution, and characteristic functions (of probability distributions), not in terms of signal/time domain analysis, but of just a pure probability and the corresponding density function? I bring this up, as early in my student career I shrugged off Fourier series and transforms as I wasn't interested in wave analysis, not realizing it's applicability far beyond signal processing but now seeing it comes up in heat transfer, particle diffusion, AND PROBABILITY THEORY ITSELF. I have a hard time not thinking of the Fourier transforms, NOT in terms of frequency analysis, but there is a clear base importance in the way moment generating functions are written because of the Fourier transform.
@Yasharvl
@Yasharvl 2 года назад
Grant Sanderson on Julia Programming channel, there's still hope for 21th century!
@nathanjaroszynski6210
@nathanjaroszynski6210 Год назад
Thank you it's an amazing lecture.
@APaleDot
@APaleDot 3 года назад
Yooooo, I just watched that FFT video by Reducible not too long ago. It's so good.
@ravitheja012345
@ravitheja012345 Год назад
Man your "3Blue1Brown" channel is amazing
@vishalchovatiya1361
@vishalchovatiya1361 Год назад
Excellent, Thanks
@ignaciocordova1325
@ignaciocordova1325 3 года назад
Thanks for the video! What is the mic you use?
@miro.s
@miro.s 3 года назад
26:19 It would be safer to count maximum difference than mean value, because we work with large datasets and mean value is hiding peak differences. Maxima norm is more handful for more precise comparing while working with big data. Anyway, to understand that from different perspective, maxima norm works like boundary operator ∂ or derivative revealing globally peak points, vertices or so called extremes and on the other hand, avereging is its inverse dual operation that is integrating = hiding irregularities.
@abdelmajidfathi1481
@abdelmajidfathi1481 3 года назад
This can be demonstrated by taking the FFT of an arbitrary signal, and then running the frequency spectrum through an Inverse FFT. This reconstructs the original time domain signal, except for the addition of round-off noise from the calculations. A single number characterizing this noise can be obtained by calculating the standard deviation of the difference between the two signals. For comparison, this same procedure can be repeated using a DFT calculated by correlation, and a corresponding inverse DFT.
@ayuminor
@ayuminor 3 года назад
I tried the same thing in python but packing the values for zeta into an array only halved my computation times and it seemed to scale proportionally with more samples.
@JanVincentLatzko
@JanVincentLatzko 3 года назад
Thank you Grant for your lectures and homework. It was inspiring to watch you and your calm reaction to hiccups teaches me every day ;D
@skeletonrowdie1768
@skeletonrowdie1768 3 года назад
wow that autodocumentation is awesome
@guyfromkerala3577
@guyfromkerala3577 3 года назад
What is the name of that type of frame he wears?
@ronakparikh
@ronakparikh 3 года назад
This is so much better than my linear systems and signals teacher
@divinefem419
@divinefem419 3 года назад
I like his vibe 🥰
@Andrew90046zero
@Andrew90046zero 3 года назад
A mere length of 90 thousand! Also I love this, helps me so I can code my own transform function
@area51xi
@area51xi 2 года назад
But why does the first data point not walk around the circle at all. This keeps bothering me.
@sanjaux
@sanjaux 7 месяцев назад
28:39 is this a form of memoization? I'm super new to all of this but that's what the pattern seemed like to me at first glance!
@thetommantom
@thetommantom 3 года назад
I once saw a picture coded into a frequency described with an algebra equation and thought if data was coded like that information density and data transfer would be off the charts
@poohshmoo9892
@poohshmoo9892 Год назад
Reducible ... yes, quite well explained , credit is due there
@venkataramayya4266
@venkataramayya4266 3 года назад
Can you come up with an overview of multi-spectral signal/data analysis similar to that can be done by the BMD Package!!!
@LydellAaron
@LydellAaron 3 года назад
Good example of superposition
@hoaxuan7074
@hoaxuan7074 3 года назад
You can view the FFT as a bunch of dot products and sometimes that's all you want out of it. If so you might want to stop it taking a spectrum by applying a fixed random pattern of sign flips to the input data. That is quite quick however for hardware implementation it stiil needs a lot of transistor hungry multiply operations. An option is to use the fast Walsh Hadamard transform where the cost per dot product is log2(n). For a dot product of just over a million terms the cost is 20 add subtracts🤗
@Jaan2103
@Jaan2103 3 года назад
very cool and nicely explained! What is the notebook or program you are using? I already thought about switching to the Julia language
@Jaan2103
@Jaan2103 3 года назад
Found it, it is Pluto.jl
@Dhanush-zj7mf
@Dhanush-zj7mf 3 года назад
will the fourier transform work when the function is non periodic
@AbhikalpUnakal
@AbhikalpUnakal 2 года назад
What DAW is he using to record ?
@solutionstate
@solutionstate 3 года назад
Great lesson! can you share the source code/notebook please?
@MinecraftingMahem
@MinecraftingMahem Год назад
Correct me if I'm wrong but this seems to be the same thing you did for the counting of subsets of [1,2,...,2000] that add up to 5. I think you used the roots of unity and generating functions there to select the correct subset amounts. Seems roots of unity are used here to pull out info on the frequencies. Seems kind of similar technique.
@damnguen1726
@damnguen1726 3 года назад
love you man
@alan2here
@alan2here 3 года назад
Some of the content is not like the others. :) It's a secret that makes being subscribed soo worth it. :) Branch off to your own channel!
@ioannisgkan8930
@ioannisgkan8930 2 года назад
This lecture was quite amazing understanding fft through visualisation Great job
@gheffz
@gheffz 3 года назад
Thank you. _By the way, nice easy listening voice!_
@nolanzurek
@nolanzurek 3 года назад
what DAW was he using?
@saketsingh6804
@saketsingh6804 3 года назад
3Blue1Brown is one of the reason that made me interested in math and physics.
@tehpostman7
@tehpostman7 3 года назад
Did he choose the letter "s" for array of numbers on purpose?
@Dhanush-zj7mf
@Dhanush-zj7mf 3 года назад
can we get access to the source code....
@TheAziz1004
@TheAziz1004 3 года назад
Please add LaPlace transformation too. Thank you
@Sky-pg6xy
@Sky-pg6xy 2 года назад
Its Grant!!!
@zskater1234
@zskater1234 3 года назад
Where is he running this Julia code? Looks like jupyter, but I believe it isn't. Could someone tell me?
@IulianVasileCioarca
@IulianVasileCioarca 3 года назад
Check out Pluto.jl. It's a reactive notebook.
@namlehai2737
@namlehai2737 3 года назад
waiting for FFT!
@sockpiano
@sockpiano 3 года назад
I'm curious. Is the zeta term he's using here (e^(-2iPi/N)) not equal to the Nth root of 1? I'm no mathematician. My thinking is: e^(-2iPi/N) = Nth root (1/(e^iPi)²). Not sure the relevance of this, and any help is appreciated.
@erikberg7891
@erikberg7891 3 года назад
Yes, zeta is the Nth complex root of 1 with the smallest (closest to zero) negative phase angle. Note that zeta^2 is also an Nth root of 1, as are zeta^3, ... , and zeta^(N-1).
@sockpiano
@sockpiano 3 года назад
@@erikberg7891 thank you!
@chiyuzhang3089
@chiyuzhang3089 7 месяцев назад
Epic!
@teinili
@teinili 2 года назад
Seeing him make those little mistakes while coding makes me very happy :D
@chhayakankariya2748
@chhayakankariya2748 Год назад
How to get such auto- documentation on side??anyone know?? Btw Thank you 3b1b for great explanation you are awesome😎😎
@reilbenedictobinque9650
@reilbenedictobinque9650 2 года назад
Your hair is gorgeous
@bopaliyaharshal2399
@bopaliyaharshal2399 3 года назад
Love u🙏🙏🙏
@ingmardamato9170
@ingmardamato9170 3 года назад
So ideally we could swap to QUantumFT instead of the FFT to speed up computation?
@ACLindustrial
@ACLindustrial Год назад
Are you the guy of 3Blue1Brown? I love that videos. Excellent explanation!. Thanks so much.
@javrancheng9917
@javrancheng9917 3 года назад
just want to raise a point that FFT is not just more efficient, but more accurate - a naive implementation performs more floating point operations, which means inaccuracy builds up more quickly.
@zuhairmehdee
@zuhairmehdee 3 года назад
So wait, fourier transforms are important for making convolutions fast and convolutions are important for making fourier transforms fast? Huh.
@hetsmiecht1029
@hetsmiecht1029 3 года назад
That sounds... Convoluted
@zuhairmehdee
@zuhairmehdee 3 года назад
@@hetsmiecht1029 Ayy I laughed at that
@AiryDiscus
@AiryDiscus 3 года назад
You can write a DFT that is as fast as mkl FFT for N
@ozgunozerk334
@ozgunozerk334 Год назад
I still do not get why: decomposing waves (turning the time-domain base into frequency-domain base) is the SAME as computing the evaluation form from the coefficient form? Ok, the math and equations hold (of course), but what is the intuition behind those two are the same thing from the aspect of the Fourier Transform...
@poweredbysergey
@poweredbysergey 3 года назад
Cool!
@jackmcgaughey4388
@jackmcgaughey4388 3 года назад
What if there are changes in frequency over time? Like in human speech
@IulianVasileCioarca
@IulianVasileCioarca 3 года назад
You run short time fft on windows of 20ms. It's considered that over such a small interval the signal is stationary, meaningg spectral components are time invariant.
@michael.forkert
@michael.forkert 3 года назад
What’s that good for?
@victorcalderon8496
@victorcalderon8496 3 года назад
I didn't know Tom Misch was making math classes
@beauxq
@beauxq 3 года назад
When you play the sound for which the transform showed the fundamental and most prominent frequency around 200, I thought: Why do I hear something closer to 100 Hz? Then I thought about how you explained the DFT algorithm. It looks at divisions of the original length, kind of assuming that the original length is 1 unit of time. But the original sound files are not only 1 second long. They are closer to 2 seconds. That's why the DFT reports a frequency of 200 when the sound wave frequency is around 100 Hz. So if you want to translate the output of DFT to Hz, you have to consider the sample rate and length of the data.
@beauxq
@beauxq 3 года назад
That sound file is 1.8923541666666666666666666... seconds.
@karanabraham7906
@karanabraham7906 Год назад
It's so weird seeing his him talk after only listening to his voice for in other videos😂
@tiago.engenheiro
@tiago.engenheiro Год назад
Is Julia worth learning? honest question
@RAJIBLOCHANDAS
@RAJIBLOCHANDAS 2 года назад
Good
@Chrls5
@Chrls5 3 года назад
Broooo brooooo brooooo brooooooo, this sounds like the solution I was looking for to compress my FFT algorithm for my little microcontroller, Broooooo!!!!! Thank youu!!!!!
@aayushbajaj2260
@aayushbajaj2260 11 месяцев назад
damn, this guy can code
Далее
But what is a convolution?
23:01
Просмотров 2,5 млн
The Worlds Most Powerfull Batteries !
00:48
Просмотров 7 млн
Coding Challenge 125: Fourier Series
28:47
Просмотров 581 тыс.
The imaginary number i and the Fourier Transform
17:27
26. Complex Matrices; Fast Fourier Transform
47:52
Просмотров 266 тыс.
The Discrete Fourier Transform (DFT)
17:36
Просмотров 327 тыс.
🤔Почему Samsung ПОМОГАЕТ Apple?
0:48
Просмотров 456 тыс.
Полезные программы для Windows
0:56
ПК с Авито за 3000р
0:58
Просмотров 1,4 млн