import numpy as np
import matplotlib.pyplot as plt
Model and simulation parameters for three response dynamics:
x = 5
y = 140
titles = ['Regular Spiking', 'Chattering', 'Fast spiking']
a = [0.02, 0.02, 0.1]
b = [0.2 , 0.2 , 0.2]
c = [-65, -50 , -65]
d = [8 , 2 , 2 ]
v0 = -70 # Resting potential [mV]
T = 200 # Simulation time [mSec]
dt = 0.25 # Simulation time interval [mSec]
time = np.arange(0, T + dt, dt) # Time array
Defining the stimulus (a step function):
stim = np.zeros(len(time))
for i,t in enumerate(stim):
if i > 20:
stim[i] = 15
Simulating:
trace = np.zeros((2,len(time))) # Tracing du and dv
for exp in range(len(a)):
v = v0
u = b[exp]*v
spikes = []
for i, j in enumerate(stim):
v += dt * (0.04*v**2 + x*v + y - u + stim[i])
u += dt * a[exp]*(b[exp]*v-u)
if v > 30:
trace[0,i] = 30
v = c[exp]
u += d[exp]
else:
trace[0,i] = v
trace[1,i] = u