<div dir="ltr">Did you also try searching the mailing list archives?  <a href="https://www.google.com/search?q=%22Calculated+filter+coefficients+have+poles+on+or+outside+the+unit+circle%22+site:mailman.science.ru.nl/pipermail/fieldtrip/&filter=0">The same error has come up a few times.</a><div><br></div><div>What is your trial duration and sampling frequency?  You'll need several seconds to get an accurate idea of what's going on in such low frequencies.</div><div><br></div><div>Have you tried just detrending and applying a 2 Hz low-pass filter?  It seems like that might have essentially the same effect.</div><div><br></div><div>Hope one of those helps,</div><div>Teresa</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 24, 2017 at 8:29 PM, Wong-Barnum, Mona <span dir="ltr"><<a href="mailto:mona@sdsc.edu" target="_blank">mona@sdsc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">
<div>Hello fellow FieldTrip'er:</div>
<div><br>
</div>
<div><span class="m_-7111081432505180086Apple-tab-span" style="white-space:pre-wrap"></span>Can someone help me understand and hopefully fix the following runtime error message I am seeing (I searched a bit on the website documentation but didn’t find anything):</div>
<div><br>
</div>
<div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
Error using filter_with_correction (line 51)</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
Calculated filter coefficients have poles on or outside the unit circle and</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
will not be stable. Try a higher cutoff frequency or a different type/order of</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
filter.</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196);min-height:20px">
<br>
</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
Error in filter_with_correction (line 51)</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
  error('Calculated filter coefficients have poles on or outside the unit</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
  circle and will not be stable. Try a higher cutoff frequency or a different</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
  type/order of filter.');</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196);min-height:20px">
<br>
</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
Error in ft_preproc_bandpassfilter (line 286)</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
  filt = filter_with_correction(B,A,<wbr>dat,dir,usefftfilt);</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196);min-height:20px">
<br>
</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
Error in preproc (line 324)</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
  if strcmp(cfg.bpfilter, 'yes'),     dat = ft_preproc_bandpassfilter(dat,</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
  fsample, cfg.bpfreq, cfg.bpfiltord, cfg.bpfilttype, cfg.bpfiltdir,</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
  cfg.bpinstabilityfix, cfg.bpfiltdf, cfg.bpfiltwintype, cfg.bpfiltdev,</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
  cfg.plotfiltresp, cfg.usefftfilt); end</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196);min-height:20px">
<br>
</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
Error in ft_preprocessing (line 592)</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
      [cutdat{i}, label, time{i}, cfg] = preproc(dat, hdr.label(rawindx), tim,</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
      cfg, begpadding, endpadding);</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196);min-height:20px">
<br>
</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
Error in test (line 25)</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
data = ft_preprocessing ( cfg );</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196);min-height:20px">
<br>
</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
Error in run (line 96)</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
evalin('caller', [script ';']);</div>
</div>
<div><br>
</div>
<div><span class="m_-7111081432505180086Apple-tab-span" style="white-space:pre-wrap"></span>Here is my script:</div>
<div><br>
</div>
<div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
addpath <span style="font-variant-ligatures:no-common-ligatures;color:#b6660a">
/</span>path/to/my<span style="font-variant-ligatures:no-common-ligatures;color:#b6660a">/</span>fieldtrip</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
ft_defaults</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196);min-height:20px">
<br>
</div>
<div style="margin:0px;font-family:'Andale Mono';color:rgb(67,41,212);background-color:rgb(223,219,196)">
% 1. MEG</div>
<div style="margin:0px;font-family:'Andale Mono';color:rgb(177,37,18);background-color:rgb(223,219,196)">
<span style="font-variant-ligatures:no-common-ligatures;color:#000000">disp (
</span>'Reading 1.fif...'<span style="font-variant-ligatures:no-common-ligatures;color:#000000"> )</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg = <span style="font-variant-ligatures:no-common-ligatures;color:#01a3af">
[]</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg.dataset = <span style="font-variant-ligatures:no-common-ligatures;color:#b12512">
'1.fif'</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
data = ft_preprocessing ( cfg )<span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196);min-height:20px">
<br>
</div>
<div style="margin:0px;font-family:'Andale Mono';color:rgb(177,37,18);background-color:rgb(223,219,196)">
<span style="font-variant-ligatures:no-common-ligatures;color:#000000">disp (
</span>'Getting MEG channel 1...'<span style="font-variant-ligatures:no-common-ligatures;color:#000000"> )</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
meg_channel = ft_channelselection ( <span style="font-variant-ligatures:no-common-ligatures;color:#b12512">
'MEG0111'</span>, data.label )<span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg = <span style="font-variant-ligatures:no-common-ligatures;color:#01a3af">
[]</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg.channel = meg_channel<span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
meg = ft_selectdata ( cfg, data )<span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';color:rgb(177,37,18);background-color:rgb(223,219,196)">
<span style="font-variant-ligatures:no-common-ligatures;color:#000000">disp (
</span>'Saving meg...'<span style="font-variant-ligatures:no-common-ligatures;color:#000000"> )</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
save meg.mat meg <span style="font-variant-ligatures:no-common-ligatures;color:#b6660a">
-</span>v7<span style="font-variant-ligatures:no-common-ligatures;color:#b12512">.3</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
clearvars cfg meg<span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196);min-height:20px">
<br>
</div>
<div style="margin:0px;font-family:'Andale Mono';color:rgb(67,41,212);background-color:rgb(223,219,196)">
% 2. Low delta MEG</div>
<div style="margin:0px;font-family:'Andale Mono';color:rgb(177,37,18);background-color:rgb(223,219,196)">
<span style="font-variant-ligatures:no-common-ligatures;color:#000000">disp (
</span>'Low delta MEG...'<span style="font-variant-ligatures:no-common-ligatures;color:#000000"> )</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg = <span style="font-variant-ligatures:no-common-ligatures;color:#01a3af">
[]</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg.bpfilter = <span style="font-variant-ligatures:no-common-ligatures;color:#b12512">
'yes'</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg.bpfreq = <span style="font-variant-ligatures:no-common-ligatures;color:#01a3af">
[</span><span style="font-variant-ligatures:no-common-ligatures;color:#b12512">0.1</span>
<span style="font-variant-ligatures:no-common-ligatures;color:#b12512">
2</span><span style="font-variant-ligatures:no-common-ligatures;color:#01a3af">]</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg.dataset = <span style="font-variant-ligatures:no-common-ligatures;color:#b12512">
'1.fif'</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
data = ft_preprocessing ( cfg )<span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196);min-height:20px">
<br>
</div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg = <span style="font-variant-ligatures:no-common-ligatures;color:#01a3af">
[]</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg.channel = meg_channel<span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
cfg.frequency = <span style="font-variant-ligatures:no-common-ligatures;color:#01a3af">
[</span><span style="font-variant-ligatures:no-common-ligatures;color:#b12512">0.1</span>
<span style="font-variant-ligatures:no-common-ligatures;color:#b12512">
2</span><span style="font-variant-ligatures:no-common-ligatures;color:#01a3af">]</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
meg = ft_selectdata ( cfg, data )<span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';color:rgb(177,37,18);background-color:rgb(223,219,196)">
<span style="font-variant-ligatures:no-common-ligatures;color:#000000">disp (
</span>'Saving low delta meg...'<span style="font-variant-ligatures:no-common-ligatures;color:#000000"> )</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
save low_delta_meg.mat meg <span style="font-variant-ligatures:no-common-ligatures;color:#b6660a">
-</span>v7<span style="font-variant-ligatures:no-common-ligatures;color:#b12512">.3</span><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
<div style="margin:0px;font-family:'Andale Mono';background-color:rgb(223,219,196)">
clearvars cfg meg<span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0">;</span></div>
</div>
<div><span style="font-variant-ligatures:no-common-ligatures;color:#c02ec0"><br>
</span></div>
<span class="m_-7111081432505180086Apple-tab-span" style="white-space:pre-wrap"></span>Line #25 is the last “<span style="font-family:'Andale Mono';background-color:rgb(223,219,196)">data = ft_preprocessing ( cfg )</span><span style="font-family:'Andale Mono';background-color:rgb(223,219,196);color:rgb(192,46,192)">;</span>”
 line.
<div><br>
</div>
<div><span class="m_-7111081432505180086Apple-tab-span" style="white-space:pre-wrap"></span>If I do cfg.bpfreq = [2 4] then there is no error but I really like to get this low [0.1 2] range…any tips?</div>
<div><br>
</div>
<div>Mona
<div><br>
<div><span class="m_-7111081432505180086Apple-style-span" style="border-collapse:separate;border-spacing:0px">
<div style="word-wrap:break-word">
<span class="m_-7111081432505180086Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px">
<div style="word-wrap:break-word">
<span class="m_-7111081432505180086Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px">
<div style="word-wrap:break-word">
<span class="m_-7111081432505180086Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px">
<div style="word-wrap:break-word">
<span class="m_-7111081432505180086Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px">
<div style="word-wrap:break-word">
<span class="m_-7111081432505180086Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px">
<div style="word-wrap:break-word">
<span class="m_-7111081432505180086Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px">
<div style="word-wrap:break-word">
<span class="m_-7111081432505180086Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px">
<div style="word-wrap:break-word">
<span class="m_-7111081432505180086Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px">
<div>******************************<wbr>***************</div>
<div>    Mona Wong</div>
<div>    Web & Mobile Application Developer</div>
<div>    San Diego Supercomputer Center</div>
<div><br>
</div>
<div>    Believing we are in control is an</div>
<div>    illusion that brings suffering.</div>
<div>******************************<wbr>***************</div>
<br>
</span></div>
</span></div>
</span></div>
</span></div>
</span></div>
</span></div>
</span><br class="m_-7111081432505180086Apple-interchange-newline">
</div>
</span><br class="m_-7111081432505180086Apple-interchange-newline">
</div>
</span><br class="m_-7111081432505180086Apple-interchange-newline">
<br class="m_-7111081432505180086Apple-interchange-newline">
</div>
<br>
</div>
</div>
</div>

<br>______________________________<wbr>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font color="#0000ff"><font size="4"><font face="garamond, serif">Teresa E. Madsen, PhD</font><br></font><font face="garamond, serif">Research Technical Specialist:  <i>in vivo </i>electrophysiology & data analysis</font></font></div><div dir="ltr"><font color="#0000ff"><font face="garamond, serif">Division of Behavioral Neuroscience and Psychiatric Disorders<br>Yerkes National Primate Research Center</font></font><div><font face="garamond, serif" color="#0000ff">Emory University<br></font><div><font face="garamond, serif" color="#0000ff">Rainnie Lab, NSB 5233<br>954 Gatewood Rd. NE<br>Atlanta, GA 30329</font></div><div><div><font face="garamond, serif" color="#0000ff">(770) 296-9119</font><br></div></div></div><div><font face="garamond, serif" color="#0000ff"><a href="mailto:braingirl@gmail.com" target="_blank">braingirl@gmail.com</a></font></div><div><font face="garamond, serif" color="#0000ff"><div><a href="https://www.linkedin.com/in/temadsen" target="_blank">https://www.linkedin.com/in/temadsen</a></div></font></div></div></div></div></div></div></div>
</div>