This repository contains dataset2 collected from an IMU sensor and an implementation file Average_Filter.m that includes the following filtering algorithms:
- Average Filter
- Moving Average Filter
- Low-pass Filter
The objective of this project is to demonstrate fundamental filtering techniques for noise reduction and signal smoothing in sensor data.
The average filter computes the arithmetic mean of the entire dataset to reduce random noise:
x_i: Input dataN: Total number of samplesy: Average output
The moving average filter calculates the average of the most recent (M) samples within a sliding window:
x[n]: Input signal at time stepnM: Window sizey[n]: Filter output at time stepn
The low-pass filter attenuates high-frequency components while allowing low-frequency signals to pass, which is effective for reducing sensor noise.
A simple first-order discrete-time low-pass filter is defined as:
x[n]: Input signal at time stepny[n]: Output signal at time stepnα ∈ (0,1): Filter coefficient (smaller values yield stronger smoothing)
In the figure above, the red curve corresponds to a window size of 20 samples, while the blue curve corresponds to a window size of 40 samples.
- A larger window size provides stronger noise reduction but introduces a delay, making the filter less responsive to rapid signal changes.
- A smaller window size follows the variations in the data more closely but results in higher noise levels.
Thus, M = 20 is more sensitive to signal variations compared to M = 40, but produces noisier results. On the other hand, M = 40 achieves better noise suppression but is less responsive to rapid changes.
The figure shows the IMU dataset (offset removed) filtered with a first-order low-pass filter using two different values of the tuning parameter α:
- Red curve: α = 0.3
- Blue dashed curve: α = 0.9
Observations:
- With α = 0.3, the filter gives more weight to the current measurement, closely following the variations in the dataset.
- With α = 0.9, the filter relies more on past values, resulting in stronger smoothing but introducing a noticeable delay (phase shift).
Compared to the moving average filter, the low-pass filter allows different weighting between recent and past data points, making it more effective in balancing noise suppression and responsiveness to signal changes.
- The moving average filter provides effective noise suppression but introduces a trade-off between smoothing and responsiveness depending on the window size.
- The low-pass filter (LPF) addresses this limitation by assigning different weights to recent and past values, offering a better compromise between noise reduction and signal tracking.
This repository demonstrates how different filtering algorithms can be applied to IMU sensor data, providing insights into the trade-offs between smoothing and responsiveness in signal processing.