<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Times New Roman \,serif";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
p.HTML, li.HTML, div.HTML
        {mso-style-name:"HTML \9884\8BBE\683C\5F0F";
        mso-style-link:"HTML \9884\8BBE\683C\5F0F Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
span.HTMLChar
        {mso-style-name:"HTML \9884\8BBE\683C\5F0F Char";
        mso-style-priority:99;
        mso-style-link:"HTML \9884\8BBE\683C\5F0F";
        font-family:Consolas;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle24
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>oh and another thing: in FieldTrip, detrending inherently also demeans, or in other words, if the fitted first order polynomial is removed, also the zeroth order polynomial is.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div><p class=MsoNormal><b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264;mso-fareast-language:NL'>--<o:p></o:p></span></b></p><p class=MsoNormal><b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255A9E;mso-fareast-language:NL'><o:p> </o:p></span></b></p><p class=MsoNormal><b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255A9E;mso-fareast-language:NL'>Jörn M. Horschig</span></b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264;mso-fareast-language:NL'>, Software Engineer</span><b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif;mso-fareast-language:NL'><o:p></o:p></span></b></p><p class=MsoNormal><span lang=NL style='font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264;mso-fareast-language:NL'><a href="http://www.artinis.com/"><span lang=EN-US style='color:#626264'>Artinis Medical Systems</span></a></span><span style='font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264;mso-fareast-language:NL'>  |  +31 481 350 980 </span><b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255A9E;mso-fareast-language:NL'><o:p></o:p></span></b></p></div><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='color:windowtext'>From:</span></b><span style='color:windowtext'> fieldtrip-bounces@science.ru.nl [mailto:fieldtrip-bounces@science.ru.nl] <b>On Behalf Of </b>Yun Wen<br><b>Sent:</b> Sunday, December 7, 2014 11:53 AM<br><b>To:</b> FieldTrip discussion list<br><b>Subject:</b> Re: [FieldTrip] about detrend<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Hi, Alexander. Thank you for your help. Do you suggest that I do baseline correction plus detrend, e,g,  cfg.blc = 'yes' & cfg.detrend = 'yes' on epoched data? <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Best,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Yun<o:p></o:p></span></p><div><p class=MsoNormal style='text-align:justify'><span lang=EN-GB style='font-size:10.5pt;color:#1F497D'><o:p> </o:p></span></p></div><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span lang=EN-GB style='color:windowtext'>From:</span></b><span lang=EN-GB style='color:windowtext'> <a href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a> [<a href="mailto:fieldtrip-bounces@science.ru.nl">mailto:fieldtrip-bounces@science.ru.nl</a>] <b>On Behalf Of </b>Alexander Nakhnikian<br><b>Sent:</b> Saturday, December 06, 2014 1:14 AM<br><b>To:</b> FieldTrip discussion list<br><b>Subject:</b> Re: [FieldTrip] about detrend<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><div><p class=MsoNormal><span lang=EN-GB>It looks as though the take home message is that in theory high pass filters remove DC but you can't be sure how they will interact with empirical data since there is no perfect filter in the real world.  If other people report substantial artifacts after filtering data without removing the DC component I suggest getting rid of it.  To answer your original question, assuming you're detrending each epoch individually it should remove the DC component or at least reduce it substantially.   <br><br>I hope that helps.<br><br><br><br>On 12/5/14, 6:20 PM, Yun Wen wrote:</span><span lang=EN-GB style='font-size:12.0pt'><o:p></o:p></span></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Hi, Alexander & Rodrigo. Thank you very much for your help. I collected my data with DC recordings (BioSemi system). I have seen some discussion on the DC offset:</span><span lang=EN-GB><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><a href="http://sccn.ucsd.edu/pipermail/eeglablist/2014/008068.html">http://sccn.ucsd.edu/pipermail/eeglablist/2014/008068.html</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><a href="http://sccn.ucsd.edu/pipermail/eeglablist/2008/002229.html">http://sccn.ucsd.edu/pipermail/eeglablist/2008/002229.html</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><a href="http://sccn.ucsd.edu/pipermail/eeglablist/2010/003315.html">http://sccn.ucsd.edu/pipermail/eeglablist/2010/003315.html</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><a href="http://erpinfo.org/erplab/erplab-documentation/manual/Filtering.html">http://erpinfo.org/erplab/erplab-documentation/manual/Filtering.html</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'> </span><span lang=EN-GB><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>It seems to me that I’d better remove DC offset of continuous data before high-pass filter. Am I right?</span><span lang=EN-GB><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Best,</span><span lang=EN-GB><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Yun</span><span lang=EN-GB><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'> </span><span lang=EN-GB><o:p></o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span lang=EN-GB style='color:windowtext'>From:</span></b><span lang=EN-GB style='color:windowtext'> </span><span lang=EN-GB><a href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a></span><span lang=EN-GB style='color:windowtext'> [</span><span lang=EN-GB><a href="mailto:fieldtrip-bounces@science.ru.nl">mailto:fieldtrip-bounces@science.ru.nl</a></span><span lang=EN-GB style='color:windowtext'>] <b>On Behalf Of </b>Alexander Nakhnikian<br><b>Sent:</b> Friday, December 05, 2014 10:19 PM<br><b>To:</b> FieldTrip discussion list<br><b>Subject:</b> Re: [FieldTrip] about detrend</span><span lang=EN-GB><o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-GB> <o:p></o:p></span></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-GB>Hello Again,<br><br>I think there's an error in my response. I think removing the linear trend should also set the mean to zero already since the best fit line incorporates vertical offset.  Sorry about that.  <br><br>A<br><br><o:p></o:p></span></p><pre><span lang=EN-GB> <o:p></o:p></span></pre><p class=MsoNormal><span lang=EN-GB>On 12/5/14, 4:20 PM, Yun Wen wrote:<o:p></o:p></span></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span lang=EN-GB>Hi all, I want to remove DC offset before applying the high-pass filter. I  was wondering if I can achieve that by putting cfg.detrend = 'yes' before cfg.hpfilter = 'yes', something like:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>cfg = []; <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>cfg.dataset = filename_raweeg;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>cfg.detrend = 'yes'; <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>cfg.hpfilter = 'yes';<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>cfg.hpfiltord = 2; % Order of the filter = 2.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>cfg.hpfreq = 0.1; % High-pass cutoff at 0.1 Hz;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>[data] = ft_preprocessing (cfg);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>Thank you in advance.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>Best,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>Yun<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB> <o:p></o:p></span></p><pre><span lang=EN-GB> <o:p></o:p></span></pre><pre><span lang=EN-GB> <o:p></o:p></span></pre><pre><span lang=EN-GB>This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<o:p></o:p></span></pre><pre><span lang=EN-GB> <o:p></o:p></span></pre><pre><span lang=EN-GB>This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.<o:p></o:p></span></pre></blockquote><p class=MsoNormal><span lang=EN-GB style='font-size:12.0pt;font-family:"Times New Roman \,serif"'> </span><span lang=EN-GB><o:p></o:p></span></p><pre><span lang=EN-GB><o:p> </o:p></span></pre><pre><span lang=EN-GB><o:p> </o:p></span></pre><pre><span lang=EN-GB>This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<o:p></o:p></span></pre><pre><span lang=EN-GB><o:p> </o:p></span></pre><pre><span lang=EN-GB>This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.<o:p></o:p></span></pre></blockquote><p class=MsoNormal><span lang=EN-GB style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><pre><span lang=EN-GB><o:p> </o:p></span></pre><pre><span lang=EN-GB><o:p> </o:p></span></pre><pre><span lang=EN-GB><o:p> </o:p></span></pre><pre><span lang=EN-GB>This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<o:p></o:p></span></pre><pre><span lang=EN-GB><o:p> </o:p></span></pre><pre><span lang=EN-GB>This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.<o:p></o:p></span></pre></div></div></body></html>