In this example, we first define a signal as a sum of two sine waves. We then perform the Fourier transformation using the np.fft.fft function, and calculate the corresponding frequencies using the np.fft.fftfreq function. Finally, we plot the original signal and the Fourier transform using Matplotlib.
Note that the Fourier transform outputs a complex valued result, so we take the absolute value of the result when plotting it. Also, the frequencies returned by np.fft.fftfreq are in units of cycles per sample, so we need to multiply them by the length of the signal to get the actual frequencies.
Thanks for watching. For more videos and to support us, you can subscribe and follow our channel. Good luck...
All Coder & Maker videos : • ALL VIDEOS
More Python Specials videos: • Python Specials
More Python Examples videos: / playlist
list=PLN6LC3AB64ggeDF1_fR-77gdlNrtz-8VQ
Python Basics Videos : • Python Basics
Python Turtle Graphics Module: • Python Turtle Graphics
Python Matplotlib Module Tutorials: • Python Matplotlib Module
Python Numpy Module Tutorials: • Python Numpy Module
Python Random Module Tutorials: • Python Random Module
Python Thonny Graphics Tutorials: • Python Turtle Tutorials
Download Thonny Ide: https://thonny.org