Fourier Transform vs Fourier Series: Key Differences Explained
Fourier Series breaks down periodic signals into sums of sine and cosine waves, while the Fourier Transform converts any signal, periodic or not, into a continuous spectrum of frequencies. Fourier Series works with discrete frequency components, but Fourier Transform provides a full frequency spectrum.Quick Comparison
Here is a quick side-by-side comparison of Fourier Series and Fourier Transform based on key factors.
| Factor | Fourier Series | Fourier Transform |
|---|---|---|
| Signal Type | Periodic signals only | Any signal (periodic or aperiodic) |
| Frequency Domain | Discrete frequencies (harmonics) | Continuous frequency spectrum |
| Output | Sum of sine and cosine terms | Integral over all frequencies |
| Mathematical Form | Series (sum) | Integral transform |
| Use Case | Analyzing repeating signals | Analyzing general signals and spectra |
| Result Type | Coefficients for each harmonic | Function of frequency |
Key Differences
The Fourier Series represents a periodic signal as a sum of sine and cosine waves with discrete frequencies called harmonics. It only applies when the signal repeats exactly over a fixed interval. The output is a set of coefficients that describe how much of each harmonic frequency is present.
In contrast, the Fourier Transform works on any signal, whether it repeats or not. It transforms the signal into a continuous function of frequency, showing how much of every possible frequency exists in the signal. This transform uses an integral instead of a sum, making it suitable for aperiodic or transient signals.
In summary, Fourier Series breaks down periodic signals into discrete frequency components, while Fourier Transform provides a full frequency spectrum for all signals.
Code Comparison
This example shows how to compute the Fourier Series coefficients for a simple periodic square wave using Python.
import numpy as np import matplotlib.pyplot as plt # Define square wave parameters t = np.linspace(-np.pi, np.pi, 1000) square_wave = np.sign(np.sin(t)) # Compute first 10 Fourier Series coefficients (sine terms only for odd harmonics) N = 10 coeffs = [] for n in range(1, 2*N, 2): c = (4 / (np.pi * n)) coeffs.append(c) # Reconstruct signal from Fourier Series reconstructed = np.zeros_like(t) for i, n in enumerate(range(1, 2*N, 2)): reconstructed += coeffs[i] * np.sin(n * t) # Plot original and reconstructed plt.plot(t, square_wave, label='Original Square Wave') plt.plot(t, reconstructed, label='Fourier Series Approximation') plt.legend() plt.title('Fourier Series of Square Wave') plt.show()
Fourier Transform Equivalent
This example computes the Fourier Transform of the same square wave signal using Python's FFT and plots its magnitude spectrum.
import numpy as np import matplotlib.pyplot as plt # Define time domain T = 2 * np.pi fs = 1000 # sampling frequency t = np.linspace(-np.pi, np.pi, fs, endpoint=False) square_wave = np.sign(np.sin(t)) # Compute Fourier Transform using FFT ft = np.fft.fft(square_wave) freq = np.fft.fftfreq(len(t), d=T/fs) # Shift zero frequency component to center ft_shifted = np.fft.fftshift(ft) freq_shifted = np.fft.fftshift(freq) # Plot magnitude spectrum plt.stem(freq_shifted, np.abs(ft_shifted), use_line_collection=True) plt.title('Fourier Transform Magnitude Spectrum of Square Wave') plt.xlabel('Frequency (Hz)') plt.ylabel('Magnitude') plt.xlim(-10, 10) plt.show()
When to Use Which
Choose Fourier Series when your signal is periodic and you want to analyze or reconstruct it using discrete frequency components. It is ideal for signals that repeat exactly over time.
Choose Fourier Transform when dealing with non-periodic or transient signals, or when you need a full continuous frequency spectrum. It is the better choice for general signal analysis, filtering, and spectral estimation.