Simulation of eeg source

Hi all

I am beginner in brainstorm

My question is this.
I need to simulate an outbreak of electrical activity in a realistic head model, and acquire the EEG tracing the source (focus) dummy. The aim is to build different head models, and compare the error to locate the source you have simulated, but for this I need the layout or activity of the simulated source.

Any information is helpful.

Anyone know how to simulate a realistic source model?, And acquire their electrical activity?

Thanks regards


Start by reading and following in details the 12+3 introduction tutorials, then the tutorial “EEG/Epilepsy”.
The last one will show you how to use OpenMEEG in Brainstorm to calculate a realistic BEM model.

Then you can easily generate source signals, use them to simulate EEG recordings, then re-calculate the sources:

  • To simulate signals, use the processes in the “Simulate” menu (leave the Process1 box empty and click on “Run”)
  • Then create a number of scouts that match the number of signals you have generated
  • Run the process “Simulate > Simulate recordings from scouts”



I am having some difficulty following these directions. I had the BEM model already, and then simulated some signals, which look OK. I would like to use the Des-Kil atlas and ROI set, with 68 scouts, so I modified the simulated file in Matlab and wrote it back out, and it looks OK. But then I cannot figure out how to asociate this set of simulations with the Des-Kil scouts. When I run “simulate from scouts” it says there are no scouts, though I have displayed the cortex with the Des-Kil ROIs.


Hi Jeff,

To see a list of scouts in the options of the process “Simulate > Simulate recordings from scouts” you need the default cortex to have the correct atlas selected.
Go to the anatomy view of your protocol, make sure that the correct cortex is set as the default one (displayed in green), double click on it.
In the Scout tab, select the correct atlas, then close the figure. The new atlas selection will not be visible in the process options until you close all the views on this surface (you should see a message “BST> Saving scouts in surface” in your command window).


Hi Francois,

I got further along, but ran into a problem creating the BEM surfaces. It appears that the initial simulation process automatically creates a Test subject, and I could not figure out how to transfer the time series to an existing subject. So I added the Colin27 anatomy to the Test subject, imported the EGI 257-channel sfp file, and tried to create the BEM surfaces. I got this error:

I guess this is a function from the Optimization Toolbox, which I do not have on this particular Matlab installation. Is there a substitute for fminsearch?


Hi Jeff,

The function fminsearch has been part of the basic Matlab language at least since 2004 (not in an additional toolbox).
Error messages related to this function are usually due to another version of this function in the path (coming from FieldTrip, EEGLAB, SPM, or another toolbox).
Check your path, type “which fminsearch” to see which one is executed.


Hi all

I have generated my model from the resonance following steps tutorial Epilepsy EEG. However, I wonder what will happen to the noise covariance matrix, since in this tutorial is generated from the signals. However, I have no signal, and what I want is to simulate EEG signal (dipole). How do I generate?

Also I would like to know a little more detail as to simulate the source, or to give me a little more detailed the steps.



I am on another system now and cannot check the fminsearch issue because I cannot get back to that point. I thought I was able to generate simulated EEG data and then add in an MRI, but I am getting errors trying to do that now on my current computer. How do I either a) add simulated data to an existing subject, or b) add an MRI to a subject created during the EEG simulation (which creates subject “Test”).


The minimum norm solutions (and its normalized versions dSPM and sLORETA) are highly dependent on what is used as the noise covariance matrix.
In simulations, it is tricky to define what the instrumental noise is. One solution is to calculate this noise covariance on some real EEG recordings you are trying to mimic. Another option is to leave you model uninformed about the noise (identity matrix).
More information about those options at the end of this tutorial:

Note that if you create your own source matrix (setting manually the field ImageGridAmp) and use it to generate simulated EEG signals, you don’t need to define any realistic noise covariance matrix. It is used only when computing the inverse kernel.

a) Please be more specific: what errors? what are you simulating? how? using what menus? what do you mean by “add simulated data to a subject”?
b) You can change the name of the subject in the process options of the process to generate the new files in an existing subject.
If not, you can import the anatomy of the subject just like any other subject you would create (right-click > Import anatomy). You can also copy-paste the MRI + surfaces from another existing subject
To change the subject configuration (use the protocol’s default anatomy or not): right-click on the subject folder > Edit subject (or double-click).