Back to the main page.

Bug 126 - High-pass filter explodes for no visible reason

Status CLOSED WONTFIX
Reported 2010-08-04 16:56:00 +0200
Modified 2011-01-12 13:09:32 +0100
Product: FieldTrip
Component: preproc
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P1 major
Assigned to: Stefan Klanke
URL:
Tags:
Depends on:
Blocks:
See also:

Vladimir Litvak - 2010-08-04 16:56:59 +0200

Created attachment 5 Inputs I got a complaint from a user that when he filters continuous data with cutoff 0.1 Hz he gets flat lines. With 0.2 it works. Try dat = ft_preproc_highpassfilter(dat,Fs,Fp,N,type,dir); with inputs from the attached file to reproduce the problem. I don't see a reason why it shouldn't work with these parameters.


Vladimir Litvak - 2010-08-04 17:01:12 +0200

Hmm. That also happens with Matlab butter, but I still don't understand it.


Stefan Klanke - 2010-08-19 17:35:28 +0200

I added some code in ft_preproc_highpassfilter that checks whether the calculated filter coefficients are stable (=whether all poles of the filter are strictly within the unit circle). If this is not the case (as in the originally given example), the function reports a corresponding error. I am not 100% sure about the cause of this problem, since a proper Butterworth filter should always be stable, but I vaguely remember that in some cases, a digital filter that was derived from a stable analog prototype (through bilinear transformation) can be instable. I think this comes from numerical precision when calculating the coefficients, and it *might* be possible to use more exact formulas (e.g. expand the analog filter before transforming).