Given the signal shown below, what is the best way to remove the steps and local maximas it contains. The signal contains some steps which can last up to 100 Samples before they return to about the same value as before the step (Marked with red circles). There are also some peaks which last only for one sample which should also be removed.
First Dataset: On this set, the median Filter works as expected (not shown here).
On the following Dataset, the Medianfilter with the same settings fails. To many samples are replaced by the median value.
What I've tried already:
- Work with a moving average. Advantage: Small peaks have less influence and are nicely removed. Disadvantage: Long lasting steps remain in the signal.
- Get the first difference of the signal (
diff(X)) and correct the value in X if a big positive change is followed by a negative change immediately. Advantages and disadvatages are the same as above.
What are some good methods to remove/correct these unwanted values?