Can I remove zeroth order baseline?
Show older comments
I'm trying to clean up a signal using butterworth filter and baseline correction by subtracting absolute minimum value. However, my filtered data still has a few outliers that's causing a slight shift upwards away from zero. I was wondering if there's a way to remove those small outliers or have a zero order baseline so that the black lines are inline with zero?

Attached below are the code and the dataset that I used for this particular example.
Xcontractions = raw.rXcont;
Ycontractions = raw.rYcont;
Time = raw.Time;
%% Low-pass filter
%Set to remove frequencies higher than 5Hz
Fn = 35.55/2; %Frame rate for this particular video
Wp = 5/Fn;
Ws = 1.2*Wp;
Rp = 0.2;
Rs = 20;
[n,Wn] = buttord(Wp,Ws,Rp,Rs);
[b,a]=butter(n,Wn,'low');
Xcontractions = filtfilt(b,a,Xcontractions);
Ycontractions = filtfilt(b,a,Ycontractions);
%% Removes baseline
Xcontractions = Xcontractions-min(Xcontractions);
Ycontractions = Ycontractions-min(Ycontractions);
XYcontractions = Xcontractions + Ycontractions;
%% Plots graph
plot(raw.rXcont)
hold on
plot(Xcontractions)
legend('Original','Filtered')
Accepted Answer
More Answers (0)
Categories
Find more on Butterworth in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!