What is Fourier Transform: Simple Explanation and Example
Fourier Transform is a mathematical tool that breaks down a signal into its basic frequencies. It converts a time-based signal into a frequency-based signal, showing what frequencies are present and their strengths.How It Works
Imagine you hear a song and want to know which musical notes are playing. The Fourier Transform acts like a musical ear that listens to the whole song and tells you the individual notes and how loud each one is. Instead of sound, it works on any signal that changes over time, like electrical signals or stock prices.
It does this by comparing the signal to many simple waves (sine and cosine waves) of different frequencies. The result is a new signal that shows how much of each frequency is inside the original signal. This helps us understand the hidden patterns and rhythms.
Example
This example uses Python to apply the Fourier Transform to a simple signal made of two sine waves with different frequencies. It shows how the transform reveals these frequencies.
import numpy as np import matplotlib.pyplot as plt # Create a time array from 0 to 1 second, 500 points fs = 500 # Sampling frequency T = 1/fs # Sampling interval x = np.linspace(0, 1, fs, endpoint=False) # Create a signal with two frequencies: 5 Hz and 20 Hz signal = 0.7 * np.sin(2 * np.pi * 5 * x) + 0.3 * np.sin(2 * np.pi * 20 * x) # Compute the Fourier Transform ft = np.fft.fft(signal) # Compute frequencies corresponding to the FT freq = np.fft.fftfreq(len(signal), T) # Take only the positive half of frequencies and FT pos_mask = freq >= 0 freq = freq[pos_mask] ft = ft[pos_mask] # Plot the magnitude of the Fourier Transform plt.plot(freq, np.abs(ft)) plt.title('Fourier Transform Magnitude') plt.xlabel('Frequency (Hz)') plt.ylabel('Magnitude') plt.grid(True) plt.show()
When to Use
Use the Fourier Transform when you want to find out what frequencies make up a signal. This is useful in many areas:
- Audio processing: to analyze music or speech
- Image processing: to filter or compress images
- Communications: to understand signals sent over networks
- Medical imaging: like MRI scans
- Engineering: to detect vibrations or faults in machines
It helps turn complex signals into simpler parts that are easier to study and manipulate.
Key Points
- The Fourier Transform converts a time signal into frequencies.
- It reveals hidden patterns in data.
- It is widely used in science and engineering.
- Computers use a fast version called FFT for quick calculations.