# Aliasing

An aliased signal provides a poor representation of the analog signal. Aliasing causes a false lower frequency component to appear in the sampled data of a signal. The following figure shows an adequately sampled signal and an undersampled signal.

In the previous figure, the undersampled signal appears to have a lower frequency than the actual signal—two cycles instead of ten cycles.

Increasing the sampling frequency increases the number of data points acquired in a given time period. Often, a fast sampling frequency provides a better representation of the original signal than a slower sampling frequency.

For a given sampling frequency, the maximum frequency you can accurately represent without aliasing is the Nyquist frequency. The Nyquist frequency equals one-half the sampling frequency, as shown by the following equation.

fN = (fs/2) | (A)

where fN is the Nyquist frequency and fs is the sampling frequency.

Signals with frequency components above the Nyquist frequency appear aliased between DC and the Nyquist frequency. In an aliased signal, frequency components actually above the Nyquist frequency appear as frequency components below the Nyquist frequency. For example, a component at frequency fN < f0 < fs appears as the frequency fs – f0.

The following two figures illustrate the aliasing phenomenon. The first figure shows the frequencies contained in an input signal acquired at a sampling frequency, fs, of 100 Hz.

The following figure shows the frequency components and the aliases for the input signal from the previous figure.

In the previous figure, frequencies below the Nyquist frequency of fs/2 = 50 Hz are sampled correctly. For example, F1 appears at the correct frequency. Frequencies above the Nyquist frequency appear as aliases. For example, aliases for F2, F3, and F4 appear at 30 Hz, 40 Hz, and 10 Hz, respectively.

The alias frequency equals the absolute value of the difference between the closest integer multiple of the sampling frequency and the input frequency, as shown in the following equation:

AF = |CIMSF – IF| | (B)

where AF is the alias frequency, CIMSF is the closest integer multiple of the sampling frequency, and IF is the input frequency. For example, you can compute the alias frequencies for F2, F3, and F4 from the previous figure with the following equations:

Alias F2 = |100 – 70| = 30 Hz | (C)

Alias F3 = |(2)100 – 160| = 40 Hz | (D)

Alias F4 = |(5)100 – 510| = 10 Hz | (E)

## Increasing Sampling Frequency to Avoid Aliasing

According to the Shannon Sampling Theorem, use a sampling frequency at least twice the maximum frequency component in the sampled signal to avoid aliasing. The following figure shows the effects of various sampling frequencies.

In case A of the previous figure, the sampling frequency fs equals the frequency f of the sine wave. fs is measured in samples/second. f is measured in cycles/second. Therefore, in case A, one sample per cycle is acquired. The reconstructed waveform appears as an alias at DC.

In case B of the previous figure, fs = 7/4f, or 7 samples/4 cycles. In case B, increasing the sampling rate increases the frequency of the waveform. However, the signal aliases to a frequency less than the original signal—three cycles instead of four.

In case C of the previous figure, increasing the sampling rate to fs = 2f results in the digitized waveform having the correct frequency or the same number of cycles as the original signal. In case C, the reconstructed waveform more accurately represents the original sinusoidal wave than case A or case B. By increasing the sampling rate to well above f, for example, fs = 10f = 10 samples/cycle, you can accurately reproduce the waveform.

Case D of the previous figure shows the result of increasing the sampling rate to fs = 10f.

## Anti-Aliasing Filters

In the digital domain, you cannot distinguish alias frequencies from the frequencies that actually lie between 0 and the Nyquist frequency. Even with a sampling frequency equal to twice the Nyquist frequency, pickup from stray signals, such as signals from power lines or local radio stations, can contain frequencies higher than the Nyquist frequency. Frequency components of stray signals above the Nyquist frequency might alias into the desired frequency range of a test signal and cause erroneous results. Therefore, you need to remove alias frequencies from an analog signal before the signal reaches the A/D converter.

Use an anti-aliasing analog lowpass filter before the A/D converter to remove alias frequencies higher than the Nyquist frequency. A lowpass filter allows low frequencies to pass but attenuates high frequencies. By attenuating the frequencies higher than the Nyquist frequency, the anti-aliasing analog lowpass filter prevents the sampling of aliasing components. An anti-aliasing analog lowpass filter should exhibit a flat passband frequency response with a good high-frequency alias rejection and a fast roll-off in the transition band. Because you apply the anti-aliasing filter to the analog signal before it is converted to a digital signal, the anti-aliasing filter is an analog filter.

The following figure shows both an ideal anti-alias filter and a practical anti-alias filter. The following information applies to the following figure

- f1 is the maximum input frequency.
- Frequencies less than f1 are desired frequencies.
- Frequencies greater than f1 are undesired frequencies.

An ideal anti-alias filter, shown in part a of the previous figure, passes all the desired input frequencies and cuts off all the undesired frequencies. However, an ideal anti-alias filter is not physically realizable.

Part b of the previous figure illustrates actual anti-alias filter behavior. Practical anti-alias filters pass all frequencies less than f1 and cut off all frequencies greater than f2. The region between f1 and f2 is the transition band, which contains a gradual attenuation of the input frequencies. Although you want to pass only signals with frequencies less than f1, the signals in the transition band might cause aliasing. Therefore, in practice, use a sampling frequency greater than two times the highest frequency in the transition band. Using a sampling frequency greater than two times the highest frequency in the transition band means fs might be more than 2f1.