-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathizh.jl
37 lines (33 loc) · 855 Bytes
/
izh.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Izhikevich model
## Adapted from code for Figure 1 of 2004 paper
## available at http://www.izhikevich.org/publications/figure1.m
using Plots
function izh(;a=0.02,b=0.2, c=-65.0, d=6.0)
#a=0.02; b=0.2; c=-65; d=6;
V=-70; u=b*V;
VV=[]; uu=[];
tau = 0.25; tspan = 0:tau:100;
T1=tspan[end]/10;
for t=tspan
if (t>T1)
I=14;
else
I=0;
end;
V = V + tau*(0.04*V^2+5*V+140-u+I);
u = u + tau*a*(b*V-u);
if V > 30
push!(VV,30);
V = c;
u = u + d;
else
push!(VV,V);
end;
push!(uu,u);
end;
plot(tspan,VV, title="(A) tonic spiking",
legend=false,
xlims=(0, tspan[end]), ylims=(-90,30));
plot!([0,T1,T1,tspan[end]],-90.0 .+ [0,0,10,10])
end
##savefig("izhplot")