-
Notifications
You must be signed in to change notification settings - Fork 1
/
myutils.c
85 lines (68 loc) · 1.16 KB
/
myutils.c
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
#include "header.h"
double alpha_n(double V)
{
return -0.01*(V+34.0)/(exp(-0.1*(V+34.0))-1.0);
}
double beta_n(double V)
{
return 0.125*exp(-(V+44.0)/25.0);
}
double n_inf(double V)
{
return alpha_n(V)/(alpha_n(V)+beta_n(V));
}
double alpha_m(double V)
{
return -0.1*(V+33.0)/(exp(-0.1*(V+33.0)) - 1.0);
}
double beta_m(double V)
{
return 4.0*exp(-(V+58.0)/12.0);
}
double m_inf(double V)
{
return alpha_m(V)/(alpha_m(V)+beta_m(V));
}
double alpha_h(double V)
{
return 0.07*exp(-(V+50.0)/10.0);
}
double beta_h(double V)
{
return 1.0/(exp(-0.1*(V+20.0))+1.0);
}
double h_inf(double V)
{
return alpha_h(V)/(alpha_h(V)+beta_h(V));
}
double power_2(double x)
{
return x*x;
}
double power_3(double x)
{
return x*x*x;
}
double power_4(double x)
{
return x*x*x*x;
}
double m_Ca_inf(double V)
{
return 1.0/(1.0+exp(-(V+20.0)/9.0));
}
double m_KNa_inf(double x)
{
return m_inf_max/(1.0+pow(EC_50/x,Hill_order));
}
double phi_Na(double x)
{
return(x*x*x/(x*x*x+Kp*Kp*Kp));
}
int within_proxy(double x,double target,double tolerance)
{
while(x>500.0) x-=500.0;
if(x>=(target-tolerance) && x<=(target+tolerance))
return 1;
else return 0;
}