In finding an optimal stimulus waveform for inducing switches in neuronal states, analytical techniques from optimal control theory are often found to be difficult to use or extremely time intensive. Here, we present the code for a gradient-based algorithm approach that has been used to find energetically optimal stimulus waveforms to trigger an action potential in the Hodgkin-Huxley model as well as initiating and repressing repetitive firing in the FitzHugh-Nagumo models. These two models serve just as examples and the code can be easily adapted to any other system.
This work was presented in:
Chang J, Paydarfar D (2014) Switching neuronal state: optimal stimuli revealed using a stochastically-seeded gradient algorithm. J Comput Neurosci.