필터 지우기
필터 지우기

Smoothing/splining data with a limit to the slope of the smooth fit

조회 수: 2 (최근 30일)
Eric Snyder
Eric Snyder 2022년 9월 13일
편집: Bruno Luong 2022년 9월 13일
I have noisy data with erroneous measurements which I'm trying to smooth and remove outliers to better approximate the underlying "true" value that the data represent. I have a priori knowledge that the magnitude of the slope of the underlying true values cannot be more than a given value, i.e.
In the attached example, there's a series of measurements which are erroneous around 16:25 which violate this condition. I want a way to automatically remove those points before using pchip to smooth and interpolate the data. Is there a MATLAB function already in existence which can do something like this?
  댓글 수: 2
John D'Errico
John D'Errico 2022년 9월 13일
Be careful, as it is not always perfectly clear what is an outlier from merely the data, when viewed by an automatic scheme. It can be especially difficult when you have blocks of points that you perceive as outliers. It would help if you add a .mat file with some sample data, attached to a comment or to your original question, please.
Eric Snyder
Eric Snyder 2022년 9월 13일
Thanks for the response. These data are from a localization project, and the "outliers" aren't just noise or erroneous data -- they are most likely the algorithm locking on to a different source for a period of time. Ideally I'd be able to separate them and fit two separate lines to each source, but removing the source with fewer detections would be OK, too.
I've attached the data I used in the above plot to the original question.

댓글을 달려면 로그인하십시오.

답변 (1개)

Bruno Luong
Bruno Luong 2022년 9월 13일
편집: Bruno Luong 2022년 9월 13일
Using this File Exchange, its is not easy to find a combination of parameters to make it "works". I think it is difficult and the fit is fragile.
load('C:\Users\bruno\Downloads\example.mat')
ti=linspace(min(t),max(t),500);
pp=BSFK(t,x,3,200,[],struct('KnotRemoval','none','sigma',0,'lambda',1e-10));
plot(ti,ppval(pp,ti),'k',t,x,'.r')

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by