Skip to main content

Aliasing in Signal Processing: Nyquist-Shannon Theorem & Best Practices for Downsampling and Upsampling


Aliasing in Signal Processing

1. Nyquist-Shannon Sampling Theorem (Standard)

This is the foundational principle for preventing aliasing in both downsampling and upsampling:

  • The signal must be sampled at least at twice the highest frequency component in the signal (i.e., the sampling rate should be greater than or equal to twice the maximum frequency, known as the Nyquist rate).

Mathematically:

fs ≥ 2 × fmax

Where:

  • fs is the sampling rate.
  • fmax is the maximum frequency present in the signal.

For a signal with frequency content up to fmax, the Nyquist rate is 2 × fmax. If you violate this and sample below this threshold, aliasing will occur.

 

Aliasing in Signal Processing

Aliasing is a phenomenon that occurs when a continuous signal (or sampled signal) is undersampled during digital signal processing. This results in different signals becoming indistinguishable from each other when sampled at a lower rate. Aliasing is a major issue in both downsampling (decimation) and upsampling (interpolation), although it manifests differently in each case.

 

1. Aliasing during Downsampling (Decimation)

Downsampling involves reducing the sampling rate of a signal. When you downsample a signal, you take fewer samples per unit time. If the signal contains frequencies higher than half the new sampling rate (the Nyquist frequency), those high-frequency components get folded back into the lower frequency range, causing aliasing.

Conditions for Aliasing in Downsampling:

  • The original signal contains frequency components above half the new sampling rate (i.e., above the Nyquist frequency).
  • The Nyquist-Shannon sampling theorem states that to avoid aliasing, the original signal should be band-limited to half of the sampling rate (i.e., the Nyquist frequency).
  • If you downsample without low-pass filtering (anti-aliasing filter) the signal to remove these high-frequency components, aliasing will occur.

Example:

Suppose your original signal has a sampling rate of 1000 Hz. This means that the Nyquist frequency is 500 Hz.

If you want to downsample to a new sampling rate of 300 Hz, the Nyquist frequency for this rate is 150 Hz.

Any frequency component in the signal above 150 Hz will alias and appear as lower-frequency components.

To prevent aliasing during downsampling:

  • Pre-Filtering (Anti-Aliasing Filter): Apply a low-pass filter to the signal before downsampling. This filter should remove any frequency components above the Nyquist frequency of the new sampling rate.

For example, if you downsample from a sampling rate of fs = 1000 Hz to fs' = 300 Hz, the filter should remove all frequencies above 150 Hz (half of the new sampling rate).

  • Downsample the Signal: After the low-pass filtering step, downsample the signal by selecting every M-th sample, where M is the downsampling factor.

Mathematical Standard for Downsampling:

fnew = fold / M

Where:

  • fnew is the new, lower sampling rate.
  • fold is the original, higher sampling rate.
  • M is the downsampling factor.

 

2. Aliasing during Upsampling (Interpolation)

Upsampling, or interpolation, involves increasing the sampling rate of a signal. During upsampling, additional samples are inserted between the existing samples to increase the sample rate, but the frequency content of the signal does not change. Upsampling itself doesn't cause aliasing directly, but it can introduce artifacts if not handled properly.

Aliasing in Upsampling occurs due to:

  • The introduction of high-frequency components (above the Nyquist frequency of the new sampling rate) into the signal after the interpolation process. This can happen because interpolation can generate frequencies higher than the Nyquist frequency of the target sampling rate.

Example:

Suppose your original signal has a sampling rate of 200 Hz, and you upsample to 800 Hz.

The Nyquist frequency of the original signal is 100 Hz (half of 200 Hz), so the signal may have frequencies between 0 Hz and 100 Hz.

After upsampling to 800 Hz, the Nyquist frequency is 400 Hz.

If the signal is upsampled by inserting samples, the interpolated signal may introduce high-frequency components (between 100 Hz and 400 Hz) that could cause aliasing.

How to Prevent Aliasing during Upsampling:

  • Zero Padding: Insert M-1 zeros between each original sample. For example, if you want to upsample by a factor of M = 3, insert two zeros between each original sample.
  • Apply Interpolation Filter: After zero padding, apply a low-pass filter (such as an FIR filter) to remove any high-frequency components that might have been introduced during the interpolation process. This filter should have a cutoff at the Nyquist frequency of the new sampling rate.

Mathematical Standard for Upsampling:

fnew = M × fold

Where:

  • fnew is the new, higher sampling rate.
  • fold is the original, lower sampling rate.
  • M is the upsampling factor.

 

Summary of Aliasing:

  • Downsampling (decimation): Aliasing occurs when the signal contains frequency components above the Nyquist frequency of the new sampling rate, which will fold back into the lower frequencies. Low-pass filtering (anti-aliasing filter) before downsampling is necessary to avoid aliasing.
  • Upsampling (interpolation): Aliasing occurs if the interpolation introduces high-frequency components that exceed the Nyquist frequency of the new sampling rate. This can be avoided by using a low-pass filter to remove any high-frequency components before or after interpolation.

 

Further Reading

  1.  

People are good at skipping over material they already know!

View Related Topics to







Contact Us

Name

Email *

Message *

Popular Posts

ASK, FSK, and PSK (with MATLAB + Online Simulator)

📘 Overview 📘 Amplitude Shift Keying (ASK) 📘 Frequency Shift Keying (FSK) 📘 Phase Shift Keying (PSK) 📘 Which of the modulation techniques—ASK, FSK, or PSK—can achieve higher bit rates? 🧮 MATLAB Codes 📘 Simulator for binary ASK, FSK, and PSK Modulation 📚 Further Reading ASK or OFF ON Keying ASK is a simple (less complex) Digital Modulation Scheme where we vary the modulation signal's amplitude or voltage by the message signal's amplitude or voltage. We select two levels (two different voltage levels) for transmitting modulated message signals. For example, "+5 Volt" (upper level) and "0 Volt" (lower level). To transmit binary bit "1", the transmitter sends "+5 Volts", and for bit "0", it sends no power. The receiver uses filters to detect whether a binary "1" or "0" was transmitted. ...

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...(MATLAB Code + Simulator)

📘 Overview of BER and SNR 🧮 Online Simulator for BER calculation 🧮 MATLAB Code for BER calculation 📚 Further Reading 📂 View Other Topics on M-ary QAM, M-ary PSK, QPSK ... 🧮 Online Simulator for Constellation Diagram of m-ary QAM 🧮 Online Simulator for Constellation Diagram of m-ary PSK 🧮 MATLAB Code for BER calculation of ASK, FSK, and PSK 🧮 MATLAB Code for BER calculation of Alamouti Scheme 🧮 Different approaches to calculate BER vs SNR What is Bit Error Rate (BER)? The abbreviation BER stands for Bit Error Rate, which indicates how many corrupted bits are received compared to the total number of bits sent. BER = (number of bits received in error) / (total number of transmitted bits) What is Signal-to-Noise Ratio (SNR)? SNR is the ratio of signal power to noise powe...

Calculation of SNR from FFT bins in MATLAB

📘 Overview 🧮 MATLAB Code for Estimation of SNR from FFT bins 🧮 MATLAB Code for SNR from PSD using Kaiser Window 📚 Further Reading Here, you can find the SNR of a received signal from periodogram / FFT bins using the Kaiser operator. The beta (β) parameter characterizes the Kaiser window, which controls the trade-off between the main lobe width and the side lobe level. Steps Set up the sampling rate and time vector Compute the FFT and periodogram Calculate the frequency resolution and signal power Exclude the signal power from noise calculation Compute the noise power and SNR MATLAB Code for Estimation of SNR from FFT bins clc; clear; close all; % Parameters fs = 8000; f_tone = 1000; N = 8192; t = (0:N-1)/fs; % Generate signal + noise signal = sin(2*pi*f_tone*t); SNR_true_dB = 20; signal_power = mean(signal.^2); noise_power = signal_power / (10^(SNR_true_dB/10)); noisy_signal = signal + sqrt(noise_power) * randn(1, N); % Apply ...

MATLAB Code for ASK, FSK, and PSK (with Online Simulator)

📘 Overview & Theory 🧮 MATLAB Code for ASK 🧮 MATLAB Code for FSK 🧮 MATLAB Code for PSK 🧮 Simulator for binary ASK, FSK, and PSK Modulations 📚 Further Reading ASK, FSK & PSK HomePage MATLAB Code MATLAB Code for ASK Modulation and Demodulation % The code is written by SalimWireless.Com % Clear previous data and plots clc; clear all; close all; % Parameters Tb = 1; % Bit duration (s) fc = 10; % Carrier frequency (Hz) N_bits = 10; % Number of bits Fs = 100 * fc; % Sampling frequency (ensure at least 2*fc, more for better representation) Ts = 1/Fs; % Sampling interval samples_per_bit = Fs * Tb; % Number of samples per bit duration % Generate random binary data rng(10); % Set random seed for reproducibility binary_data = randi([0, 1], 1, N_bits); % Generate random binary data (0 or 1) % Initialize arrays for continuous signals t_overall = 0:Ts:(N_bits...

Online Simulator for ASK, FSK, and PSK

Try our new Digital Signal Processing Simulator!   Start Simulator for binary ASK Modulation Message Bits (e.g. 1,0,1,0) Carrier Frequency (Hz) Sampling Frequency (Hz) Run Simulation Simulator for binary FSK Modulation Input Bits (e.g. 1,0,1,0) Freq for '1' (Hz) Freq for '0' (Hz) Sampling Rate (Hz) Visualize FSK Signal Simulator for BPSK Modulation ...

Constellation Diagrams of ASK, PSK, and FSK with MATLAB Code + Simulator

📘 Overview of Energy per Bit (Eb / N0) 🧮 Online Simulator for constellation diagrams of ASK, FSK, and PSK 🧮 Theory behind Constellation Diagrams of ASK, FSK, and PSK 🧮 MATLAB Codes for Constellation Diagrams of ASK, FSK, and PSK 📚 Further Reading 📂 Other Topics on Constellation Diagrams of ASK, PSK, and FSK ... 🧮 Simulator for constellation diagrams of m-ary PSK 🧮 Simulator for constellation diagrams of m-ary QAM BASK (Binary ASK) Modulation: Transmits one of two signals: 0 or -√Eb, where Eb​ is the energy per bit. These signals represent binary 0 and 1.    BFSK (Binary FSK) Modulation: Transmits one of two signals: +√Eb​ ( On the y-axis, the phase shift of 90 degrees with respect to the x-axis, which is also termed phase offset ) or √Eb (on x-axis), where Eb​ is the energy per bit. These signals represent binary 0 and 1.  BPSK (Binary PSK) Modulation: Transmits one of two signals...

Comparing Baseband and Passband Implementations of ASK, FSK, and PSK

📘 Overview 🧮 Baseband and Passband Implementations of ASK, FSK, and PSK 🧮 Difference betwen baseband and passband 📚 Further Reading 📂 Other Topics on Baseband and Passband ... 🧮 Baseband modulation techniques 🧮 Passband modulation techniques   Baseband modulation techniques are methods used to encode information signals onto a baseband signal (a signal with frequencies close to zero). Passband techniques shift these signals to higher carrier frequencies for transmission. Here are the common implementations: Amplitude Shift Keying (ASK) [↗] : In ASK, the amplitude of the signal is varied to represent different symbols. Binary ASK (BASK) is a common implementation where two different amplitudes represent binary values (0 and 1). ASK is simple but susceptible to noise. ASK Baseband (Digital Bits) ASK Passband (Modulated Carrier)     Fig 1:  ASK Passband Modulation (...

LDPC Encoding and Decoding Techniques

📘 Overview & Theory 🧮 LDPC Encoding Techniques 🧮 LDPC Decoding Techniques 📚 Further Reading 'LDPC' is the abbreviation for 'low density parity check'. LDPC code H matrix contains very few amount of 1's and mostly zeroes. LDPC codes are error correcting code. Using LDPC codes, channel capacities that are close to the theoretical Shannon limit can be achieved.  Low density parity check (LDPC) codes are linear error-correcting block code suitable for error correction in a large block sizes transmitted via very noisy channel. Applications requiring highly reliable information transport over bandwidth restrictions in the presence of noise are increasingly using LDPC codes. 1. LDPC Encoding Technique The proper form of H matrix is derived from the given matrix by doing multiple row operations as shown above. In the above, H is parity check matrix and G is generator matrix. If you consider matrix H as [-P' | I] then matrix G will b...