# [FieldTrip] Dipole Moment Question from forward simulated data example

Srinivas Kota svkotak at yahoo.com
Tue Mar 22 20:09:06 CET 2016

```I am working on simulated data example provided in the fieldtrip toolbox webpage. When I find the dipole moment after dipole fitting is [-1 0 0], where as original dipole mom was [1 0 0]. I was not sure if I am calculated dipole moment correctly. Any help would be appreciated.Thank you. Srinivas
% http://www.fieldtriptoolbox.org/example/compute_forward_simulated_data_and_apply_a_dipole_fit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % create a set of electrodes, randomly placed on the sphereelec = [];elec.pnt = randn(128,3);dum = sqrt(sum(elec.pnt.^2,2));elec.pnt = elec.pnt ./ [dum dum dum]; % scale them to a unit spherefor i=1:128 elec.label{i} = sprintf('%03d', i);end
vol = [];vol.r = [0.88 0.92 1.00]; % radii of spheresvol.cond = [1 1/80 1]; % conductivityvol.o = [0 0 0]; % center of sphere %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % create a dipole simulation with one dipole and a 10Hz sine wavecfg = [];cfg.vol = vol; % see abovecfg.elec = elec; % see abovecfg.dip.pos = [0 0.5 0.3];cfg.dip.mom = [1 0 0]'; % note, it should be transposedcfg.dip.frequency = 10;cfg.ntrials = 1;cfg.triallength = 1; % secondscfg.fsample = 250; % Hzraw1 = ft_dipolesimulation(cfg);avg1 = ft_timelockanalysis([], raw1);plot(avg1.time, avg1.avg); % plot the timecourse  % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % do a dipole fit of the first simulated datasetcfg = [];cfg.vol = vol; % see abovecfg.elec = elec; % see abovecfg.dip.pos = [0 0 0]; % initial search positioncfg.gridsearch = 'no';dip1 = ft_dipolefitting(cfg, avg1);  [u,s,v] = svd(dip1.dip.mom);  if s(1,1) > s(2,2) dipole_orientation = u(:,1);  end

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160322/ae7c8d9f/attachment-0001.html>
```