Frequency aliasing is a physical effect whereby the sampling frequency of a disturbance masks the actual frequency of the disturbance.
For example, imagine the electrical system in Europe where AC frequency is 50Hz. A system that samples the AC frequency at 53Hz will not measure the AC frequency as 50Hz, but rather as 3Hz. This effect is aliasing.
Aliasing shows up often in engineering, where it is important to understand that measured frequencies do not always represent frequencies of anything fundamental to the system. However, with information about the measured frequency and the sampling frequency, the actual frequency of a disturbance (or its harmonics) are known.
The interactive plotter below demonstrates the aliasing effect. By default, it is meant to represent sampling of a 50Hz signal at 53Hz, which because of the aliasing effect is measured as a 3Hz signal. The 3Hz signal can be seen in the time domain in the top figure and in the frequency domain in the bottom figure.
Use the green buttons to interact with what you see below - the sliders also work. Increase the sample frequency until the original 50Hz signal appears. Or reduce the signal frequency until the aliasing effect disappears. Play around with it!
The fundamental frequency of a signal cannot be measured when it is sampled at a frequency lower than twice (2x) the signal frequency (half of the sample frequency is the Nyquist Frequency). In this scenario, the signal frequency has been aliased to a different frequency. Another visual representation of this effect is included here, where a 12Hz signal has been sampled at 9Hz which has created a 3Hz signal under measurement. As an engineer who has measured a 3Hz signal by sampling a system at 9Hz, it is impossible to know for sure if there is really a 3Hz disturbance or if the 3Hz measurement indicates a 12Hz disturbance is present - another possibility is the 2nd harmonic of a 6Hz disturbance is responsible! An understanding of the aliasing effect must be paired with system knowledge in this scenario.
The aliased frequency can be determined from the signal frequency and the sample frequency in a Python function. All possible aliased frequencies also usually include harmonics of the signal frequency. The function below can be used to generate a table of aliased frequencies given a sampling frequency, a signal frequency, and N harmonics of interest of the signal frequency.
def get_aliased_freq(f, fs): """ return aliased frequency of f sampled at fs """ import numpy as np fn = fs / 2 if np.int(f / fn) % 2 == 0: return f % fn else: return fn - (f % fn)