This tutorial describes how to simulate an integrate-and-fire neuron in Matlab.
The leaky integrate and fire model is a simple description of a neuron. Real neurons have a membrane and several families of ion channels that control the flow of current across the membrane, which in turn modulates the membrane potential in complex ways, including the firing of action potentials. Further, real neurons have considerable spatial structure, and different areas of the cell could in principle behave differently.
The leaky integrate-and-fire model incorporates only 4 simple features:
The equation that describes how the voltage of the cell Vm changes over time in the face of an externally-applied membrane current Im is as follows:
Multiplying by the membrane resistance Rm, and defining the time constant Tau_m = Cm * Rm, the function is a bit easier to read:
or even easier:
So Ve, tau_m, and Rm, Vth, and Vreset are taken to be intrinsic properties of the cell, and Im is the external current that can vary depending upon experimenter input or synaptic input, and Vm is the membrane potential which varies indirectly according to the equation above.
We can use the Euler method to simulate the behavior of the equation for discrete steps in time (see Numerical Recipes, Press et al.). Thanks to Paul Miller for reference and equations.
Suppose our time step is ∆t. Since
So the overall behavior of the model is as follows:
If Vm(t) > V_th,
Rm = 10e6; % membrane resistance
tau_m = 10e-3; % membrane time constant
Can you write a function that simulates a current injection of 5nA for 1 seconds? Use a dt of 0.0002 seconds.
Here it is: