-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathez_plot_normravn.py
More file actions
36 lines (30 loc) · 870 Bytes
/
ez_plot_normravn.py
File metadata and controls
36 lines (30 loc) · 870 Bytes
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
#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
import math
x = np.linspace(0.0, 5.0, 100)
def getback(mult, bord = 900):
pows = 1
while bord > 1.0:
bord = bord / mult
pows += 1
return pows
def func_norm(nvzk, sko):
return 1.0/(np.sqrt(2.0*3.1415927)*sko)*np.exp(-0.5*(nvzk**2)/(sko**2))
def func_ravn(sko):
return 1.0/(3.5*sko)
skos = [ 0.2, 0.5, 1.0, 3.0, 8.0 ]
mathf = [ func_norm(x, sko)/func_ravn(sko) for sko in skos ]
color = [ 'r.', 'g.', 'b.', 'y.', 'k.' ]
for i in range(len(mathf)):
f0 = func_norm(0, skos[i])
f1 = func_ravn(skos[i])
print("for sko %f max_norm: %f max_ravn: %f" % (skos[i], f0, f1))
print(" bord= %f" % getback(f0/f1, 100))
plt.plot(x, mathf[i] , color[i])
plt.xlabel(r'$x$')
plt.ylabel(r'$f(x)$')
plt.grid(1)
# plt.ylim([-1.0,4.0])
plt.ylim([0.0,2.2])
plt.show()