Metatransformer report
Filtering and state estimation
Practice · 60 minutes · Reduce measurement noise without hiding motion, delay, or faults, and quantify what an estimate can support.
Text report: images and diagrams are omitted, and links to project files are inactive. Keep the exported project alongside this PDF for wiring diagrams, models, and linked files.
Learning outcomes
- Implement and analyze a moving-average or exponential low-pass filter.
- Separate measurement, estimate, residual, and true-but-unknown state in a diagnostic record.
Prerequisites
- probability-uncertainty
- signals-systems
Concepts
Sensors do not reveal truth directly. A camera-derived position jitters, an ADC includes quantization and electrical noise, and a distance sensor may occasionally return an outlier. Filtering combines measurements over time to make a more useful estimate. The cost is usually delay or reduced ability to follow rapid change.
An N-sample moving average is ȳ_k = (1/N)Σx_{k-i}. For independent zero-mean noise with standard deviation σ, its standard deviation falls ideally to σ/√N, but the window delays changing signals. An exponential filter uses ŷ_k = αx_k + (1-α)ŷ_{k-1}, with 0 < α ≤ 1. Smaller α smooths more and responds more slowly. A state estimator goes further by combining a process model and measurement uncertainty; even a simple “predict, compare residual, correct” loop makes its assumptions explicit.
The residual r_k = measurement - predicted measurement is diagnostically valuable. Random residuals near zero may support the model; persistent bias suggests calibration error or an unmodelled force; abrupt large residuals may signal dropout or impact. Do not silently discard inconvenient readings. Record raw data, estimate, filter parameters, timestamp, saturation, and rejection decisions. For a camera mount, the build decision could be a modest filter that reduces pixel jitter while preserving enough bandwidth to track intentional pan motion.
A common misconception is that a smoother plot is more accurate. Heavy filtering can produce a clean but late estimate and hide a loose connector. Another is treating a filter's output as a physical measurement; it is a computed estimate based on assumptions. Averaging correlated drift does not remove the drift as σ/√N predicts. Choose filter bandwidth relative to system dynamics, examine residuals, and test known changes. If control stability worsens after filtering, added delay may outweigh reduced noise.
Worked example
Problem
A distance sensor reports 100, 104, 98, and 102 mm. Compute the four-sample mean and the ideal standard-deviation reduction factor for independent noise.
Steps
- Sum readings: 100 + 104 + 98 + 102 = 404 mm.
- Mean is 404 mm ÷ 4 = 101 mm.
- For independent zero-mean noise, standard deviation of the mean is σ/√4 = σ/2.
Result
The estimate is 101 mm, with an ideal random-noise standard deviation half that of one reading.
Sanity check
The mean lies within the observed 98–104 mm range; the uncertainty claim does not cover bias or correlated drift.
Check your understanding
A larger moving-average window makes a stationary trace smoother but causes a robot to react late to obstacles. What explains both effects?
A. The window reduces high-frequency variation but adds delay B. The sensor's physical range increases C. Averaging removes every bias D. The sample clock becomes continuous
Your answer: ______________________________
Reasoning:
Answer key
ANSWER KEY — check only after attempting the question.
A. The window reduces high-frequency variation but adds delay
A longer window attenuates fast variation by combining older samples, so real changes also arrive later in the estimate. It does not expand range, remove systematic bias, or turn sampled data into continuous time.
Hands-on lab
Goal
Compare raw, filtered, and residual signals during stationary and moving tests.
Equipment
- Low-voltage distance or light sensor
- Microcontroller
- Serial logger
- Movable target
- Ruler
Procedure
- Log raw readings from a fixed target and predict how windows N = 1, 4, and 16 will affect scatter and response time.
- Move the target by a measured amount at a marked time; compute each moving average without deleting raw samples.
- Compare actual scatter, time to cross 90% of the change, and residuals for each window.
- Deliberate fault: briefly cover or disconnect the sensor within its safe interface; diagnose the outlier/dropout from raw data and residual rather than masking it with a long average.
What to observe
- Expected: longer windows reduce stationary scatter but delay the measured step.
- Measure: actual raw range, filtered crossing time, residuals, and dropout code; identify assumptions behind any uncertainty estimate.
Transfer challenge
Choose and justify a filter for a desk robot that must ignore millimetre jitter yet detect a hand approaching within 0.3 s.
Cautions
- Use only sensor-safe low-voltage wiring and disconnect power before changing connections.
Evidence record
Learner: ____________________ Date: ____________________
Evidence artifact or file: ____________________________________________
| Item | Record |
|---|---|
| Prediction or expected result | |
| Actual observation or measurement | |
| Conditions and tools used | |
| Difference from expectation | |
| Next decision or follow-up |
Notes: