-
Notifications
You must be signed in to change notification settings - Fork 0
/
MorrisLecarModel.cpp
135 lines (117 loc) · 2.7 KB
/
MorrisLecarModel.cpp
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include "stdafx.h"
#include "MorrisLecarModel.h"
#include "Network.h"
const double C=20.0;
const double gK=8.0;
const double gL=2.0;
const double VK=-84.0;
const double VCa=120.0;
const double VL=-60.0;
const double V1=-1.2;
const double V2=18.0;
MorrisLecar::MorrisLecar():No(0){
set_class1();
SetI(39.7);//=39.7;
}
MorrisLecar::MorrisLecar(const int&_No,bool _Is1Class,bool _IsResting):No(_No){
if(_Is1Class){
set_class1();
if(_IsResting) SetI(39.7);//=39.7;//just above Bifurcation point
else SetI(42.0);//I=42.0;//Never happen
}
else{
set_class2();
if(_IsResting) SetI(88.1);//=88.1;//88.1;
else SetI(95.0);//=95.0;//88.1;//just above Bifurcation point
}
}
MorrisLecar::~MorrisLecar(){}
void MorrisLecar::equation(){
DV=(I-gL*(V-VL)-gCa*0.5*(1+tanh((V-V1)/V2))*(V-VCa)-gK*n*(V-VK))/C;
Dn=(0.5*(1+tanh((V-V3)/V4))-n)*phi*cosh((V-V3)/(2*V4));
}
/*void MorrisLecar::equation(){
DV=(I-gL*(V-VL)-gCa*0.5*(1+tanh((V-V1)/V2))*(V-VCa)-gK*n*(V-VK)+Network::CoupleVector[No])/C+Network::NoiseVector[No];
Dn=(0.5*(1+tanh((V-V3)/V4))-n)*phi*cosh((V-V3)/(2*V4));
}*/
void MorrisLecar::euler_s(){
equation();
V+=DV*single_dt;
n+=Dn*single_dt;
}
void MorrisLecar::euler(){
equation();
V+=(DV+Network::sm_gCouple[No]/C+Network::sm_gNoise[No])*Network::sm_dt;
n+=Dn*Network::sm_dt;
}
void MorrisLecar::rungekutta_s(){
V0=V;
n0=n;
equation();
DV1=DV*single_dt;
Dn1=Dn*single_dt;
V=V0+DV1/2.0;
n=n0+Dn1/2.0;
equation();
DV2=DV*single_dt;
Dn2=Dn*single_dt;
V=V0+DV2/2.0;
n=n0+Dn2/2.0;
equation();
DV3=DV*single_dt;
Dn3=Dn*single_dt;
V=V0+DV3;
n=n0+Dn3;
equation();
DV4=DV*single_dt;
Dn4=Dn*single_dt;
V=V0+(DV1+2.0*DV2+2.0*DV3+DV4)/6.0;
n=n0+(Dn1+2.0*Dn2+2.0*Dn3+Dn4)/6.0;
}
void MorrisLecar::rungekutta(){
V0=V;
n0=n;
double CouplePlusNoise=Network::sm_gCouple[No]/C+Network::sm_gNoise[No];
equation();
DV1=(DV+CouplePlusNoise)*Network::sm_dt;
Dn1=Dn*Network::sm_dt;
V=V0+DV1/2.0;
n=n0+Dn1/2.0;
equation();
DV2=(DV+CouplePlusNoise)*Network::sm_dt;
Dn2=Dn*Network::sm_dt;
V=V0+DV2/2.0;
n=n0+Dn2/2.0;
equation();
DV3=(DV+CouplePlusNoise)*Network::sm_dt;
Dn3=Dn*Network::sm_dt;
V=V0+DV3;
n=n0+Dn3;
equation();
DV4=(DV+CouplePlusNoise)*Network::sm_dt;
Dn4=Dn*Network::sm_dt;
V=V0+(DV1+2.0*DV2+2.0*DV3+DV4)/6.0;
n=n0+(Dn1+2.0*Dn2+2.0*Dn3+Dn4)/6.0;
}
void MorrisLecar::InitVar(){
V=4.583345;//-40.0;
n=0.29891089;//0.0;
}
void MorrisLecar::RandVar(){
V=-10+30.0*rand()/(double)RAND_MAX;
n=0.1+0.5*rand()/(double)RAND_MAX;
}
void MorrisLecar::set_class1(){
gCa=4.0;
V3=12.0;
V4=17.40;
phi=1.0/15.0;
strcpy_s(neuron_model,"MorrisLecar1");
}
void MorrisLecar::set_class2(){
gCa=4.4;
V3=2;
V4=30;
phi=0.04;
strcpy_s(neuron_model,"MorrisLecar2");
}