Which filtering approach to use?

7 views (last 30 days)
I am dealing with a transient signal like this:
It is essentially zero in the beginning and it is important to keep this baseline.
I would like to get rid of the low frequency part in it, say to apply a 10kHz high-pass filter. There are commercial codes, which can do such filtering, but I am struggling to find a proper Matlab solution.
The best I found so far is a sos-based filtfilt approach, but this still results in something like this:
Thus it does not preserve the baseline, but adds artifical oscillations.
Any help or ideas for alternatives are welcome!
Kind regards, Markus
  2 Comments
Chad Greene
Chad Greene on 27 Feb 2017
What do you mean by preserving the baseline? It looks like the second signal does pass through (nearly) y=0 at x=0. If you want to preserve the overall shape, maybe you're looking for a bandstop filter?
Markus Sause
Markus Sause on 28 Feb 2017
The "baseline" from 0 ... 30µs is approximately zero. Applying a filter to this section should return the same zero. So the oscillation in the filtered signal is purely artificial, likely because of the mismatch of periodic nature of the signal.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 28 Feb 2017
You cannot filter out the low-frequency part of your signal with a highpass filter and retain the constant, 0 Hz, section for the first 40 µs. That is a logical (and mathematical) impossibility. You must use a lowpass filter if you want to retain the constant section.
What do you want to do with your signal? What information in it do you want to keep, and what do you want to eliminate?
Attaching a .mat file with your time and amplitude vectors would help.
  15 Comments
Markus Sause
Markus Sause on 15 Mar 2017
Surprisingly the filtfilt destroys the performance of the filter, so I used the filter command instead.
Thanks!
Star Strider
Star Strider on 15 Mar 2017
My pleasure!
The filtfilt behavior surprises me as well.

Sign in to comment.

More Answers (1)

Markus Sause
Markus Sause on 14 Mar 2017
Star Strider,
you showed me the way to go! Based on your code I tried and evaluated several filter options. With the estimates from impulse and step function I concluded for some of the parameters.
What comes closest is:
filterfreq = 100e3;
hpFilt = designfilt('highpassiir','StopbandFrequency',filterfreq/4, ...
'PassbandFrequency',filterfreq,...
'StopbandAttenuation',80,'DesignMethod','butter', 'SampleRate', Fs);
fvtool(hpFilt);
OrigFilt = filter(hpFilt, Orig(:,2));
Many thanks for your help!
Markus

Community Treasure Hunt

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

Start Hunting!