Back to the main page.

Bug 2557 - conceptual flaws in the dftfilter faq

Status CLOSED FIXED
Reported 2014-05-02 09:21:00 +0200
Modified 2019-08-10 12:28:21 +0200
Product: FieldTrip
Component: documentation
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks:
See also:

Jörn M. Horschig - 2014-05-02 09:21:03 +0200

Burkhard Maess just pointed these two things out: (a) Figure 3, magenta line, cannot have been produced by a bandpass-filter, but a bandstop-filter (b) The statement "Over the whole interval, the 50Hz power is now zero. However, looking at a short piece at the begin, there is non-zero power at 50Hz." is impossible, because if power is zero in total, it cannot be non-zero at specific points in time. For (a), it took me some time to find why the code on the page actually produces that figure, but then I found that the sampling frequency is 1000 Hz in the beginning, but set to 10000 Hz when computing the filter. I'll fix both now, first change the code and exchange the figure and second, change the phrasing of that statement so that it is correct.


Jörn M. Horschig - 2014-05-02 09:35:26 +0200

be-u-ti-ful http://fieldtrip.fcdonders.nl/faq/why_is_there_a_residual_50hz_line-noise_component_after_applying_a_dft_filter?


Jörn M. Horschig - 2014-05-02 09:37:05 +0200

oh and also, I guess a "notch"-filter is not the same as a dftfilter? That one went wrong at various places throughout that faq, so I corrected for that as well


Robert Oostenveld - 2014-05-02 10:03:14 +0200

(In reply to Jörn M. Horschig from comment #2) A notch filter is the name often used for a bandstop filter with a very narrow stopband.


Robert Oostenveld - 2014-05-02 10:10:13 +0200

regarding "b" Assume that t = (1:1000)/1000; % one second of data s = sin(2*pi*50*t); % 50 Hz Now take s1 = [s s]; s2 = [s -s]; Over the whole 2-second window s1 has non-zero 50Hz power. Over the whole 2-second window s2 has zero 50Hz power. Looking at the data with a short-time-window FFT (or wavelet), both s1 and s2 have non zero power at most latencies, except that for s2 it dips to zero in the middle. If you were to dftfilter s1, the output would be zero everywhere. If you were to dftfilter s2, it would not change. So power over the whole window can be zero, but over a shorter window it can be non-zero. It's like the big-bang, which started with random ripples in the space-time-fabric (not that it is really related ;-)


Robert Oostenveld - 2014-05-02 10:16:37 +0200

I changed the wording in the FAQ a bit. It now states "Computed over the whole time interval, the 5 Hz amplitude is zero. However, for a short time interval at the begin, there is non-zero amplitude at 5 Hz." Do we all agree to this phrasing?


Jörn M. Horschig - 2014-05-02 10:24:17 +0200

hmm, interesting, let me think about that... btw, I thought I had already changed the phrasing in the faq to use amplitude rather than power


Jörn M. Horschig - 2014-05-02 10:27:12 +0200

ah, I see your changes. To me it looks fine, now. Hope Burkhard also agrees :)


Robert Oostenveld - 2019-08-10 12:28:21 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue describing the issue on https://github.com/fieldtrip/fieldtrip/issues.