Matlab code to perform EEG-guided optimization of tDCS.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
external Add files via upload Jun 15, 2017
generateFigure.m Add files via upload Jun 15, 2017
regInv.m Add files via upload Jun 15, 2017
tibshirani.m Add files via upload Jun 15, 2017
topoplot_dc.m Add files via upload Jun 15, 2017

Reciprocity Toolbox

This Matlab toolbox provides a set of functions to implement EEG-informed optimization of the tDCS montage, as described in:

Dmochowski, J. P., Koessler, L., Norcia, A. M., Bikson, M., & Parra, L. C. (2017). Optimal use of EEG recordings to target active brain areas with transcranial electrical stimulation. NeuroImage.

The best place to start is generateFigure.m, which demonstrates the usage of the core functions:

  • reciprocate.m (unconstrained reciprocity)
  • tibshirani.m (L^1 constrained reciprocity)

while also generating Figure 3 of the manuscript.


  • you must have the EEGLAB function topoplot, and its dependencies on your system, in order to visualize the resulting montage.
  • NB: EEGLAB is not required to implement reciprocity, but rather to visualize its results on the scalp.

To solve the L^1 constrained least squares problem, we implemented the technique described in:

Tibshirani, R. (1996). Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society. Series B (Methodological), 267-288.

Any questions, comments, or bug reports should be directed to Jacek Dmochowski (