← Back to the chapter · Previous detail · Next detail →

Technical detail · Imputation and Noise Filtering

Calculate moving-average noise and delay

How does filter window size affect noise reduction and latency?

For a moving average filter with independent Gaussian noise (σ = 2.0°C) on temperature sensor:

Noise reduction formula:

σfiltered=σoriginalN\sigma_{filtered} = \frac{\sigma_{original}}{\sqrt{N}}

Where NN is the window size.

Window Size (N)Noise ReductionLatency (samples)Temperature Example
3σ/3=0.58σ\sigma / \sqrt{3} = 0.58\sigma1.02.0°C → 1.15°C noise
5σ/5=0.45σ\sigma / \sqrt{5} = 0.45\sigma2.02.0°C → 0.89°C noise
10σ/10=0.32σ\sigma / \sqrt{10} = 0.32\sigma4.52.0°C → 0.63°C noise
20σ/20=0.22σ\sigma / \sqrt{20} = 0.22\sigma9.52.0°C → 0.45°C noise

Trade-off: Larger window → better noise rejection BUT longer delay detecting real changes.

Latency calculation: Output lags input by N−12\frac{N-1}{2} samples. For N=10N=10 at 1 Hz sampling → 4.5 second delay.

Practical rule: Choose NN such that latency is < 10% of the timescale you care about. If monitoring hourly HVAC cycles (3600s), 5-10 sample window (2-4.5s latency) is acceptable. If detecting rapid door opening events (10s timescale), use N=3N=3 (1.0s latency max).

← Back to the chapter · Previous detail · Next detail →