I have a certain signal that has a linear trend that should be removed:
The problem is that the signal needs to be processed in real time(sampling rate is 20Hz). If I only apply the detrending per window of say, 20 samples and then concatenate detrending results, the signal is disrupted.
I wonder if there is some efficient technique to detrend the data per window in real time and then concatenate it so the final signal will make sense? Or should I just detrend every new incoming data with the older data which is far from being efficient.
I would like to note that taking the entire signal and processing it offline using MATLAB's
detrend works correctly. The problem occurs when breaking the signal into certain fixed size windows and then applying
detrend on each.