-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhillfunction.py
54 lines (48 loc) · 997 Bytes
/
hillfunction.py
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
#! /usr/bin/python
import matplotlib.pyplot as plt
import numpy as np
import math
def Res(c):
K = 6000
Rmax = 170
n = 1.5
if(c != 0):
r = Rmax/(1+math.pow(K/c , n))
else:
r = 0
return r
def FM(m):
m = math.log(m)
fm = 67
m_half = math.pow(10,-1.5)
n = 0.04
if(m!=0):
try:
f = fm / (1 + math.pow(m_half/m,n))
except:
print "M",m
return 0
else:
f = 0
return f
def FC(c):
fm = 67
n = 0.04
c_half = -1.5
f = fm/(1+math.exp(-math.log(10)*n*(c-c_half)))
return f
size = 90000
R = [Res(i) for i in np.arange(0,size,0.2)]
x = np.arange(0,size,0.2)
x1 = np.arange(0.001,1000,0.001)
f1 = [FM(i) for i in np.arange(0.001,1000,0.001)]
x2 = np.arange(0.001, 1000, 0.0001)
f2 = [FC(i) for i in np.arange(0.001, 1000, 0.0001)]
#print R
fig = plt.figure()
#plt.plot(x,R)
plt.plot(x1,f1)
#plt.plot(x2,f2)
plt.xscale('log')
plt.savefig("hill2.png")
plt.show()