The Nyquist sampling theorem tells you how fast you must sample a signal so that no information is lost: more than twice the highest frequency it contains. Sample slower, and high frequencies fold back as false low ones, an effect called aliasing. This calculator takes the signal frequency, the sampling rate and the number of samples, and returns the Nyquist frequency, the minimum rate, the apparent frequency after sampling and the resolution of a Fourier transform.
How the calculation works
- Nyquist frequency = sampling rate ÷ 2
- Minimum sampling rate = 2 × signal frequency
- Alias frequency = |f − fs × round(f ÷ fs)|
- Samples per cycle = fs ÷ f
- FFT resolution = fs ÷ number of samples, and duration = samples ÷ fs
Example
A 1,500 Hz tone is sampled at 2,000 Hz, which gives only 1.33 samples per cycle. The Nyquist frequency is 1,000 Hz, so the tone is above the limit and aliases to 500 Hz: |1,500 − 2,000| = 500. At least 3,000 Hz would be needed. A recording of 1,024 samples lasts 0.512 s and has a frequency resolution of 1.953 Hz.
Where it is used
Audio recording, oscilloscopes, sensors, radio receivers and data loggers all depend on it. CD audio uses 44.1 kHz to cover the 20 kHz limit of human hearing. A vibration measurement system chooses the sampling rate from the highest frequency of interest, and a video camera can show wheels and propellers turning at the wrong speed when frames are too slow.
Good to know
Real signals have energy above their nominal band, so the sampling rate is chosen with a margin, typically 2.5 to 5 times the highest frequency. An analog anti-aliasing filter is essential, because aliasing cannot be removed after the signal has been sampled. A longer record gives a finer frequency resolution, while a higher sampling rate gives a wider frequency range. Bandpass signals can sometimes be sampled below the Nyquist rate on purpose, which is called undersampling.
Related tools
For the resolution of an analog-to-digital converter, use the ADC resolution calculator. The channel capacity calculator covers the maximum data rate, and the RC filter calculator helps to design an anti-aliasing filter.