how to remove drift on a signal without the detrend function

3 次查看(过去 30 天)
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 个评论
Rebecca Ellis
Rebecca Ellis 2018-10-2
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

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by