dipole search Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 % dipole search 0002 % 0003 % Copyright (C) 2011, ATR All Rights Reserved. 0004 % License : New BSD License(see VBMEG_LICENSE.txt) 0005 clear all 0006 0007 proj_root = 'D:\MatData\hand_move'; 0008 0009 dipole_parm.megfile = 'main_artifact.meg.mat'; 0010 dipole_parm.twin_meg = []; % Time window for analysis 0011 0012 %dipole_parm.megfile = 'move_artifact.meg.mat'; 0013 %dipole_parm.twin_meg = [200, 500]; % Time window for analysis 0014 0015 dipole_parm.errfunc = 0; 0016 % dipole_parm.errfunc = Error function mode for dipole search 0017 % = 0 : 'vb_dipole_error': for external current (Biot-Savart Eq.) 0018 % = 1 : 'vb_dipole_error_sarvas': for cortical current (Sarvas Eq.) 0019 % = 2 : 'vb_dipole_error_magdipole': for coil current (magnetic dipole) 0020 0021 % # of search trial 0022 Ntrial = 20; 0023 0024 % Initial dipole position 0025 %Vinit = [0 0 -1; 0 0 -1]; 0026 Vinit = [0 0 -1]; 0027 0028 Ndipole = size(Vinit,1); 0029 errmin = realmax; 0030 0031 for n=1:Ntrial 0032 dipole_parm.Vinit = Vinit + rand(Ndipole,3); 0033 0034 [X,J,err] = vb_job_dipole(proj_root, dipole_parm); 0035 0036 fprintf('Error = %f\n',err) 0037 0038 if err < errmin, 0039 errmin = err; 0040 Vdipole = X; 0041 end; 0042 end