Coding Challenge #130.1: Drawing with Fourier Transform and Epicycles

Subscribers:
1,740,000
Published on ● Video Link: https://www.youtube.com/watch?v=MY4luNgGfms



Duration: 46:09
298,016 views
5,776


In this coding challenge, I implement the Discrete Fourier Transform algorithm in JavaScript and render a drawing using epicycles derived from the transform. Code: https://thecodingtrain.com/challenges/130-drawing-with-fourier-transform-and-epicycles

p5.js Web Editor Sketches:
πŸ•ΉοΈ Fourier Transform: https://editor.p5js.org/codingtrain/sketches/RfrZibjfL
πŸ•ΉοΈ Fourier Transform - user-drawn path: https://editor.p5js.org/codingtrain/sketches/jawHqwfda
πŸ•ΉοΈ Fourier Transform - complex numbers: https://editor.p5js.org/codingtrain/sketches/ldBlISrsQ
πŸ•ΉοΈ Fourier Transform - user-drawn path with complex numbers: https://editor.p5js.org/codingtrain/sketches/sPvZsg2w4

Other Parts of this Challenge:
πŸ“Ί Part 2: https://youtu.be/n9nfTxp_APM
πŸ“Ί Part 3: https://youtu.be/7_vKzcgpfvU

πŸŽ₯ Previous video: https://youtu.be/X8bXDKqMsXE?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Next video: https://youtu.be/0j86zuqqTlQ?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
πŸš‚ Coding Train Logo: https://twitter.com/TomFevrier/status/1079437780466520065
πŸ’Ύ p5.FFT: https://p5js.org/reference/#/p5.FFT
πŸ’Ύ FFT on Algorithm Archive: https://www.algorithm-archive.org/contents/cooley_tukey/cooley_tukey.html
πŸ—„ Discrete Fourier transform on Wikipedia: https://en.wikipedia.org/wiki/Discrete_Fourier_transform
πŸ—„ Complex Number on Wikipedia: https://en.wikipedia.org/wiki/Complex_number

Videos:
πŸŽ₯ But what is the Fourier Transform? A visual introduction: https://youtu.be/spUNpyF58BY
πŸŽ₯ Fourier Analysis For The Rest Of Us: https://youtu.be/2hfoX51f6sg
πŸŽ₯ Epicycles, complex Fourier series and Homer Simpson's orbit: https://youtu.be/qS4H6PEcCCA
πŸ”΄ Code Train Live 165: https://youtu.be/0b3R8oWffkw?t=2657s

Related Coding Challenges:
πŸš‚ #125 Fourier Series: https://youtu.be/Mm2eYfj0SgA

Timestamps:
0:00 Introducing today's topic: a Fourier transform drawing machine
1:29 Fourier transform algorithm
3:08 Signal processing
5:49 Make a signal array
12:09 Euler's formula
15:34 Write the discrete Fourier transform function
21:50 What do we need for a circular epicycle?
22:47 Calculate the amplitude, frequency, and phase
26:30 Calculate amount of time to move per frame of animation
29:44 Draw an arbitrary path for both x and y
31:07 Write an epiCycles() function
34:30 Have epiCycles() return a vector with an x and y
38:59 Grab the path of the Coding Train logo
41:38 Render the epiCycles by order of amplitude
43:57 Conclusion and next steps

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

πŸš‚ Website: http://thecodingtrain.com/
πŸ‘Ύ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
🚩 Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
πŸ’‘ GitHub: https://github.com/CodingTrain
πŸ’¬ Discord: https://thecodingtrain.com/discord
πŸ’– Membership: http://youtube.com/thecodingtrain/join
πŸ›’ Store: https://standard.tv/codingtrain
πŸ–‹οΈ Twitter: https://twitter.com/thecodingtrain
πŸ“Έ Instagram: https://www.instagram.com/the.coding.train/

πŸŽ₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

πŸ”— p5.js: https://p5js.org
πŸ”— p5.js Web Editor: https://editor.p5js.org/
πŸ”— Processing: https://processing.org

πŸ“„ Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new

#fouriertransformsquarewave #discretefouriertransform #epicyclesdrawing #javascript #p5js







Tags:
computer science
programming
daniel shiffman
coding
the coding train
coding challenge
creative coding
code challenge
coding train coding challenge
javascript (programming language)
programming challenge
fourier series
fourier transform
fourier visualized
fourier series visualization
fourier series square wave
fourier transform square wave
discrete fourier transform
discrete fourier transform example
epicycles fourier series
epicycles drawing