<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=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
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 lang="NL" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Dear fieldtrippers, <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB">I am doing a sanity check on the implementation of the MUSIC algorithm in fieldtrip, before applying it in real data.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">So after creating simulation data with sinusoids at a specific location and adding relative noise of 1.5,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I am doing a music scan with the number of components as 1.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">The code for that is below (I used filedtrip version fieldtrip-20160101):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%% leadfield should be generated for specific EEG signal</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">addpath([ft_path,</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'fileio\'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">]);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">addpath ([ft_path,</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'template\electrode\'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">]);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">addpath ([ft_path,</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'template\headmodel\'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">]);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%% LOAD VOL ELEC MRI
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">% load electrode locations</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">elec=ft_read_sens(</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'standard_1020.elc'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">% load mri & vol (template)</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">load(</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'standard_mri.mat'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">);
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%units in mm</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">load(</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'standard_bem'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%% adjust electrode locations for 62 channels eeg</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black">elec.label=upper(elec.label);</span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black">load([gendir
</span><span style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'label_62.mat'</span><span style="font-size:9.0pt;font-family:"Courier New";color:black">],
</span><span style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'label_62'</span><span style="font-size:9.0pt;font-family:"Courier New";color:black">);</span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black">EEG.label=label_62;</span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black">label_signal=upper(EEG.label);</span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black">EEG.label=upper(EEG.label);</span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">elec2find=zeros(length(label_signal),1);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:blue">for</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"> i=1:length(label_signal);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">elec2find(i,1)=find(strcmp(label_signal(i),elec.label));</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:blue">end</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">% elec with 62 locations based on SEP signal</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">elec.chanpos=elec.chanpos((elec2find), :);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">elec.elecpos=elec.elecpos((elec2find), :);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">elec.label=elec.label((elec2find));</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black">elec.label=upper(elec.label);</span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">% align elecs on vol if needed</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen"></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg = [];</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.method =
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'interactive'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.elec = elec;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.headshape = vol.bnd(1);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">elec_aligned = ft_electroderealign(cfg);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%% compute leadfield</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg = [];</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.elec =elec_aligned;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.channel = EEG.label;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%
or common_channels_;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.reducerank = 3;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.headmodel = vol;
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">% volume conduction headmodel</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.normalize =
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'yes'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">;
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.grid.unit =
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'mm'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.grid.resolution = 5;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">leadfield = ft_prepare_leadfield(cfg, EEG);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"> </span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%% simulate EEG data, dipole in specific location</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black">loc1=[-30, -11, 65 ];</span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black">cfg = [];</span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.headmodel = vol ;
</span><span style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.elec = elec_aligned;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.fsample = 1024;
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">% Hz</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.dip.amplitude=[1];</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.dip.phase=[1];
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.dip.pos(1,:) = loc1;
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.dip.mom(:,1) = [1 0 0]';
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.ntrials=500;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.triallength= 0.250;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.fsample=1024;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.relnoise = 1.5;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">epoch = ft_dipolesimulation(cfg);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%% compute averaged dataset with covariance matrix</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg=[];</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">% cfg.covariance='yes';</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">avg = ft_timelockanalysis(cfg, epoch);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%%</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen"></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg = [];</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.method =
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'music'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.grid = load([gendir
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'leadfield_templ.mat'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">]);
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">% leadfield, which has the grid information</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.headmodel = load([gendir
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'vol_temp.mat'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">]);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%
volume conduction model (headmodel)</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.elec = load([gendir
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:#A020F0">'elec_temp.mat'</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">]);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.channel = avg.label;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">cfg.music.numcomponent= 1;</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">source_music = ft_sourceanalysis(cfg, avg);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"></span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">%%</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">pos_max = zeros(1,3);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">[~,k]=max(source.avg.jr);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="FR" style="font-size:9.0pt;font-family:"Courier New";color:black">[~,l]=min(source.avg.jr);</span><span lang="FR" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">music_max = source.pos(k, :);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">music_min = source.pos(l, :);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:12.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:12.0pt;color:black">First of all the code in music.m will only work if you change line 77 and 78 with the following lines:
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:forestgreen">% select only the dipole positions inside the brain for scanning
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">dip.inside = find(dip.inside==1);</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="FR" style="font-size:9.0pt;font-family:"Courier New";color:black">dip.pos = dip.pos(dip.inside,:);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="FR" style="font-size:12.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:12.0pt;color:black">and line 103 with this</span><span lang="EN-GB" style="font-size:12.0pt;font-family:"Courier New";color:black">
</span><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black">lf = dip.leadfield{dip.inside(i)};<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="color:black">Otherwise it was not possible since the lf contained both the points inside and outside the brain<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="color:black">But even after changing those lines both the minimum and the maximum of the music metric are not the original location.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="color:black">Original location was [-30, -11, 65 ] and minimum music metric gives [</span><span lang="EN-GB">-55, -15, 58] while
<span style="color:black">maximum music metric gives [</span>50, -20, 8].<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB">The same location repeats with both using the covariance matrix as an input in music or not and also by changing the relative noise to 0.5 instead of 1.5.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB">Does someone run into the same type of problems with music?<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB">Thanks in advance for your help.</span><span lang="EN-GB"><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"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-GB" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL">K. (Nadia) Kalogianni</span></b><span lang="EN-GB" style="font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL">PhD candidate</span><span lang="EN-GB" style="font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-GB" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL">T</span></b><b><span lang="EN-GB" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:#2298FF;mso-fareast-language:NL">U
</span></b><b><span lang="EN-GB" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL">Delft /</span></b><b><span lang="EN-GB" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL">Department
of Biomechanical Engneering<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span lang="EN-GB" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL">Neuromuscular Control Laboratory<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span lang="EN-GB" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL"><br>
</span></b><span lang="EN-GB" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL">Mekelweg 2<br>
2628 CD Delft<br>
</span><span lang="EN-GB" style="font-family:"Tahoma","sans-serif";color:#00B0F0;mso-fareast-language:NL">Room: F-1-320</span><span lang="DE" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:#2298FF;mso-fareast-language:NL"><br>
T </span><span lang="EN-GB" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;background:white;mso-fareast-language:NL">+31 15-27 84230</span><span lang="DE" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL"><br>
</span><span lang="DE" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:#2298FF;mso-fareast-language:NL">E</span><span lang="DE" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:NL">
</span><span lang="EN-GB" style="font-size:8.5pt;font-family:"Tahoma","sans-serif";color:black;background:white;mso-fareast-language:NL"> </span><span lang="EN-GB" style="font-family:"Tahoma","sans-serif";mso-fareast-language:NL">k.kalogianni@tudelft.nl<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
</div>
</body>
</html>