Application Notes

Sampling Theorem

Aliasing and Anti-Aliasing measures on Moku Devices

Signal digitization is an essential step to enable digital signal processing (DSP). It converts an analog signal to discrete-time binary numbers and allows the signal to be processed with digital logic devices, such as CPUs, application-specific integrated circuits (ASIC), and field-programmable gate arrays (FPGA). In order to ensure the conversion process retains the maximum signal fidelity, the Nyquist-Shannon sampling theorem states that the minimum sampling frequency must be at least twice the maximum frequency component of the original signal. If this condition is not met, aliasing artifacts will degrade and distort the sampled signal. In this application note, we will discuss the effects of aliasing and the anti-aliasing measures implemented on Moku devices.

Download Printable Version

Introduction

Digital signal processing (DSP) provides unprecedented flexibility compared to its analog counterpart. For DSP-based devices, the signal is usually converted from the analog domain to the digital domain via analog-to-digital converters (ADCs). Once the signal is converted to discrete-time binary numbers, it can then be processed via digital logic circuits, such as CPUs and field-programmable gate arrays (FPGA). In many cases, the behavior of DSP chips can be easily programmed and reprogrammed via software. On the other hand, small changes to the algorithm of an analog-based signal processing devices may necessitate a complete redesign of the circuit.

Liquid Instruments’ Moku platforms are equipped with a high-performance Xilinx system on a chip (SoC) and FPGA. This architecture allows multiple DSP algorithms to be stored and deployed on a single device and reprogramed within a couple of seconds. The Moku family currently support twelve different instruments, such as oscilloscope, waveform generator, spectrum analyzer, PID controller, that can be deployed and switched in and out within seconds on a single hardware device. In this way, Moku platforms provide highly flexible instruments for many common electrical engineering workflows.

While the conversion from the analog domain to the digital domain cannot be completely lossless, there are a few important factors we need to consider to ensure maximum signal fidelity. In this application note, we will discuss the Nyquist-Shannon sampling theorem. It states that the minimum sampling frequency must be more than twice the maximum frequency component of the original signal. If this condition is not met, aliasing artifacts will degrade and distort the sampled signal. Given a fixed sampling frequency, an ADC can only sample signals below ½ of its sampling frequency without aliasing. In this application note, we will use a few plots to demonstrate this effect and conduct an experiment to show the aliasing effect induced by an insufficient sampling rate. Later, we will discuss the measures Moku devices have implemented to minimize the effects of aliasing.

Figure 1: Liquid Instruments’ FPGA-based Moku:Go (left) and Moku:Lab (right) test and measurement platforms

A graphical illustration of the sampling theorem

To show the effect of aliasing, we used MATLAB to simulate a system with a sampling rate of 200 Sa/s. By the sampling theorem, the maximum frequency this system could digitize without aliasing artifacts is <100 Hz. In Figure 2, sinusoidal signals at 40, 80, 120, and 160 Hz were sampled at 200 Sa/s. The solid blue curves illustrate the true underlying signal. The orange dots represent the sampling points. The orange dashes represent the reconstructed signals from the sampled points, based on the assumption of (minimal frequency) pure sinusoidal inputs. We can see the system was able to reconstruct the signal with 40 and 80 Hz inputs. However, the signals at 120 and 160 Hz were incorrectly perceived at 80 and 40 Hz, respectively. In other words, based on the sampled points alone, the system could not distinguish input signals at 80 Hz from those at 120 Hz. This phenomenon, where a higher frequency signal is incorrectly recognized as a lower frequency signal due to an insufficient sampling rate, is called aliasing. A detailed frequency domain description of aliasing is available in chapter 2 of the following book:

Li, Tan. Digital Signal Processing. Academic Press, 2008

Figure 2: MATLAB simulation of a system with a sampling rate of 200 Sa/s. Sinusoidal input signals at 40, 80, 120, and 160 Hz were shown in (a), (b), (c), and (d), respectively.

Experimental demonstration

In this experiment, we used the Moku:Go oscilloscope to capture a 2.001 MHz (2 MHz + 1 kHz) signal at two different sample rates, 1 MSa/s and 125 MSa/s. The oscilloscope was set to capture the signal under ‘normal mode’. This disables the digital anti-aliasing measure on Moku:Go. The math channel was set to perform an FFT on input 1. The captured screenshots with 1 MSa/s (Figure 2a) and 125 MSa/s (Figure 2b) are shown below. With the 1 MSa/s, the signal was incorrectly recognized as a ~1 kHz signal. The correct waveform was recovered at ~125 MSa/s. The displayed frequency was slightly higher than 2.001 MHz due to the resolution of FFT.

(a)

(b)

Figure 3: A 2.001 MHz signal was captured at 1 MSa/s and 125 MSa/s sampling rate. At 1 MSa/s, the input signal was incorrectly recognized as a ~1 kHz signal.

Anti-aliasing measures on Moku Devices

Analog low-pass filter

The most common method to prevent aliasing artifacts of a digital system is to place an analog lowpass filter before the ADC. The filter attenuates the frequency components that are beyond the Nyquist frequency, thereby mitigating aliasing. Moku:Lab’s ADCs have sampling rates of 500 MSa/s. 200 MHz lowpass filters are used as anti-aliasing filters. Moku:Go’s ADCs have sampling rates of 125 MSa/s. 35 MHz lowpass filters are used. To show this, we used Moku:Go’s oscilloscope to measure sinusoidal signals at 1, 5, 10, 20, 30, 40, 50, and 60 MHz. The built-in measurement tool was used to measure the amplitudes of the inputs. Figure 4 (a) shows a screenshot of the example measurement for a 30 MHz input. The measured relative amplitudes (compared to the measured amplitude at 1 MHz) of the inputs as a function of input frequency are plotted in Figure 4 (b). We can see the signals beyond 30 MHz are attenuated by the lowpass filter.

(a)

(b)

Figure 4: Measurement of input signal as a function of input frequency.

Oversampling average filter

Under certain measurement settings, the effective sampling rate of Moku:Go instrument is reduced below 125 MSa/s. Therefore, additional aliasing can be introduced by the re-sampling step, which needs to be mitigated by another digital filter. Under these conditions, instead of direct decimation, the instruments have the option to automatically average the several sample points together and pass the averaged result downstream to the DSP. This is called ‘precision mode’ and this process effectively reduces the sampling rate and the bandwidth of the system. It can be considered as a digital low-pass filter. Here, we used the precision mode (option to enable auto averaging) to recapture the data shown in Figure 5 with the 2.001 MHz input. With the averaging filter, the aliasing artifacts are significantly reduced.

(a)

(b)

Figure 5: A 2.001 MHz signal was captured with the averaging disabled (a) and enabled (b). The aliasing effect was significantly reduced with the precision mode enabled.

Conclusion

In this application note, we discussed the aliasing effect. Moku devices have analog lowpass filters built-in to attenuate signals beyond the ADCs Nyquist frequencies. In addition, digital filtering techniques are used to prevent additional aliasing induced by the re-sampling process. The combination of analog and digital anti-aliasing measures reduces signal artifacts and distortion from sampling effects.


Questions or comments?

Please contact us at [email protected]