Search⌘ K
AI Features

Calculate the Frequency of a Sine Wave

Explore how to calculate the frequency of a sine wave by applying the Discrete Fourier Transform and Fast Fourier Transform using Python. Understand how to process audio signals, convert complex FFT results to real values with NumPy, and identify dominant frequencies. This lesson equips you with practical skills to analyze and plot frequency data for scientific and engineering applications.

Using the DFT to get frequencies

To get the frequency of a sine wave, we need to get the Discrete Fourier Transform (DFT). We don’t need to understand how to derive the DFT, we just need to know how to use it.

In its simplest terms, the DFT takes a signal and calculates which frequencies are present in it. In more technical terms, the DFT converts a time-domain signal to a frequency domain.

What does that mean? Let’s look at our sine wave from the previous lesson.

The wave is changing with time. If this was an audio file, we could imagine the player moving right as ...