My research aims to advance TMS technology through fundamental and experimental research. 

I design and develop algorithms and integrated software and hardware for 

  • neural system modeling and identification
  • closed-loop optimal & controllable transcranial magnetic stimulation (TMS)
  • precision/personalized TMS through selective stimulation 

Non-invasive stimulation of the human brain using transcranial magnetic stimulation (TMS) is an approved therapy for depression and migraine. It also holds promise for treating other psychiatric and neurological disorders, and for studying and enhancing brain functions and cognitive performance.

In TMS, the electric pulse passing through the coil generates a strong and time-varying magnetic field, which induces an electric field in brain tissue. The electric field creates extracellular and intracellular currents that can depolarize (or hyperpolarize) axonal membranes.

Closed-loop automated TMS

It refers to the real-time adjustment of TMS specifications (e.g., pulse parameters and hot-spot) by using the brain/neural data in a feedback system. 

Optimal TMS

It refers to the adjustment of TMS specifications (pulse parameter, coil location, etc.) using optimization algorithms. 

Controllable TMS (cTMS)

In controllable TMS, in addition to the pulse intensity, the pulse width is also adjustable.

Selective neural stimulation

Targeting distinct neuronal populations based on biophysical properties of the axonal membrane (e.g., the membrane time constant) is the topic of selective stimulation, which could be used for precision/personalized TMS therapies. 

My research contributions

  • Modeling of neural system dynamics and input-output curves with TMS and cTMS.
  • Identifiability analysis and optimal estimation of neural system dynamics and input-output curves with closed-loop electromyography-guided (EMG-guided) TMS and cTMS.
  • Optimal tuning of the pulse amplitude and width in closed-loop automated TMS and cTMS.
  • Development of a Matlab-based open-source toolbox, called TMS ioFit, for optimal estimation of input-output curves with closed-loop automated TMS. TMS ioFit also supports the input-output curve estimation by using the conventional uniform sampling method. I developed an integrated hardware and software, and successfully accomplished clinical tests of TMS ioFit, on a healthy human brain, at the non-invasive neuro-stimulation therapies (NINET) laboratory at the Department of Psychiatry, University of British Columbia (UBC). TMS ioFit has been registered as an invention at Duke Office of Licensing and Ventures.


  • SMM Alavi, A Mahdi, F Vila-Rodriguez, SM Goetz, “Identifiability analysis and noninvasive online estimation of the first-order neural activation dynamics in the brain with closed-loop transcranial magnetic stimulation,” IEEE Transactions on Biomedical Engineering, 2023. (In Press) [download]
  • SMM Alavi, F Vila-Rodriguez, A Mahdi, SM Goetz, “Closed-loop optimal and automatic tuning of pulse amplitude and width in EMG-guided controllable transcranial magnetic stimulation,” Biomedical Engineering Letters, 2023. (In Press) [download]
  • SMM Alavi, F Vila-Rodriguez, A Mahdi, SM Goetz, “A formalism for sequential estimation of neural membrane time constant and input–output curve towards selective and closed-loop transcranial magnetic stimulation,” Journal of Neural Engineering, 19(5), 056017, 2022. [Download]
  • SMM Alavi, SM Goetz, M Saif, “Input-Output Slope Curve Estimation in Neural Stimulation Based on Optimal Sampling Principles,” Journal of Neural Engineering, 18(4), 046071, 2021. [Download]
  • SMM Alavi, SM Goetz, AV Peterchev, “Optimal Estimation of Neural Recruitment Curves Using Fisher Information: Application to Transcranial Magnetic Stimulation,” IEEE Transactions on Neural Systems and Rehabilitation Engineering, 27(6), pp. 1320-1330, 2019. [Download]
  • SM Goetz, SMM Alavi, ZD Deng, AV Peterchev, “Statistical Model of Motor Evoked Potentials,” IEEE Transactions on Neural Systems and Rehabilitation Engineering, 27 (8), pp. 1539 – 1545, 2019. [Download]

Invited Talks

Invited Seminar, CardiffMet Pandemic Panels, June 2021
Invited Seminar, K.N. Toosi University of Technology, May 2019

Sample Videos