[FieldTrip] Fitting dipole to a topography: objective function is undefined at initial point

Robert Oostenveld r.oostenveld at donders.ru.nl
Wed Sep 2 14:16:23 CEST 2015

Hi Ksenia,

The message "Objective function is undefined at initial point” is not something from FieldTrip, but from MATLAB itself. Hence it also suggests that there is an underlying problem and not per see an issue with the organization of the data structures. 

I suggest you do “dbstop if error” on the command line, then start the call to ft_dipolefitting again and use the MATLAB debugger to further identify the cause of the error.

If that fails to provide additional insights, you could add 
cfg.debug = ‘saveonerror’ 
and share the matlab file that will be created on the detection of the error (http://www.fieldtriptoolbox.org/faq/how_should_i_send_example_data_to_the_developers).


On 01 Sep 2015, at 12:54, Ksenia Volkova <voxxys at gmail.com> wrote:

> Dear fieldtrip users,
> I have encountered a problem getting dipole fit to a topography observed on consecutive time points. I have attempted to format the data appropriately (Tzvetan, thank you for your help!), but the call to ft_dipolefitting function returns the "Objective function is undefined at initial point" error both during gridsearch and nonlinear search. What could be the cause of such behavior? Could it be that electrode coordinates are somehow in a wrong format (I have taken mine from an eeglab dataset) or would they anyway be projected onto head surface and cause wrong results, but not an error?
> Thank you in advance for any help.
> Ksenia Volkova
> Dear Ksenia,
> I would first start with the organization of the data in a format FieldTrip can sense.
> data = [];
> data.trial ={[chan x time]} % this is your elec x topography matrix, where topography is observed on consecutive time points
> data.time = [vector-number of time points];
> data.label = {?elec1?,?elec2? etc.} your electrode labels
> data.elec = this is key reflecting the position of the electrodes relative to the head
> Next, you have to compute a volume conduction model. How to do so is explained here: http://www.fieldtriptoolbox.org/tutorial/headmodel_eeg?s[]=eeg&s[]=volume&s[]=conduction&s[]=model
> After this you can proceed with the dipole fitting which is explained for instance here: http://www.fieldtriptoolbox.org/tutorial/natmeg/dipolefitting#fit_a_dipole_model_to_the_meg_data
> Under cfg.latency you could specify the number of the topography you are interested in and under cfg.vol the BEM model you computed in the previous step. If you don#t have individual MRI
> you can use the standard BEM model located in the ~template/headmodel/standard_bem.mat. Note that before you do so you should coregister the headmodel with the electrodes using
> ft_electroderealign.
> Good luck
> tzvetan
> > Dear fieldtrip users,
> >
> > I wonder if you can help me out. I have a relatively simple problem: having a topography matrix (where rows correspond to topographies, and columns correspond to channels) I want to fit a dipole to each topography. I have looked through tutorials and documentation and I've seen this example http://www.fieldtriptoolbox.org/example/compute_forward_simulated_data_and_apply_a_dipole_fit. Still, I can't figure out how I should use the toolbox to solve my problem.
> >
> > What would be the right arguments to call ft_dipolefitting with in my case? If I have EEG data, topography matrix and channel locations, what would be the easiest way to fit a dipole to each topography?
> >
> > Thank you in advance for any help.
> >
> > Ksenia Volkova
> > _______________________________________________
> > fieldtrip mailing list
> > fieldtrip at donders.ru.nl
> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150902/109069e2/attachment-0002.html>

More information about the fieldtrip mailing list