Nyquist Frequency: Definition, Example, and Use Cases
Nyquist frequency is half of the sampling rate of a signal and represents the highest frequency that can be accurately captured without distortion. Sampling a signal above this frequency prevents aliasing, which is when higher frequencies appear as lower ones in digital data.How It Works
Imagine you are taking photos of a spinning fan. If you take pictures too slowly, the fan blades might look like they are moving backward or standing still. This happens because your camera's frame rate is too low to capture the true speed of the blades. In signal processing, the Nyquist frequency is like the minimum frame rate needed to capture the true details of a signal without confusion.
The Nyquist frequency is exactly half of the sampling rate, which is how often you measure the signal per second. If you sample a signal at 1000 times per second, the Nyquist frequency is 500 Hz. Frequencies higher than this will be misrepresented, causing a problem called aliasing, where high frequencies appear as false lower frequencies.
Example
This example shows how sampling a signal below and above the Nyquist frequency affects the captured data.
import numpy as np import matplotlib.pyplot as plt # Original signal frequency freq = 50 # 50 Hz # Sampling rates fs_high = 200 # 200 samples per second (above Nyquist) fs_low = 80 # 80 samples per second (below Nyquist) # Time arrays t_high = np.arange(0, 0.1, 1/fs_high) t_low = np.arange(0, 0.1, 1/fs_low) # Original continuous signal (for reference) t_cont = np.linspace(0, 0.1, 1000) signal_cont = np.sin(2 * np.pi * freq * t_cont) # Sampled signals signal_high = np.sin(2 * np.pi * freq * t_high) signal_low = np.sin(2 * np.pi * freq * t_low) # Plotting plt.figure(figsize=(10, 6)) plt.plot(t_cont, signal_cont, label='Original Signal (50 Hz)', color='black') plt.stem(t_high, signal_high, linefmt='g-', markerfmt='go', basefmt=' ', label='Sampled at 200 Hz (Above Nyquist)') plt.stem(t_low, signal_low, linefmt='r-', markerfmt='ro', basefmt=' ', label='Sampled at 80 Hz (Below Nyquist)') plt.title('Sampling Signal Above and Below Nyquist Frequency') plt.xlabel('Time (seconds)') plt.ylabel('Amplitude') plt.legend() plt.grid(True) plt.show()
When to Use
The Nyquist frequency is crucial when converting real-world signals into digital form, such as in audio recording, medical imaging, or communication systems. To avoid errors, always sample at least twice the highest frequency present in the signal. For example, audio CDs use a sampling rate of 44,100 Hz, so the Nyquist frequency is 22,050 Hz, which covers the range of human hearing.
Using the Nyquist frequency helps engineers design systems that capture signals accurately without wasting resources on unnecessarily high sampling rates.
Key Points
- The Nyquist frequency is half the sampling rate of a digital signal.
- Sampling above the Nyquist frequency prevents aliasing and distortion.
- It sets the maximum frequency that can be accurately recorded.
- Used in audio, video, and communication to ensure signal quality.