Clear Filters
Clear Filters

Denoising a curve using Kalman filter technique

9 views (last 30 days)
Josh on 6 Jul 2022
Answered: Abhimenyu on 13 Oct 2023
I have tried to use the concept of Kalman filter for smoothing the curves. However, this code does not seem to denoise the
curve as good as the other techniques such as 'moving average' as we zoom into the denoised curve. Also the second original data point is estimated poorly in the Kalman smoothing. Please help.
clear;clc;close all
x = data001(:,1);
y = data001(:,2);
yy = smoothdata(y,'movmean',0.5);
yy1 = Ksmooth(y');
function [Data]= Ksmooth(s)
for i=1:1:length(s)
Kf= Eest/(Eest+Emea);
est=est + Kf*(mea-est);
Eest=(1-Kf)*(Eest) + abs(oest-est)*q;

Answers (1)

Abhimenyu on 13 Oct 2023
Hi Josh,
I understand that you are using Kalman filter technique for smoothing the curves of the data. Kalman filter is a recursive algorithm that estimates the state of a dynamic system from noisy measurements. It consists of two steps: prediction and update.
The initial estimate plays a very important role in the working of the filter. As per my understanding, the provided code takes the first value of the data as the estimate which suggests that there is no prior knowledge of the data used. In this case the following improvements can help to denoise the data better:
  1. Changing the value of “Eest: Eest is the error covariance of the state estimate which represents the confidence you have in your data. Lower “Eestrepresents that you have more confidence in your estimate, but the estimate is taken as the first value of the data provided. To achieve better performance with a Kalman filter, “Eest” value can be set to a larger value, for example “10e-1”.
  2. Changing the value of “Emea: “Emea” is the error covariance of the measurement noise. Choosing a lower value suggests that your data is less noisy and more accurate. As the main motive is to denoise the data, taking a larger value of “Emea like 10e-3 will improve the Kalman filter performance.
Therefore, by adjusting the above two parameters accordingly will help to denoise and smooth the data. For more information on Kalman filter, please refer to the following documentation,
I hope this helps!
Thank you,

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!