# [FieldTrip] dipolefitting issues

Nathan Weisz nathanweisz at mac.com
Wed Feb 9 21:25:42 CET 2011

```hi everyone,

i'm trying to help out a colleague who is trying to analyse some auditory evoked potential (EEG) data and for the research question at hand it would be nice to separate left vs. right hemisphere. we want to keep things simple first by fitting symmetric dipoles to e.g. the N1 and then use the positions to estimate the dipole moments for the entire ERP. the ERP that we want to build the source montage on is calculated from ~600 trials, i.e. we see what we need to see very nicely.

we are using a spherical headmodel (electrode positions also on sphere) as described on the FT homepage:
vol = [];
vol.r = [0.88 0.92 1.00]; % radii of spheres
vol.c = [1 1/80 1];       % conductivity
vol.o = [0 0 0];

using a precomputed leadfield i the turn to ft_dipolefitting:
cfg      = [];
cfg.vol  = vol;         % see above
cfg.elec = data.elec;        % see above
cfg.gridsearch = 'yes';
cfg.numdipoles=2;
cfg.symmetry='y'; %nach den elec.pnt sieht es so aus als wäre y links / rechts
cfg.grid=lf;
cfg.latency=[.05 .1];

dip1 = ft_dipolefitting(cfg, avgbl);

i get following message:
...
> scanning grid location 279/280
> scanning grid location 280/280
> found minimum after scanning on grid point [-0.111111 0.111111 0.111111; -0.111111 -0.111111 0.111111]
>                                                         First-order
>  Iteration  Func-count       f(x)        Step-size       optimality
>      0           4        0.0406088                           0.5
>
> Local minimum possible.
>
> fminunc stopped because it cannot decrease the objective function
> along the current search direction.
>
> <stopping criteria details>
>
> found minimum after non-linear optimization on [-0.111111 0.111111 -0.111111; -0.111111 -0.111111 -0.111111]

i then ran the tutorial example here:
http://fieldtrip.fcdonders.nl/example/compute_forward_simulated_data_and_apply_a_dipole_fit
just to check if there may be something fundamentally wrong with my code.

however i get a similar message suggesting something went wrong:
> scanning grid location 26/27
> scanning grid location 27/27
> found minimum after scanning on grid point [0 0.5 0.5]
>                                                         First-order
>  Iteration  Func-count       f(x)        Step-size       optimality
>      0           4        0.0293345                         0.303
>      1           8        0.0079586              1           0.15
>      2          12      5.63895e-05              1         0.0138
>      3          16      5.75471e-06              1        0.00446
>      4          20      8.86701e-11              1       1.33e-05
>      5          24      1.45576e-14              1        1.3e-07
>      6          28      1.75862e-16              1       2.61e-08
>
> Local minimum possible.
>
> fminunc stopped because the size of the current step is less than
> the default value of the step size tolerance.
>
> <stopping criteria details>
>
> found minimum after non-linear optimization on [-5.08281e-09 0.5 0.3]

I am using Matlab 2010b. a fairly recent fieldtrip (~3 months old or so).

there was a similar question on the archives, however i found no answer:
http://mailman.science.ru.nl/pipermail/fieldtrip/2010-May/002874.html

is this an issue related to the matlab version and the fminunc function?

i would be grateful about any suggestion.

cheers,
nathan

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