Learn R Programming

pro (version 0.1.1)

sim.lif: Simulate optogenetic stimulation on a leaky-integrate-fire neuron

Description

Simulate various kinds of neural measures (e.g. membrane potentials and spikes) from a LIF neuron.

Usage

sim.lif(n, I, C, R, Vth = 1, V0 = 0, bin = 5, dt = 0.05)

Arguments

n
Number of time bins. The total time is n times bin.
I
Input stimulus vector of length n.
C
Membrane capacitance of the simulated neuron.
R
Membrane resistance of the simulated neuron.
Vth
Membrane potential threshold for spiking.
V0
Membrane potential reset value after spiking.
bin
Time length for each time bin. Default 5 millisecond.
dt
Time length for each simulation step. Default 0.05 millisecond.

Value

a list of simulated neural spikes, optogenetic light flashes, and simulation parameters.

Examples

Run this code
n<- 500
set.seed(100)
re <- sim.lif(n, rbinom(n, 1, 0.14), 7, 3)

Run the code above in your browser using DataLab