How to remove outlier of time series signal data by using cubic spline interpolation?
Mostra commenti meno recenti
Hello everybody am new for Matlab and need an algorithm for my project that computes the following problems.
I have a time series 1D signal data like this:
x=[180 142 213 78 90 192 40 38 105 162 270 262 211 170 72 28 40 55 90 201]
and
L = numel(x),
fs=4
t=0:1/fs:(L-1)/fs;
I want to detect and remove outliers which is less than 50 and greater than 200 by using cubic spline interpolation.
Thank you so much in advance for all your contribution
Risposta accettata
Più risposte (1)
Steven Lord
il 13 Mag 2021
2 voti
Use > and < or the isoutlier function to determine where the outliers are located.
Use filloutliers specifying 'OutlierLocations' with the vector of outlier locations determined in the first step as that argument's value. Specify 'spline', 'pchip', or perhaps 'makima' as the fillmethod input.
2 Commenti
So long as the same identification method and interpolation option is chosen, this replicates the results above. isoutlier() and filloutlier() are new to me. I'm still finding all sorts of new things since I got to try something newer than R2015b.
x=[180 142 213 78 90 192 40 38 105 162 270 262 211 170 72 28 40 55 90 201]
L = numel(x);
fs=4
t=0:1/fs:(L-1)/fs; % [0 4.75]
limits = [50 200];
% find valid data locations
mask = x<limits(1) | x>limits(2);
% using filloutliers
xrfo = filloutliers(x,'spline','outlierlocations',mask);
plot(t,x,'k:'); hold on; grid on
plot(t,xrfo,'b')
Using makima or pchip might help reduce the degree to which the interpolated result projects again beyond the thresholds.
Yared Daniel
il 13 Mag 2021
Categorie
Scopri di più su Interpolation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
