# [FieldTrip] EEG average

Fereshte fereshte.ramezani at gmail.com
Wed May 16 05:59:29 CEST 2018

```Dear all,
I've solved the forward problem for a FEM head model and as a result,
obtained the lead field matrix. Now I'm going to do the Dipole Fit approch
in order to solve the inverse problem. How can I obtain the ' EEG-avg '
data in the script below which is a part of "
http://www.fieldtriptoolbox.org/workshop/baci2017/inverseproblem" due to
the forward problem once I solved?
Thank you!

EEG_avg

Then we do the dipole fit

% Dipole fit
cfg = [];
cfg.numdipoles    =  1;                             %number of expected
cfg.grid <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/grid.html>
cfg.elec          = elec;                           %the electrode model
cfg.latency       = 0.025;                          %the latency of interest
dipfit_bem        = ft_dipolefitting(cfg,EEG_avg);

dipfit_bem.dip
ans <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/ans.html> =

pos: [13.958237048680118 34.388465910583285 97.809684095994314]
%dipole position
mom: [3x1 double
<http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html>]
%dipole moment
pot: [74x1 double
<http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html>]
%potential at the
electrodes
rv: 0.034549469532012
%residual variance
unit: 'mm'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180516/70b08c71/attachment-0001.html>
```