<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Lara,
<div class=""><br class="">
</div>
<div class="">See <a href="https://mailman.science.ru.nl/pipermail/fieldtrip/2018-July/038096.html" class="">https://mailman.science.ru.nl/pipermail/fieldtrip/2018-July/038096.html</a> which also describes the issue you encounter. Apparently, there is some
 dependence of hardware/OS version and possibly also the matlab version on the numerical stability of the computed filter coefficients. The function filter_with_correction (which is the low-level workhorse underlying the intermediate level ft_preproc_<some>filter
 functions) checks whether the filter coefficients are stable of not. If not, the risk exists that the filter blows up in your face, and the filtered time courses go out of control. The filter coefficients are based on the specified order, the required passband,
 and the sampling frequency, so changing any of those could turn an unstable filter into a stable filter again.</div>
<div class=""><br class="">
</div>
<div class="">The consequence of switching to a lower order filter is typically a more ’shallow’ filter response, in your case a less ‘boxlike’ appearance of the filter’s passband.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 7 Jul 2021, at 16:46, Lara Todorova via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">Dear all, </div>
<div class=""><br class="">
</div>
I am applying a bandpass filter 8-12 Hz on EEG data, 64 channels, 1000 sampling frequency. The data was preprocessed in eeglab software.<br class="">
<br class="">
I get an error that suggests changing the order of the filter<br class="">
ft_error('Calculated filter coefficients have poles on or outside the unit circle and will not be stable. Try a higher cutoff frequency or a different type/order of filter.');<br class="">
<br class="">
I'm not sure why I get this error. Does anyone have an idea?
<div class=""><br class="">
Indeed when I change the filter order to 3 instead of default 4, the problem is solved.
<br class="">
I also noticed that if I change Fs to 500 instead of 1000 it also works. <br class="">
<br class="">
Could someone comment on how Fs affects filtering in ft_preproc_bandpassfilter or what are the consequences of switching to the filter of the lower order?
<br class="">
<br class="">
Thanks, 
<div class="">Lara<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr" class="">
<div class="">Lara Todorova | PhD</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!s1uGzqWITr75SHZ5KD3SYH8WIt4KWj8c8V8hVNJHd-J-MsV3sKZDc1cqrHNF7Xc1PDdHNkqP28MUHI4$
<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>