- Changing the value of “Eest”: “Eest” is the error covariance of the state estimate which represents the confidence you have in your data. Lower “Eest” represents 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”.
- 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.
Denoising a curve using Kalman filter technique
10 次查看(过去 30 天)
显示 更早的评论
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
load('data001.mat')
x = data001(:,1);
y = data001(:,2);
yy = smoothdata(y,'movmean',0.5);
yy1 = Ksmooth(y');
plot(x,y,'ko',x,yy,'r--',x,yy1,'g--')
function [Data]= Ksmooth(s)
est=s(1);
Eest=1*10^(-5);
Emea=10^(-8);
q=0.05;
for i=1:1:length(s)
mea=s(1,i);
oest=est;
Kf= Eest/(Eest+Emea);
est=est + Kf*(mea-est);
Eest=(1-Kf)*(Eest) + abs(oest-est)*q;
Data(i,:)=est;
end
end
0 个评论
回答(1 个)
Abhimenyu
2023-10-13
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:
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,
Abhimenyu.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!