Sampling and aliasing
On this page
In a film, the wheels of a moving car can seem to turn slowly, or even backwards. The camera takes its pictures too far apart to follow the spokes. A data logger can make the same error. Sampling is reading a signal at fixed moments, and aliasing is the false slow pattern that appears when those moments are too far apart.
See it
The air in a cold room warms and cools once every 6 minutes as the compressor stops and starts. A logger stores one reading every 5 minutes. What does the log show?
The thin line is the room. The dots are the only moments the logger sees, and the thick line is the picture a person draws from them. Every dot is a correct reading. With fewer than two dots in each cycle, the picture is wrong.
The idea
A logger sees a signal at one moment, then nothing until the next. The time between two readings is the sampling interval, written Δt.
For a signal that repeats with period T, the rule is short: you need more than two readings in each cycle, so Δt must be shorter than T ÷ 2. With fewer, the readings still form a regular wave, but a slower one. That false wave is the alias.
f = 1 ÷ T is the true frequency, fs = 1 ÷ Δt is the sampling frequency, fa is the frequency the log shows, and k is the whole number that makes fa smallest
The worst case is Δt equal to T. Every reading then falls at the same point of the cycle, and the log shows a steady value. A real machine does not repeat exactly, so its alias is often an irregular error and not a clean wave. The rule of T ÷ 2 is for an even cycle. A machine that is on for a short time in a long cycle needs Δt no longer than its shortest on time, or some runs fall between two readings and are never seen.
One worked number
A cold room temperature cycles with a period of T = 6 min. The logger reads every Δt = 5 min. What period does the log show?
Show the worked solution, 3 steps
- Check the rule
T ÷ 2 = 3 min. The interval of 5 min is longer than that, so there are only 6 ÷ 5 = 1.2 readings in each cycle. An alias will appear.
- Write the two frequencies
f = 1 ÷ 6 per minute and fs = 1 ÷ 5 per minute. With k = 1, fa = 1/5 − 1/6 = 6/30 − 5/30 = 1/30 per minute.
- Turn it back into a period
1 ÷ (1/30) = 30 min. The log describes a room that cycles every 30 min. The figure opens on this case: count the dots from one peak of the thick line to the next.
The mistake to avoid
The lesson on sampling intervals and aggregation shows what the same error does to an energy total.
Check yourself
A fan switches on and off with a period of 7 min. Its state is logged every 6 min. What period appears in the log?
A pump starts and stops with a period of 10 min: 5 min on, then 5 min off. What is the longest sampling interval that still lets you count its cycles?
A log with one reading every 15 min shows a compressor load that rises and falls smoothly every 2 hours. A colleague wants to smooth the data with software to find the true cycle. What do you answer?
Where you meet it
- A cold room loggerA thermostat cycle of a few minutes, read every 5 or 15 min, appears as slow waves or as a steady value.
- The energy of a cycling compressorIn the lesson, power read every 15 min gave between 6.9 and 9.6 kWh for a day that truly used 8.08 kWh.
- Vibration measurementAn analyser that samples too slowly shows a fast vibration at a low frequency, so it filters the signal before it samples.
- A logger sees only the moments it reads. What happens between them is lost.
- To follow a cycle of period T, read more than twice in each cycle: Δt shorter than T ÷ 2.
- Read too slowly and a false slow pattern appears: the alias.
- An alias cannot be removed from stored data. Choose the interval before you log.
Discussion
No comments yet. Questions, results from your own build, a better way to explain it: all welcome.
My notes on this page
Kept on this device only. Nothing is sent anywhere.
Tip: select words in the lesson, or tap a figure or an equation, to put a note right there.
Notes on earlier wording
The lesson has changed and these words are no longer in it. Your notes are kept, with the words you chose.