how to remove drift on a signal without the detrend function

I have signal which runs for 30 hours measuring 64 times a second. As attached. Toward the end of the signal the sensor drifts. I have tried:
sdata = oxygen_unisense.data;
oxygen_unisense.detrend = detrend(sdata(3.715958429982246e+06:end));
but this leads to the signal averaging around zero.
I would like to put the straighten the signal highlighted (adjusting for drift)and put it back into the signal to original signal so that it lines up again with other measurements taken at exactly the same time. So the data is the same length again.
https://www.dropbox.com/s/s8iafhoiw03t54q/oxygen_unisense.mat?dl=0

1 Commento

lf = polyfit(oxygen_unisense.time(3715958.429982246:end),oxygen_unisense.data(3715958.429982246:end),1);
plot(oxygen_unisense.time(3715958.429982246:end),oxygen_unisense.time(3715958.429982246:end)*lf(1) + lf(2),'--k');
plot(oxygen_unisense.time(3715958.429982246:end),oxygen_unisense.time(3715958.429982246:end)*-lf(1) + oxygen_unisense.data(3715958.429982246:end))
trying this aswell

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Signal Processing Toolbox in Centro assistenza e File Exchange

Richiesto:

il 1 Ott 2018

Commentato:

il 2 Ott 2018

Community Treasure Hunt

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

Start Hunting!

Translated by